1 | initial version |
Simply do the following...
First create a mask image using inRange, here you should use your upper and lower threshold.
Now using Mat::copyTo copy your source Mat to a new Mat, with the above mask.
Just see the below code
Mat src; //Your source image
Mat mask,dst;
inRange(src,Scalar(300),Scalar(400),mask);
src.copyTo(dst,mask); // Your final mat with value between 300 and 400
2 | No.2 Revision |
Simply do the following...
First create a mask image using inRange, here you should use your upper and lower threshold.
Now using Mat::copyTo copy your source Mat to a new Mat, with the above mask.
Just see the below codeCode:
Mat src; //Your source image
Mat mask,dst;
inRange(src,Scalar(300),Scalar(400),mask);
src.copyTo(dst,mask); // Your final mat with value between 300 and 400
3 | No.3 Revision |
Simply do the following...
First create a mask image using inRange, here you should use your upper and lower threshold.
Now using Mat::copyTo copy your source Mat to a new Mat, with the above mask.
Code:
Mat src; //Your source image
Mat mask,dst;
inRange(src,Scalar(300),Scalar(400),mask);
inRange(src,Scalar(300),Scalar(400),mask); // Create a mask image in the range 300 and 400
src.copyTo(dst,mask); // Your final mat with value between 300 and 400