RE: adding noise to an image



> >  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



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