Get RGB value opencv python

前端 未结 5 879
暖寄归人
暖寄归人 2020-12-16 17:28

I am loading an image into python e.g.

image = cv2.imread(\"new_image.jpg\")

How can i acccess the RGB values of image?

5条回答
  •  既然无缘
    2020-12-16 18:10

    This code will print the red , green and blue value of pixel 300, 300:

    img1 = cv2.imread('Image.png', cv2.IMREAD_UNCHANGED)
    b,g,r = (img1[300, 300])
    print (r)
    print (g)
    print (b)
    

提交回复
热议问题