fengyecl 2015-01-13 01:47 采纳率: 0%
浏览 2798

opencv与MATLAB打开同一图片,显示不一样,opencv右侧有空白区域

图片说明

这张图片是截图得到的,用matlab打开没有问题,用opencv打开就出现如图所示的问题,我是小白,求大神解答

  • 写回答

1条回答

  • shiter 人工智能领域优质创作者 2015-01-13 02:09
    关注

    imread函数的参数没有传递正确,应该传大于零的参数,我记得:
    Python: cv2.imread(filename[, flags]) → retvalC: IplImage* cvLoadImage(const char* filename, int flags=CV_LOAD_IMAGE_COLOR )C: CvMat* cvLoadImageM(const char* filename, int flags=CV_LOAD_IMAGE_COLOR )Python: cv.LoadImage(filename, flags=CV_LOAD_IMAGE_COLOR) → NonePython: cv.LoadImageM(filename, flags=CV_LOAD_IMAGE_COLOR) → None

    Parameters:
    filename – Name of file to be loaded.
    flags –
    Flags specifying the color type of a loaded image:
    ◦>0 Return a 3-channel color image
    ◦=0 Return a grayscale image
    ◦<0 Return the loaded image as is. Note that in the current implementation the alpha channel, if any, is stripped from the output image. For example, a 4-channel RGBA image is loaded as RGB if flags\ge0 .

    The function imread loads an image from the specified file and returns it. If the image cannot be read (because of missing file, improper permissions, unsupported or invalid format), the function returns an empty matrix ( Mat::data==NULL ). Currently, the following file formats are supported:

    Windows bitmaps - *.bmp, *.dib (always supported)
    JPEG files - *.jpeg, *.jpg, *.jpe (see the Notes section)
    JPEG 2000 files - *.jp2 (see the Notes section)
    Portable Network Graphics - *.png (see the Notes section)
    Portable image format - *.pbm, *.pgm, *.ppm (always supported)
    Sun rasters - *.sr, *.ras (always supported)
    TIFF files - *.tiff, *.tif (see the Notes section)

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题