Re: adding noise to an image



Foster, Gareth wrote:

uint8 * p_buf = get_buf_blah_pseudo();
uint8 by_val = rand()%std::numeric_limits<uint8>::max_val;
std::fill(p_buf, p_buf + 3, by_val);


[ snip ]

If I'm not mistaken, that would create an image of one pixel value.


I meant ...

 // up front ...
 uint8 * p_buf = get_buf_blah_pseudo();

 // ... then later, per pixel ...
 uint8 by_val = rand()%std::numeric_limits<uint8>::max_val;
 std::fill(p_buf, p_buf + 3, by_val);


It was just meant to illustrate the statement about settings rgb to the same
values.

Nice tip on the 'randomness' btw, cheers.

Gaz
Ahhh, lol.

I completely wasn't paying attention to the limits of the filling. I just realized that was only putting by_val in 3 values, not the entire image.

My bad.

But that'd still give you an image of noise, its not an alterative process, its difinitive. I mean, that would give you a picture of tv snow, not a picture of grandma that looked like it had been taken with a bad camera which as I understood it was the idea.

Damn stl algorithms.....
Paul





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]