Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why am I getting assertion failed in cvtColor even when convertTo was called in the line before?

Hi everyone, I am having a pretty small error but I cannot figure out why I am getting it.

//Setup the input
Mat* image=(Mat*)addrImg;
Mat character = *image;
threshold( character, character, 0, 255,1 );
Mat color_dst;

I have this code which is in the android jni, the way I am calling cvtColor should only require a one channel image, since I am going from grey to BGR, but I keep getting this error:

01-19 00:37:44.269: E/cv::error()(32379): OpenCV Error: Assertion failed
 (scn == 1 && (dcn == 3 || dcn == 4)) in void 
cv::cvtColor(cv::InputArray, cv::OutputArray, int, int), 
file /home/reports/ci/slave/opencv/modules/imgproc/src/color.cpp, line 3355

It really cannot figure otu why I am getting the error, can anyone help me out here? It would be greatly appreciated.