Search code examples
pythonopencvgrayscale

How can I properly convert image to gray scale in opencv


I want to find contours on the image below (white bubbles). The problem is that when I convert the image to gray with the standard way:

   gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

I do not see them (second image). Is it possible to change the conversion some how? Thank you for any help

enter image description here

enter image description here


Solution

  • import cv2
    img = cv2.imread("WNrrP.png")
    img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    cv2.imshow("h",img)
    cv2.waitKey()
    

    This works correctly for me