1 | initial version |
inRange() can't do that, but not all hope's lost:
split your image into channels:
Mat orig; // bgr, probably
Mat chan[3];
split(orig,chan); // chan[0]==blue, chan[1]==green, ..
apply your own operator on the channels to binarize them:
Mat bin_red = (chan[2]<20)|(chan[2]>100); // note: single '|'
Mat bin_grn = (chan[1]<72)|(chan[1]>155);
2 | No.2 Revision |
inRange() can't do that, but not all hope's lost:
split your image into channels:
Mat orig; // bgr, probably
Mat chan[3];
split(orig,chan); // chan[0]==blue, chan[1]==green, ..
apply your own operator on the channels to binarize them:
Mat bin_red = (chan[2]<20)|(chan[2]>100); // note: single '|'
Mat bin_grn = (chan[1]<72)|(chan[1]>155);
Mat bin_blu = (chan[0]<64)|(chan[1]>155);
Mat bin = bin_red & bin_grn & bin_blu; // where all conditions were met