Ask Your Question
0

Does CV(IMREAD.flag) support channels more than 5

asked 2020-04-01 04:10:57 -0600

There are some .tif format datasets about remote sensing. you know,channels of remote sensing are not least 3 or 4. I had tried IMREAD.UNCHANGED and I don't konw whether I chosed wrong flag or CV2 does not support this kind of channels

edit retag flag offensive close merge delete

Comments

1

AFAIK OpenCV imread doesn't support multichannel TIFF files. Here's my answer for reading them using libtiff directly.

kbarni gravatar imagekbarni ( 2020-04-02 16:08:08 -0600 )edit

okay.Let'm explore lib,but I wonder whether the zip module will zip it after the lib read tif.And I want to feed the mutichannerl TIFF format to model

squirrel gravatar imagesquirrel ( 2020-04-02 20:51:38 -0600 )edit

if the tiff is <=4 channel, simple imread can load it. GDAL is also a fair option to load multispectral tiff images, by my knowledge it has a nice Python interface (C++ is a bit rougher tho), and theorically, if you build opencv with GDAL, the IMREAD_LOAD_GDAL flag should let you load multispectral images with simple imread. BUT I have concerns if it reads only 3 channels, and I wrote a function using the GDAL interface directly to load images. Libtiff probably better for C++ implementations.

HagymaGyilkos gravatar imageHagymaGyilkos ( 2020-04-03 10:12:28 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-04-02 13:23:07 -0600

crackwitz gravatar image

this suggests that 512 is the upper limit for cv::Mat: https://docs.opencv.org/3.4/d1/d1b/group__core__hal__interface.html#ga3de14a42631396fe0480be69d5d2363f

cv::imread uses third party libraries. they may or may not support more than four channels. opencv may not be prepared to accept more channels even if the library can do it.

opencv's imread is a simple function. instead you might want to use an appropriate library directly. libtiff may be suitable.

edit flag offensive delete link more

Comments

hey thanks bro.I wonder whether the zip module of lib will zip tif after the lib read it.And I want to feed the mutichannerl TIFF format to model

squirrel gravatar imagesquirrel ( 2020-04-02 20:52:39 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-04-01 04:10:57 -0600

Seen: 1,516 times

Last updated: Apr 02 '20