jpg格式可以用linux,linux下的opencv不支持jpg文件

Loads an image from a file.

Parameters:

filename – Name of file to be loaded.

flags –

Specifies color type of the loaded image:

>0 the loaded image is forced to be a 3-channel color image

=0 the loaded image is forced to be grayscale

<0 the loaded image will be loaded as-is (note that in the current implementation the alpha channel, if any, is stripped from the output image, e.g. 4-channel RGBA image will be loaded as RGB if

b829b508fb94286c8334adea9a20ea82f7a21f3e.png ).

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:

Windows bitmaps - *.bmp, *.dib (always supported)

JPEG files - *.jpeg, *.jpg, *.jpe (see Note2 )

JPEG 2000 files - *.jp2 (see Note2 )

Portable Network Graphics - *.png (see Note2 )

Portable image format - *.pbm, *.pgm, *.ppm (always supported)

Sun rasters - *.sr, *.ras (always supported)

TIFF files - *.tiff, *.tif (see Note2 )

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 onOPENCV_BUILD_3RDPARTY_LIBSflag in CMake.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值