Ask Your Question

useanalias's profile - activity

2017-08-22 16:09:27 -0600 received badge  Good Question (source)
2014-08-13 03:56:15 -0600 received badge  Nice Question (source)
2014-08-12 23:11:46 -0600 commented question Bug in Documentation Code
2014-08-12 22:55:32 -0600 received badge  Student (source)
2014-08-12 20:56:14 -0600 received badge  Supporter
2014-08-12 20:55:01 -0600 asked a question Bug in Documentation Code

I was reading through the OpenCV tutorial for image scanning when I ran into a peculiar line of code (link):

// accept only char type matrices
CV_Assert(I.depth() != sizeof(uchar));

This code partially works because I.depth() returns CV_8U (which is 0), while sizeof(uchar) returns 1. If an array of another type is passed in though, the code will fail unless (coincidentally) I.depth() returns 1.

Here is what I recommend replacing these lines with:

// accept only char type matrices
CV_Assert(I.depth() == CV_8U);