Ask Your Question
1

Strange Assert in setTo

asked 2012-11-30 05:08:10 -0600

Jeff gravatar image

Hi there,

I was doing some basic image processing and I used a Mat of type CV_8UC3 as a mask. Apparently this is incorrect, so the program failed on a OpenCV assert. So far no problem, just my misinterpretation.

But here's the issue: I read the assert to find out what I did wrong, and it has a strange comparison: mask.empty() || mask.type() == CV_8U

The type of the mask is compared to a depth... Although the comparison is equivalent to mask.type() == CV_8UC1, it's confusing for a simple user...

So my question is: is this a bug? Should I report it?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2012-12-03 15:08:12 -0600

AlexanderShishkov gravatar image

It is not a bug, because CV_8U = CV_8UC1=0, but it leads to misinterpretation. You should report about this problem on our bug tracker (code.opencv.org).

But the best way is to create pull request with fix for this problem.

edit flag offensive delete link more
0

answered 2012-11-30 05:23:02 -0600

wl2776 gravatar image

Looks like a bug. Report, of course.

According to reference manual (opencv2refman.pdf, page 35), values like CV_8U or CV_8S, or CV_16U, etc, are returned from Mat::depth().

Mat::type() returns a constant, having number of channels, like CV_8UC3

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-11-30 05:08:10 -0600

Seen: 641 times

Last updated: Dec 03 '12