Reputation: 581
Suppose there is a frame with some image.I want to display only those parts which have pixel intensity above 120 or 130. How can I do that with OpenCv ? Is there any commands to do so? Then i need to set those parts to some intensity of 190.
Upvotes: 0
Views: 508
Reputation: 14011
As mentioned by astay13, you can use the threshold function like this:
Mat image = imread("someimage.jpg", 0); // flag == 0 means read as grayscale
Mat mask;
// this tells you where locations >= 120 pixel intensity are
threshold(image, mask, 120.0, 255.0, THRESH_BINARY);
// this sets those locations to 190 based on the mask you just created
image.setTo(Scalar(190, 0, 0), mask);
imshow("image", image);
Hope that is helpful!
Upvotes: 1
Reputation: 6927
You could try the cvThreshold function. For the second part, cvFloodFill might be what you need.
Upvotes: 1