Why won't this work; opencv Mat_<float>
Posted
by
user1371674
on Stack Overflow
See other posts from Stack Overflow
or by user1371674
Published on 2012-07-09T15:12:44Z
Indexed on
2012/07/09
15:15 UTC
Read the original article
Hit count: 196
I can't seem to get this to work. I'm trying to get the pixel value of an image but first need to change the color of the image, but since I cannot use int or just Mat because the values are not whole numbers, I have to use and because of that errors pop up when I try to run this on the cmd.
int main(int argc, char **argv)
{
Mat img = imread(argv[1]);
ofstream myfile;
Mat_<float> MatBlue = img;
int rows1 = MatBlue.rows;
int cols1 = MatBlue.cols;
for(int x = 0; x < cols1; x++) {
for(int y = 0; y < rows1; y++) {
float val = MatBlue.at<cv::Vec3b>(y, x)[1];
MatBlue.at<cv::Vec3b>(y, x)[0] = val + 1;
}
}
}
© Stack Overflow or respective owner