OpenCV TypeError: Expected cv::UMat for argument 'src' - What is this?

后端 未结 11 1264
故里飘歌
故里飘歌 2020-12-01 15:44

Disclaimer: huge openCV noob

Traceback (most recent call last):

File \"lanes2.py\", line 22, in

canny = canny(lane_image)         


        
相关标签:
11条回答
  • 2020-12-01 16:24
    gray = cv2.cvtColor(cv2.UMat(imgUMat), cv2.COLOR_RGB2GRAY)
    

    UMat is a part of the Transparent API (TAPI) than help to write one code for the CPU and OpenCL implementations.

    0 讨论(0)
  • 2020-12-01 16:25

    The following can be used from numpy:

    import numpy as np 
    image = np.array(image)
    
    0 讨论(0)
  • 2020-12-01 16:27

    This is a general error, which throws sometimes, when you have mismatch between the types of the data you use. E.g I tried to resize the image with opencv, it gave the same error. Here is a discussion about it.

    0 讨论(0)
  • 2020-12-01 16:27

    Some dtype are not supported by specific OpenCV functions. For example inputs of dtype np.uint32 create this error. Try to convert the input to a supported dtype (e.g. np.int32 or np.float32)

    0 讨论(0)
  • 2020-12-01 16:27

    that is referring to the expected dtype of your image
    "image".astype('float32') should solve your issue

    0 讨论(0)
提交回复
热议问题