-1

I've installed opencv2.4.9 with libstdc++ through brew install opencv in MAC OSX 10.9.

I try to imread an image from INRIA pedestrian database. The problem is that when I use opencv to read the PNG format image, I always get this error:
libpng error: IDAT: invalid distance too far back

The version of libpng is 1.6.13 which was also installed by brew install command.

Can anyone help me with this? Many thanks.

coldmoon
  • 33
  • 1
  • 6

1 Answers1

0

I just solved this problem. First, brew uninstall libpng and brew uninstall opencv. Then, brew install libpng12 and brew install --build-from-source --fresh -vd opencv. In this process, libpng will also be installed. Even though both libpng and libpng12 are installed, opencv will only use libpng12.

I guess the image from INRIA database maybe a little old to libpng-1.6.13 library. So, we have to use older libpng version, libpng12, to read it.

Update: 2014.10.29

I found another way to solve this problem. This way is better. First, brew edit opencv and go to the line which contains depends_on :libpng. Then, press 'i' and switch to edit mode. change depends_on :libpng to depends_on "libpng12". press :wq to save. Finally, brew install opencv.

By doing this, opencv will be compiled using libpng12 instead of libpng16.

coldmoon
  • 33
  • 1
  • 6