Opening .tiff geoimages consumes enormous memory
-
I am trying opening the tiff with this command:
QImageReader reader("/home/UbuntuUser/Desktop/UAV.tif"); print(reader)
but something is wrong... Any idea?
update:
File "code.py", line 547 QImageReader reader("/home/UbuntuUser/Desktop/UAV.tif"); ^ SyntaxError: invalid syntax
-
What does "but something is wrong" mean ?
-
Hi
That looks like c++ syntax but you are using python, right ?
So is it not like
r = QImageReader("/home/UbuntuUser/Desktop/UAV.tif") -
This post is deleted!
-
This post is deleted!
Hi
Why this old version ?Anyway, what are you trying ?
Building PyQT4 from source ?
Also is there any reason you want to use the competing Qt binding from another company instead of the
official support one called pyside2 ?
https://pypi.org/project/PySide2/
https://doc.qt.io/qtforpython/ -
I don't know what goes wrong...
I just try to handle large tiff images instead of using opencv (that makes my program realy slow) with QTimagereader
Sorry, I didn't identify it was a competing company...just a result in google when tried to install PyQt4
Ok, I will look at it.
-
I don't know what goes wrong...
I just try to handle large tiff images instead of using opencv (that makes my program realy slow) with QTimagereader
Sorry, I didn't identify it was a competing company...just a result in google when tried to install PyQt4
Ok, I will look at it.
@john_hobbyist
Hi
Np I just wondered why you want Qt4 version and build from the source when
PyQt5 is there and seems to be installable directly.
Also here is how to use it
https://programtalk.com/python-examples/PyQt5.Qt.QImageReader/
Do note none of them use setClipRect to load image in chunks but
should be easy to add. -
QtImagrReader is for sure not the correct way to handle geotiff. Either use openCV or better gdal for such tasks.
-
QtImagrReader is for sure not the correct way to handle geotiff. Either use openCV or better gdal for such tasks.
I am trying GDAL in order to print the image:
from osgeo import gdal import sys ds = gdal.Open('UAV_image.tif') print(ds)
and I get this error:
<osgeo.gdal.Dataset; proxy of <Swig Object of type 'GDALDatasetShadow *' at 0x7fb89062b840> >
Any idea what I am missing here?
-
@john_hobbyist said in Opening .tiff geoimages consumes enormous memory:
Any idea what I am missing here?
Nothing. All is fine.
-
Why I cannot see the image?
-
The Python print function only print strings or a string representation of the object.
Check if GDAL provides a widget or equivalent for that.
-
Ok, until now OpenCV requires ~24GB RAM, gdal does not work. Is there any QImageReader sample code to open the .tif? I am searching the google for this...nothing found.
-
Ok, until now OpenCV requires ~24GB RAM, gdal does not work. Is there any QImageReader sample code to open the .tif? I am searching the google for this...nothing found.
@john_hobbyist
Hi
in what way did GDAL not work ?Also, Mr @Christian-Ehrlicher made me realize that geotiff is a special tiff so
even QImageReader can read an image in sections. it might not really do what you want.What do you need to do to this image ?
-
Ok, until now OpenCV requires ~24GB RAM, gdal does not work. Is there any QImageReader sample code to open the .tif? I am searching the google for this...nothing found.
@john_hobbyist I wonder what you want to do with this image when you even don't know the basics of this format... it's a georeferenced image with multiple images and bands inside. It's not a simple picture at all.
-
@mrjj and @Christian-Ehrlicher:
I want to open it and do some zooming with code I use. Also I want to read the coordinates from the image (I do not how, but I am searching it)
-
@mrjj and @Christian-Ehrlicher:
I want to open it and do some zooming with code I use. Also I want to read the coordinates from the image (I do not how, but I am searching it)
@john_hobbyist
Ok then QImageReader is not the way as it can't access any coordinates.I think you gave up on GDAL too fast. It's whats people seem to use.
-
@mrjj: yes with
gdalinfo
command on the terminal I get the information I want...
Is there any way to get these information from the terminal and feed it to my python code for further processing? In other words how do I read information posted in terminal and use it inside my python code?Ok, I will try again gdal to open the .tif
-
@mrjj: yes with
gdalinfo
command on the terminal I get the information I want...
Is there any way to get these information from the terminal and feed it to my python code for further processing? In other words how do I read information posted in terminal and use it inside my python code?Ok, I will try again gdal to open the .tif
@john_hobbyist
Hi
well yes, you could call gdalinfo with QProcess
https://www.learnpyqt.com/tutorials/qprocess-external-programs/
read the section with "Getting data from the QProcess" -
Hello,
Ok I read it.What is wrong in this code, and I cannot run the command via python command:
import sys import time def flush_then_wait(): sys.stdout.flush() sys.stderr.flush() time.sleep(0.5) sys.stdout.write('gdalinfo UAV_image.tif') flush_then_wait()
on the terminal I run gdalinfo UAV_image.tif and prints me the metadata of the .tif, but I cannot run it through the python script