Answer the question
In order to leave comments, you need to log in
How to correctly recognize white (and its shades) in an image?
Hello.
It is required to recognize "blots" of white color (and its shades) on the image: highlight the areas of "blots" on the image and calculate the area of "blots" as a percentage of the total size of the image.
import cv2 as cv
import numpy as np
h_min = np.array((50, 50, 50), np.uint8)
h_max = np.array((255, 255, 255), np.uint8)
img = cv.imread(r'C:\\1.jpg')
hsv = cv.cvtColor( img, cv.COLOR_BGR2HSV )
thresh = cv.inRange( hsv, h_min, h_max )
contours, hierarchy = cv.findContours( thresh.copy(), cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
cv.drawContours( img, contours, -1, (255,0,0), 3, cv.LINE_AA, hierarchy, 1 )
cv.imshow('result', img)
cv.waitKey(234234)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question