Reputation: 3034
Using the cvSet method we can easily fill an image with solid colours. Is there any method which can help you remove some colours from ur image (e.g I have an Image of a forest. Basically it will have a lot of green component, leaves etc. Can I remove the green color keeping everything else same.)
Upvotes: 4
Views: 4796
Reputation: 1566
char* inputPath = "TEST.png";
Mat src = imread(inputPath);
Mat BGRChannels[3];
split(src,BGRChannels); // split the BGR channesl
BGRChannels[1]=Mat::zeros(src.rows,src.cols,CV_8UC1);// removing Green channel
merge(BGRChannels,3,src); // pack the image
namedWindow("B0R",1);
imshow("B0R",src);
waitKey(0);
Upvotes: 9