Java Image Search Algorithm
Previously, I wrote some game AIDS using the press-key genie. There is a function called FindPic in it. I will search for a given image on the screen and return the coordinates found. Now, Java Implements similar functions of this function. Algorithm Description: screen. Figure A is displayed. (the target image is figure B.) The pixels in Figure A are traversed. Based on the size of Figure B, the four angles in Figure B are mapped to the four vertices in Figure A. The obtained four vertices are compared with the values of the four angle pixels in Figure B. If four vertices are the same, perform Step 4. Otherwise, go back to step 2 and continue. For further comparison, compare all vertices in the ing range with all vertices in Figure B. If all the values are the same, the image is found. Otherwise, go back to step 2. Here, the comparison between pixels is compared by obtaining the RGB value of each pixel through the BufferedImage object. Convert BufferedImage to an int two-dimensional array as follows: copy code 1/*** obtain the image RGB Array Based on BufferedImage 3 * @ param bfImage 4 * @ return 5 */6 public static int [] [] getImageGRB (BufferedImage bfImage) {7 int width = bfImage. getWidth (); 8 int height = bfImage. getHeight (); 9 int [] [] result = new int [height] [width]; 10 for (int h = 0; h