Important: Please read the Qt Code of Conduct -

Count every pixels in image opencv python

  • Hello i am new in open cv i want to count every pixel in image then count the blue pixel so far i have done the blue pixel counting but it does not work probably so i want to count every brg pixel then defin the blue pixel this is my code
    @ import cv2
    import numpy as np

    img = cv2.imread("mm.jpg")
    BLUE_MIN = np.array([0, 0, 0], np.uint8)
    BLUE_MAX = np.array([255, 20, 20], np.uint8)

    dst = cv2.inRange(img, BLUE_MIN, BLUE_MAX)
    no_blue = cv2.countNonZero(dst)
    print('The number of blue pixels is: ' + str(no_blue))
    Please help me i am stack in this code

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Your question is completely unrelated to Qt. You should ask it on the OpenCV forums/mailing list

Log in to reply