分类:
2011-03-07 16:04:35
cvLoadImage返回NULL
安装最新的jpg库
apt-get install libjpeg62 libjpeg62-dev libjpeg62-dbg
cmake开启第三方库支持OPENCV_BUILD_3RDPARTY_LIBS=ON
linux下默认只支持bmp
可以用cvSaveImage函数来实现不同图像格式之间的转换。
Loads an image from a file.
Parameters: |
|
---|
The function imread loads an image from the specified file and returns it. If the image can not be read (because of missing file, improper permissions, unsupported or invalid format), the function returns empty matrix ( Mat::data==NULL).Currently, the following file formats are supported:
Note1 : The function determines type of the image by the content, not by the file extension.
Note2 : On Windows and MacOSX the shipped with OpenCV image codecs (libjpeg, libpng, libtiff and libjasper) are used by default; so OpenCV can always read JPEGs, PNGs and TIFFs. On MacOSX there is also the option to use native MacOSX image readers. But beware that currently these native image loaders give images with somewhat different pixel values, because of the embedded into MacOSX color management.
On Linux, BSD flavors and other Unix-like open-source operating systems OpenCV looks for the supplied with OS image codecs. Please, install the relevant packages (do not forget the development files, e.g. “libjpeg-dev” etc. in Debian and Ubuntu) in order to get the codec support, or turn on OPENCV_BUILD_3RDPARTY_LIBS flag in CMake.