Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

see here

normalize(src, dst, 0, 255, NORM_MINMAX);

see here

// make a mask, where "wanted" pixels are 255
Mat mask;
inRange(img, Scalar::all(50), Scalar::all(100), mask); // ::all in case of multiple chans

// to [0,255], restricted to mask "on" (else set to 0)
normalize(src, dst, 0, 255, NORM_MINMAX);
NORM_MINMAX, -1, mask);

see here

// make a mask, where "wanted" pixels are 255
Mat mask;
inRange(img, inRange(src, Scalar::all(50), Scalar::all(100), mask); // ::all in case of multiple chans

// to [0,255], restricted to mask "on" (else set to 0)
// Mat dst;
normalize(src, dst, 0, 255, NORM_MINMAX, -1, mask);