Search code examples
c++qtgeotiff

Display geotiff images with qt


I am currently trying to make a graphical interface to a script projecting DSMs (geotiff file) on images. I thought it was a good idea to display both image and DSM before making some computations. Unfortunately, even if there is no problem to display the image, I have the following error while trying to display the DSM:

TIFFReadDirectory: Warning, foo: unknown field with tag 33550 (0x830e) encountered.
TIFFReadDirectory: Warning, foo: unknown field with tag 33922 (0x8482) encountered.
TIFFReadDirectory: Warning, foo: unknown field with tag 42112 (0xa480) encountered.
TIFFReadDirectory: Warning, foo: unknown field with tag 42113 (0xa481) encountered.
foo: Sorry, can not handle images with 32-bit samples.
QPixmap::scaled: Pixmap is a null pixmap

Here is what I am currently trying:

QString s1 = QFileDialog::getOpenFileName(this, "Open a DSM", "/home", "Images (*.png *.xpm *.jpg *.tif *.tiff)");
ui->DSMPath->setText(s1);
QPixmap dispdsm(s1);
int w = ui->DSMDisplay->width();
int h = ui->DSMDisplay->height();
ui->DSMDisplay->setPixmap(dispdsm.scaled(w,h,Qt::KeepAspectRatio));

I searched on the internet, but it seems that there is no solution yet.

I precise that I am working on Ubuntu with QT and OpenCV and Magick++ libraries.

Can someone please help me ? Thanks a lot :)


Solution

  • Qt simply doesn't support the images in the format that you're using. You'd need to use your own QImageIOHandler wrapper for libgeotiff.