1 | initial version |
It seems like your image isn't grayscale. convertTo doesn't change channels number, only depth. If you want to convert image to grayscale you should call cvtColor
Mat* image=(Mat*)addrImg;
Mat character;
cvtColor(*image, character, CV_BGR2GRAY);
character.convertTo(character, CV_8U);
threshold(character, character, 0, 255, 1);
Mat color_dst;
cvtColor(character, color_dst, CV_GRAY2BGR);