0

I know we can set all pixel values, and access each pixel to set values. Suppose I already have a set of pixels, whose value alone, I want to set as say 255. Is this possible, in opencv? Is there a function can do this? Sorry if this question is rudimentary

Lakshmi Narayanan
  • 4,550
  • 13
  • 42
  • 84
  • Have you tried [this question](http://stackoverflow.com/questions/9974946/how-to-edit-read-pixel-values-in-opencv-from-mat-variable) ? – pwwpche Apr 26 '15 at 23:26
  • I think the asnwer given was something I was looking for. I already know how to access elements, as I had mentioned @pwwpche – Lakshmi Narayanan Apr 26 '15 at 23:33
  • [This](http://stackoverflow.com/questions/8971308/what-is-cvsetto-function) gives a better explanation on how to use the function as well. – Lakshmi Narayanan May 02 '15 at 09:27

1 Answers1

2

Check out the setTo function, which allows to set the value of some masked mat elements:

Mat& Mat::setTo(InputArray value, InputArray mask=noArray() )
ChronoTrigger
  • 7,849
  • 1
  • 34
  • 50