Accessing pixel value with .at<uchar> and .at<Vec3b> does not work
I am trying to rewrite the value for a pixel in a Mat-type grayscale image using Visual Studio Express 2012 for Windows Desktop. I've tried:
1) imgGrayComp.at<uchar>(5, 4) = 0;
2) imgGrayComp.ptr(4)[5] = 0;
3) imgGrayComp.at<vec3b>(5, 4) = 0;
But it gives me this instead:
OpenCV Error: Assertion failed (dims <= 2 && data && (unsigned)i0 < (unsigned)size.p[0] && (unsigned)(i1DataType<_Tp>::channels) < (unsigned)(size.p[1]channels()) && ((((sizeof(size_t)<<28)|0x8442211) >> ((DataType<_Tp>::depth) & ((1 << 3) - 1))*4) & 15) == elemSize1()) in cv::Mat::at, file c:\opencv\build\include\opencv2\core\mat.hpp, line 537
I think there are some problem in Visual Studio "Express" 2012 combine opencv
^ No ... I've been told that the problem lies in the use of
image.convertTo(imageGrayClassify, COLOR_BGR2GRAY);
instead ofcvtColor(image, imageGrayClassify, COLOR_BGR2GRAY );
... but once I substituted the calls, I getOpenCV Error: Assertion failed (scn == 3 || scn == 4) in cv::cvtColor, file ..\..\..\..\opencv\modules\imgproc\src\color.cpp, line 3737
on the command prompt.