2

I am using java opencv and this is the line that I am executing.

Imgproc.cvtColor(originalImage, hsvImage, Imgproc.COLOR_BGR2HSV);
Core.inRange(hsvImage, low, high, thresholdImage);

low and high are some Scalar values(of size 3 each). So my original image as you can see is of 3 channels, but my thresholdImage has only one channel, why? As a result of this, when I try to display thresholdImage, I get three small images in my JFrame. How to fix this?

1
  • I think the question is quite complete. SO's policy needs questions that are specific and I think this question is quite specific and I tend to keep my questions as specific as possible without unnecessary information. Please refer to my answer as I think I have figured it out. If I am wrong, please do correct me. Thanks. Commented May 11, 2017 at 2:58

1 Answer 1

2

It turns out that Core.inRange changes the second argument, which is a Mat, to a single channel image. So in order to get 3 channels, I needed to use Imgproc.cvtColor function to re-convert it back to 3 channels.

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.