My code get many small images with digits in them. I try to compare it with my templates and get right data. It worked..
original= cv2.imread('im/10.png')
sought = (254,254,254)
result = np.count_nonzero(np.all(original==sought,axis=2))
As you can see in these cases, white digits are at different corners of pics, and no problem, results (quanity of white pixels) are equal and I got, that 18=18.
but now there are new pics,
.
First of all, digits here aren't (254,254,254). I think image is more dim maybe. or less quality and i try to use:
result = np.count_nonzero(np.all(original > 200,axis=2))
Unfortunately, it give me different data. Two pics with 13 inside aren't equal.
What i want:
Method of pointing out white digits from dark background, except thin white circle around. (at 13 pics) Circle isn't a problem, if I crop image at center and get rid of circle my results wouldn't change - 13 still != 13.
Maybe it possible with converting image to grayscale, maybe to HSV, maybe just to make it brighter or more contrast.
Pixels counting is good for me it is quetly fast and usually accurate.
I'll repeat: now my code see two pics with 13 like different (there are difference colors, or brightness or black/white ratio, I don't know) I want to get rid of this problem.