I have my image mRgba
and when I do this :
Core.inRange(mRgba, B1, B2, mRgba);
I have the result that I expect : all my RGBA image is thresholded between B1 and B2.
Now I want to do this :
Mat roi = mRgba.submat(rect);
Core.inRange(roi, B1, B2, roi);
And it's not apply on my area rectangle, I try everything since 3 hours I can't find a solution...
OK, maybe everybody doesn't care, but after many tries, i found the answer.
Mat roi = new Mat();
roi = mRgba.submat(rect);
Mat roiTmp = roi.clone();
Imgproc.cvtColor(roiTmp, roiTmp, Imgproc.COLOR_RGB2HSV);
Core.inRange(roiTmp, B1, B2, roiTmp);
Imgproc.cvtColor(roiTmp, roi, Imgproc.COLOR_GRAY2BGRA);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With