1 | initial version |
so, your file is in the "plain PGM" format, and contains asingle channel uchar data (not double).
to get a double *
, you'll have to convert it:
Mat pgm_image = imread("image.pgm", IMREAD_GRAYSCALE); //flag is important !
Mat pgm_double;
pgm_image.convertTo(pgm_double, CV_64F); // optionally scale by 1.0/255, if you need [0..1] range
double *I = pgm_double.ptr<double>(0);
2 | No.2 Revision |
so, your file is in the "plain PGM" format, and contains asingle single channel uchar data (not double).
to get a double *
, you'll have to convert it:
Mat pgm_image = imread("image.pgm", IMREAD_GRAYSCALE); //flag is important !
Mat pgm_double;
pgm_image.convertTo(pgm_double, CV_64F); // optionally scale by 1.0/255, if you need [0..1] range
double *I = pgm_double.ptr<double>(0);