Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Accessing pixels in a Mat vector

I have reshape a 2d grayscale image to a 1d Mat.I want to access and change each pixel.Each pixel should be 0-255

Mat input_img = imread(argv[1], IMREAD_GRAYSCALE); 
Mat input_vector = input_img.reshape(0,1); 
std::cout << input_1d_vector.at<int>(0,1);

However it is not ouputing a sensible pixel value.My apologies if its a dumb question , i am new with opencv