Ask Your Question

Revision history [back]

Replace the line

cv::Mat cvMat(rows, cols, CV_8UC1); // 8 bits per component, 1 channels

                              with

cv::Mat rgba(rows, cols, CV_8UC4, Scalar(1,2,3,4)); // 8 bits per component, 4 channels

in the following link : http://docs.opencv.org/trunk/d3/def/tutorial_image_manipulation.html

  • (cv::Mat)cvMatGrayFromUIImage:(UIImage *)image { .... ... ... }