Convert black pixels with red in a binary image using python opencv

I have a binary image in black and white, I created using opencv I would like to convert black pixels on this image to red, how can I achieve this?

def convertImageToBinary():
    print('converting image to black and white')
    originalImage = cv2.imread('lena.png')
    grayImage = cv2.cvtColor(originalImage, cv2.COLOR_BGR2GRAY)

    (thresh, blackAndWhiteImage) = cv2.threshold(grayImage, 127, 255, cv2.THRESH_BINARY)


    cv2.imshow('Black white image', blackAndWhiteImage)
    cv2.imshow('Original image',originalImage)
    cv2.imshow('Gray image', grayImage)

    cv2.waitKey(0)
    cv2.destroyAllWindows()


from Recent Questions - Stack Overflow https://ift.tt/3vpHDIv
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)