【问题标题】:Tried converting an image from RGB to GRAYSCALE using opencv on python, didn't got the results?尝试在 python 上使用 opencv 将图像从 RGB 转换为 GRAYSCALE,没有得到结果?
【发布时间】:2018-04-22 23:48:05
【问题描述】:

错误回溯(最近一次调用最后一次) 在 () ----> 1 gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

错误:/Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/color.cpp:10638:错误:(-215) scn == 3 ||函数 cvtColor 中的 scn == 4

【问题讨论】:

标签: opencv3.0


【解决方案1】:

一种可能是您尝试读取的图像不在您提供的路径中。在这种情况下,OpenCV 不会抛出错误,而只会返回 none 类型。

现在,当您尝试将 none 类型转换为灰度图像时,您会收到上述错误。

Check out the image i have posted. In this code, 'a.jpg' does not exist in the default path.

【讨论】:

    猜你喜欢
    • 2011-11-19
    • 2020-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多