cv2.imread flags not found

前端 未结 2 917
甜味超标
甜味超标 2020-12-09 03:28

I recently started working with openCV and python and decided to analyze some sample code to get an idea of how things are done.

However, the sample code I found, ke

2条回答
  •  没有蜡笔的小新
    2020-12-09 04:08

    OpenCV 3.0 came with some namespace changes, and this might be one of them. The function reference given in the other answer is for OpenCV 2.4.11, and unfortunately there are significant renamings, including enumerated parameters.

    According to the OpenCV 3.0 Example here, the correct parameter is cv2.IMREAD_COLOR.

    According to the OpenCV 3.0 Reference Manual for C, CV_LOAD_IMAGE_COLOR is still there.

    And my conclusion from the above resources and here, they changed it in OpenCV 3.0 python implementation.

    For now, the best to use seems like the following:

    img = cv2.imread("link_to_your_file/file.jpg", cv2.IMREAD_COLOR) 
    

提交回复
热议问题