0

enter image description here

I have got the following exception in my OpenCV program. I had the following image in my computer and I moved it to my mobile phone and read it by Mat imageRead = Highgui.imread("/mnt/sdcard/Pictures/2im00.png");

enter image description here

Then I tried to convert its color space to HSV using the following statement, and got the exception on this statement.

Imgproc.cvtColor(imageRead, hsvImage, Imgproc.COLOR_RGB2HSV);

But the exception does not seem to tell me anything more than that it is in the function cvtColor, or I can't read the encoded information there.

So the question is that how do I find out why I am getting this exception?

Is there any coded information there, like some codes (like scn==3 or scn==4 or error:-215 or depth etc etc), which I can browse somewhere to find out why I am getting the exception?

1
  • 2
    Have a look also here. OpenCV it's saying you that your source image channels scnshould be 3 or 4, while it's depth should be unsigned char (CV_8U) or float (CV_32F) Commented Dec 10, 2015 at 22:58

1 Answer 1

2

Most probably, Assertion failure occurs because you are passing an empty image to the cvtColor function. Or The Mat image you are passing is not an CV_8U or CV_32F format.

I agree with Miki's comment for more details follow this link How to interpret c++ opencv Assertion error messages due to an error in cvtColor function?

Sign up to request clarification or add additional context in comments.

1 Comment

You should also add the link from Miki's comment, because that will make your answer more useful for future visitors. (Don't forget to give due credit to them).

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.