Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

the function that you are looking for is the inRange(), for example:

Mat mask;
// specify the range of colours that you want to include, you can play with the borders here
cv::Scalar lowerb = cv::Scalar(255,127,39);
cv::Scalar upperb = cv::Scalar(255,127,39); 

cv::inRange(frame, lowerb, upperb, mask); // if the frame has any orange pixel, this will be painted in the mask as white

imshow("mask", mask); // show where orange pixels are located, then use this mask for further processing

the function that you are looking for is the inRange(), for example:

Mat mask;
// specify the range of colours that you want to include, you can play with the borders here
cv::Scalar lowerb = cv::Scalar(255,127,39);
cv::Scalar upperb = cv::Scalar(255,127,39); 

cv::inRange(frame, lowerb, upperb, mask); // if the frame has any orange pixel, this will be painted in the mask as white

imshow("mask", mask); // show where orange pixels are located, then use this mask for further processing
processing pass it for example to findNonZero() function in order to obtain the location of the pixels

the function that you are looking for is the inRange(), for example:

Mat mask;
// specify the range of colours that you want to include, you can play with the borders here
cv::Scalar lowerb = cv::Scalar(255,127,39);
cv::Scalar upperb = cv::Scalar(255,127,39); 

cv::inRange(frame, lowerb, upperb, mask); // if the frame has any orange pixel, this will be painted in the mask as white

imshow("mask", mask); // show where orange pixels are located, then use this mask for further processing pass it for example to findNonZero() function in order to obtain the location of the pixels
pixels, etc...