7

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...

1
  • I accept C++ code or anything, just an explanation... Commented Feb 17, 2015 at 22:11

1 Answer 1

12

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);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.