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);