AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi Noise (grains in graphics) other than random

Noise (grains in graphics) other than random

Ein Thema von WojTec · begonnen am 27. Jul 2010 · letzter Beitrag vom 28. Jul 2010
Antwort Antwort
WojTec

Registriert seit: 17. Mai 2007
477 Beiträge
 
Delphi XE6 Professional
 
#1

Noise (grains in graphics) other than random

  Alt 27. Jul 2010, 17:10
This is standard random mono noise generator for images:
Delphi-Quellcode:
for J := 0 to ASource.Height - 1 do
begin
  for I := 0 to ASource.Width - 1 do
  begin
    Amount := Random(AFactor) - (AFactor shr 1);

    Bits.R := IntToByte(Bits.R + Amount);
    Bits.G := IntToByte(Bits.G + Amount);
    Bits.B := IntToByte(Bits.B + Amount);
  end;
end;
In PSP I see 2 other methods called uniform and gaussian. Do you know how it working? And maybe do you know another color/mono noise?
  Mit Zitat antworten Zitat
blackfin
(Gast)

n/a Beiträge
 
#2

AW: Noise other than random

  Alt 27. Jul 2010, 17:23
A common form of noise is "perlin noise". It is often used for generating cloud textures or to create a detail map for graphics / textures.

Here is a website where you can download a project that generates perlin noise with Delphi:

http://www.efg2.com/Lab/Library/Delp...phics/Math.htm

just scroll down the site or text-search for "perlin noise" when the website has opened.
Maybe this helps a little bit?

Geändert von blackfin (27. Jul 2010 um 17:26 Uhr)
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
477 Beiträge
 
Delphi XE6 Professional
 
#3

Re: Noise other than random

  Alt 27. Jul 2010, 18:50
I saw this app, it's quite nice. But I'm not sure how to use Perlin Noise to generate grains on photo?
  Mit Zitat antworten Zitat
blackfin
(Gast)

n/a Beiträge
 
#4

AW: Noise other than random

  Alt 27. Jul 2010, 19:05
First, you generate the noise map with the perlin noise function shown in the project.
The noise map has to be the same size as your original photo, so make a noise map with the same size.
If you want extreme graininess, just use Layer 1 or 2.
When you have the noise map, that's half the battle.
All what's left to do is to mix the original photo and the noise map together, using color multiplication, blending, color addition or some other color mixing algorithm, depending on the effect you want to achieve

Geändert von blackfin (27. Jul 2010 um 19:08 Uhr)
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
477 Beiträge
 
Delphi XE6 Professional
 
#5

Re: Noise other than random

  Alt 27. Jul 2010, 20:11
But grain parameter do not generate less or more grains (as sample from 1st post)
However PN is good function for my app, I'll add it.
  Mit Zitat antworten Zitat
Medium

Registriert seit: 23. Jan 2008
3.627 Beiträge
 
Delphi 2007 Enterprise
 
#6

AW: Noise other than random

  Alt 28. Jul 2010, 06:50
The two methods you named only differ in their probability distribution function. Since the Delphi RNG should yield uniformly distributed results, your code sample already implements uniform noise. For gaussian noise, you'd need normal distributed numbers, which can for example be achieved by scaling the results of the uniform RNG by the normal distribution function. Another approach would be an RNG that naturally yields normal distributed values, for which I don't have a working example at hand right now.

The aforementioned Perlin noise is quite different from those, since it is a fractal (once more than the first octave is used), which is not any less good, but an entirely different class of noise.

All types of noises can be applied in 4 ways:
1) Binary monochromatic, meaning the RNG value is thresholded at some point to black and white, and mixed into the image in some manner (usually scaled to 0..2 and multiplied, or scaled to -1..1 and added (and clamped of course))
2) Binary colored, which is the same, but with new values for each color channel (further dividable into applications to various color models)
3) Continuous monochromatic, where the value of the RNG is taken as is, and interpreted as brightness, mixed with the image
4) Continuous colored, well, should be obvious

A fifth method may be called "ternary", since two thresholds are applied. Values smaller than the low threshold are black, those between low and high are nothing, and those above the high threshold are white (or "color" if a colored noise is wanted). By choosing these thresholds close to the interval borders, you get the so called "salt and pepper"-noise, which is few, but strongly miscolored pixels. That can also be done using a distribution function of ones choice, of course, as with any other means of number generation (also Perlin noise may be used for that), though uniform seems to be commonly used.

As for the application of noise to an image, there seems to be no "right" way, when not talking about a specific type or effect to simulate. Those mentioned under 1) are common, but by no means all there is. Pretty much any mixing may be used, and is well up to your likings.
"When one person suffers from a delusion, it is called insanity. When a million people suffer from a delusion, it is called religion." (Richard Dawkins)

Geändert von Medium (28. Jul 2010 um 07:01 Uhr)
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
477 Beiträge
 
Delphi XE6 Professional
 
#7

Re: Noise other than random

  Alt 28. Jul 2010, 10:59
Thanks for intoduction to noise theory Could I ask for some examples?
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +2. Es ist jetzt 11:13 Uhr.
Powered by vBulletin® Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2021 by Daniel R. Wolf