Сообщений всего: 154
Дата рег-ции: Дек. 2017
|The function findimage has been improved.
More specifically, its expanded version for searching by incomplete coincidence.
One more parameter was added:
findimage (1, # Image_0  , 0, # PosX_0 , # PosY_0 , 0, 0, 1366, 768, Red_less_, Red_Larger , Green_Message_, Green_Larger_, Blue_Message_Color, Blue_Larger_Color, [color=brown] Match_Currency_type_to_identification , flag_No_Search_On_Field_Only Found , -1);
Each color consists of three primary colors - Red (R) , Green (G) , Blue (B) . (R, G, B). Each of these three colors is denoted by a number from 0 to 255. For example, the color (0, 0, 0) will be black, and (255, 255, 255) white. (255, 0, 0) red, and (255, 50, 70) red with an admixture of green and blue.
Red_small_na - here we specify the number HA which the red component may be less than what is in the search.
Red_bolshe__na - here we specify the number HA which the red component can be more than what is in the search.
Green_less_, Green_Larger_, Blue_Message, Blue_Bolsh_a similarly.
Match_Period_Sufficient_to_identification - the percentage of the total number of pixels involved in the search is sufficient to ensure that the image is considered matched. 100 - it is necessary that the whole image coincide. 20 - one fifth of the image is sufficient. Use to search for images that may be partially overlapped or part of the color of the pixels may go beyond the fluctuations described above.
flag_not_visit_in_field_here_found is found - if 1 is no longer searched in areas on the screen according to the size of the desired figure where the figure is already found.
When searching for images of an example of different brightness or having various minor discrepancies, one can use either a color dispersion or / and a percentage of pixel matching. The use of such errors can lead to finding more than one coincidence practically where there is only one pattern in the presence.
For example, as in the figure, two or more matches can be found (blue and red frames)
By setting the flag_not_object_in_object_here_found in 1, you can prevent the search from areas where you already found one match (the area overlapped with a blue and a red border at once).
Example of use:
Download this pawn drawing: http://kibor-bot.com/files/peshka.rar
To repack to drive C. The drawing must be in C:\peshka \ peshka.bmp
Copy the script to Kibor:
int Image_0  ;
int color, xe, ye;
getdisplay (color, xe, ye);
loadimage (# Image_0  , "C:\peshka \ peshka.bmp");
int PosX_0 ; int PosY_0 ;
int k = findimage (-1, # Image_0  , 0, # PosX_0 , # PosY_0 , 0, 0, xe, ye, 50, 50, 50, 50, 50, 50 , 90, 1, -1);
int n = 0;
j: if (n <k)
mousemove (PosX_0 [n] + imagewidth (# Image_0  ) / 2, PosY_0 [n] + imageheight (# Image_0  ) / 2);
And to test on this image. Here all pawns have a slight difference and a short function will not find them. In the test, try setting the penultimate parameter to 0. One pawn will have several images found:
The Visual Code Editor is Kibor. Creating bots without knowledge of programming.
Learning function for recognizing text.