Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
imread(f_name, 1);

will (force)load a 3 channel img. so you can't access that by

temp.at<cv::Vec4b>(y,x); // that would need 4 channels, right ?

try :

imread(f_name, -1);

instead ( i.e don't force it into 3 channels )

imread(f_name, 1);

will (force)load a 3 channel img. so you can't access that by

temp.at<cv::Vec4b>(y,x); // that would need 4 channels, right ?

try :

imread(f_name, -1);

instead ( i.e don't force it into 3 channels )

and, ofc, make sure, that the image you're reading actually has 4 channels. unless it prints

4 chanel

on your console, your code will crash.

imread(f_name, 1);

will (force)load a 3 channel img. so you can't access that by

temp.at<cv::Vec4b>(y,x); // that would need 4 channels, right ?

try :

imread(f_name, -1);

instead ( i.e don't force it into 3 channels )

and, ofc, make sure, that the image you're reading actually has 4 channels. unless it prints

4 chanel
chanels in image

on your console, your code will crash.