3. Find the color of the image
Combine the content of section 1 and section 2 to design a color-seekingProgramIt should not be a problem. A Bitmap can be viewed as a matrix composed of pixels. Top is equivalent to Y, left is equivalent to X, and top is used to access the pixels on the bitmap like an Access Matrix Element. The search process is the traversal of the counterpoint image element. RelatedCodeIt is available in the bitmapdata. Pas file and will not be repeated here. In the bitmapdata. Pas file, the search process is mainly one-to-one comparison, which is a slow match.Algorithm. For some string matching algorithms, you can skip some characters when the matching fails during the search process to speed up the search. Similar algorithms are also available in matrix lookup, but I have not found a good algorithm. Therefore, one-to-one comparison is used in implementation. This means that the search speed may be improved, although the current search speed is acceptable.
Another problem is that you can find a bitmap on the screen or in a large image. This bitmap can be called a subgraph. The Color comparison algorithm allows a certain color deviation in the subgraph, which does not affect the search result. However, this comparison algorithm does not allow distortion or rotation of subgraphs, as long as the subgraphs are slightly distorted or rotated, they cannot be found. Complex graphic image analysis algorithms are required to allow distortion or rotation of subgraphs. Because the graphic image analysis algorithm is too complex and I have not studied it too deeply, I only implement simple subgraph search in bitmapdata. Pas.