How does one convert a grayscale image to RGB in OpenCV (Python)?

前端 未结 4 1880
忘掉有多难
忘掉有多难 2020-12-08 06:15

I\'m learning image processing using OpenCV for a realtime application. I did some thresholding on an image and want to label the contours in green, but they aren\'t showing

4条回答
  •  青春惊慌失措
    2020-12-08 06:33

    Try this:

    import cv2
    import cv
    
    color_img = cv2.cvtColor(gray_img, cv.CV_GRAY2RGB)
    

    I discovered, while using opencv, that some of the constants are defined in the cv2 module, and other in the cv module.

提交回复
热议问题