Ask Your Question

Andrey Gaganov's profile - activity

2018-09-03 07:21:20 -0600 received badge  Popular Question (source)
2014-03-12 15:22:33 -0600 received badge  Self-Learner (source)
2014-03-12 04:49:03 -0600 answered a question Accessing pixel value with .at<uchar> and .at<Vec3b> does not work

I've received a number of adequate answers on StackOverflow (see here). Turns out I had two problems, not just one. Not only was I using a wrong function (I should have used cv::cvtColor(image, imageGrayClassify, CV_BGR2GRAY) instead of image.convertTo(imageGrayClassify, COLOR_BGR2GRAY) ), but I also used a reference to an image that wasn't in the indicated path (I should have backed out into the parent directory and then go into the "src" directory where I keep all images). I've decided to stick with .ptr instead of .at<uchar> .

2014-03-06 18:40:31 -0600 commented question Accessing pixel value with .at<uchar> and .at<Vec3b> does not work

^ No ... I've been told that the problem lies in the use of image.convertTo(imageGrayClassify, COLOR_BGR2GRAY); instead of cvtColor(image, imageGrayClassify, COLOR_BGR2GRAY ); ... but once I substituted the calls, I get OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cv::cvtColor, file ..\..\..\..\opencv\modules\imgproc\src\color.cpp, line 3737 on the command prompt.

2014-03-06 13:56:06 -0600 received badge  Editor (source)
2014-03-06 13:53:58 -0600 asked a question 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