When I play games with my female at home, I always lose, which makes my brother very angry. So I think of cheating. Hey hey, just do it. I am using the dumbest method, first, findwindow finds the location of the 'Everybody comes to find lates', and then captures the two images for comparison based on the calculated relative location.
At the beginning, we compared the RGB values directly, but the results were terrible. The reason for analysis is that R, G, and B may only have one or several differences. We cannot directly compare the entire RGB value, therefore, when R, G, and B are compared separately, as long as there is a value greater than the threshold (10 for the threshold value and the experience value), the pixels are different. In this way, the effect is still very poor.
I accidentally saw the digital image processing book I bought in the university era. I haven't looked over it for a long time. Now I can take a look at it and see if I can find some inspiration and quickly browse the directory, there are still gains. The comparison of templates is used to replace the comparison of a single pixel, and the effect is greatly improved. Considering the efficiency issue, we finally adopted the 5x5 matrix for comparison.
Algorithm Introduction: Compare the 5x5 area around each pixel. If the R, G, and B values of each pixel in the 5x5 area are greater than the threshold value (10 ), this pixel is considered to be different and then marked as a specific color (such as red). The following is the actual operation:
Download from here
.