Ask Your Question

Revision history [back]

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. 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

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. 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

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. 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

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; 0;

2) imgGrayComp.ptr(4)[5] = 0; 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

click to hide/show revision 5
retagged

updated 2014-03-07 02:46:21 -0600

berak gravatar image

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