Ask Your Question

OpenCV does not decode gif

asked 2015-03-13 05:41:12 -0500

thdrksdfthmn gravatar image

updated 2017-09-06 18:14:33 -0500

I have found that if I want to decode an image, I always get an empty Mat. Then I have found that the picture.jpg is in fact a gif. Is there a way to open a gif that is just an image?

Just like a parenthesis: why it is a gif if the link is ending with .gif, resulting in a jfif header?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2017-09-30 14:03:25 -0500

updated 2017-10-01 00:06:46 -0500

the answer is YES if you compile OpenCV with GDAL support.

In the case you set WITH_GDAL flag to true in CMake and IMREAD_LOAD_GDAL to load the image, then GDAL driver will be used in order to decode the image by supporting the following formats: Raster,Vector.

image = imread( inputImage, IMREAD_LOAD_GDAL);

another way ( simplier ) use VideoCapture to open gif image

edit flag offensive delete link more

answered 2015-03-13 06:02:45 -0500

berak gravatar image

no, there's no gif decompression built in. (probably still a patent issue)

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-03-13 05:41:12 -0500

Seen: 2,053 times

Last updated: Oct 01 '17