Opening large image files
-
This is the method:
def getFrame(self, path): print("178") if os.path.isfile(path): print("179") frame = cv2.imread(path, 1) print("180") if not np.shape(frame) == (): print("181") self.img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) print("182") else: print("183") print("Error!") print("184") frame = cv2.imread(path, cv2.IMREAD_UNCHANGED) print("185") self.img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) print("186") else: print("187") self.openFile() print("188")
When I load a normal .tiff image (color or blackandwhite) it is displayed just fine. When I try to load a black/white .tiff image around ~2 GB. I get this kind of message:
WARN:0] OpenCV TIFF: TIFFRGBAImageOK: Sorry, can not handle images with 64-bit samples Error! imread_('/home/john/Desktop/code/IMAGES/UAV_image.tif'): can't read data: OpenCV(3.4.14) /tmp/pip-req-build-m7h7rfem/opencv/modules/imgcodecs/src/grfmt_tiff.cpp:483: error: (-215:Assertion failed) ((uint64_t)tile_width0 * tile_height0 * ncn * std::max(1, (int)(bpp / bitsPerByte)) < MAX_TILE_SIZE) && "TIFF tile size is too large: >= 1Gb" in function 'readData' . . . File "code.py", line 417, in getFrame self.img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) cv2.error: OpenCV(3.4.14) /tmp/pip-req-build-m7h7rfem/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'
Any idea?
-
Hi
Looking here
https://github.com/opencv/opencv/blob/master/modules/imgcodecs/src/grfmt_tiff.cpp
line 491
It seems that the tile size is too big. > 1 GB and
the image is 2 Gb. -
Hi
Looking here
https://github.com/opencv/opencv/blob/master/modules/imgcodecs/src/grfmt_tiff.cpp
line 491
It seems that the tile size is too big. > 1 GB and
the image is 2 Gb. -
Hi
Looking here
https://github.com/opencv/opencv/blob/master/modules/imgcodecs/src/grfmt_tiff.cpp
line 491
It seems that the tile size is too big. > 1 GB and
the image is 2 Gb.@mrjj What do I do on situations like this?
-
Hi,
You bring that question to the OpenCV folks since you are using their library to handle such files. They will be better equipped to answer about the limitations of their framework.