Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

As far as I know OpenCV doesn't provide methods to retrieve metadata from GeoTiff. Moreover OpenCV can't handle images with band interleaving. So I would suggest loading images with GDAL C++ API or LibTiff and than converting to cv::Mat. To calculate coordinates of a specific pixel you must know the origin and pixel size of the image (i.e. spacial resolution). In UTM it would be something like:

float coordinateX = originX + pixelSizeX * pixelX;
float coordinateY = originY - pixelSizeY * pixelY;

As far as I know OpenCV doesn't provide methods to retrieve metadata from GeoTiff. Moreover OpenCV can't handle images with band interleaving. So I would suggest loading images with GDAL C++ API or LibTiff and than converting to cv::Mat. To calculate coordinates of a specific pixel you must know the origin and the pixel size of the image (i.e. spacial resolution). In UTM it would be something like:

float coordinateX = originX + pixelSizeX * pixelX;
float coordinateY = originY - pixelSizeY * pixelY;

As far as I know OpenCV doesn't provide methods to retrieve metadata from GeoTiff. Moreover OpenCV can't handle images with band interleaving. So I would suggest loading images with GDAL C++ API or LibTiff and than converting to cv::Mat. To calculate coordinates of a specific pixel you must know the origin and the pixel size of the image (i.e. spacial resolution). In UTM it would be something like:cv::Mat.

float coordinateX = originX + pixelSizeX * pixelX;
float coordinateY = originY - pixelSizeY * pixelY;