Get RGB value opencv python

前端 未结 5 885
暖寄归人
暖寄归人 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 17:46

    Get B G R color value of pixel in Python using opencv

    import cv2
    image = cv2.imread("sample.jpg")
    color = int(image[300, 300])
    # if image type is b g r, then b g r value will be displayed.
    # if image is gray then color intensity will be displayed.
    print color
    

    output: [ 73 89 102]

提交回复
热议问题