---restore content starts---
Basic operation of Color map
1. Find the basic operation of color-color command
Sit punctuation color: Gets the color of the specified coordinate point
Area search: Find a color in a given area
Blur Find color: Find a color in the specified area, you can set the similarity degree
Multi-point color: To determine whether a specified color is found by a multi-point colour value, typically used for feature lookups
Name of function: |
Findcolorex |
Color-Finding ex |
Function Description: |
Screen Search Color |
Function Prototypes: |
Findcolorex (X1,y1,x2,y2,color,sim,scantype) |
Color-Finding EX (x1,y1,x2,y2, color value, similarity, direction) |
Function parameters: |
X1: Top left corner coordinate X Y1: Upper left corner coordinate y X2: Lower-right corner coordinate X Y2: lower right corner coordinate y Color: The colors to look for are formatted as "rrggbb-drdgdb| rrggbb-drdgdb| ... ", color is arranged in RGB format." SIM: Similarity , value range 0.1-1.0 ScanType: Scan mode, 0: From top left to bottom right 1: From center to four Week 2: from bottom right to top left |
return value: |
Returns all the color point coordinate formats found in the color parameter as follows : "Id,x,y|id,x,y..| Id,x,y " , the return character length does not exceed 1024 bytes |
Script Example: |
English Example: Copy Code
- var Ret=findcolorex (0,0,2000,2000, "b8dd53-000000", 1.0,0)
- MessageBox (Ret)
Chinese Example:Copy Code
- Variable ret= color-finding ex (0,0,2000,2000, "b8dd53-000000", 1.0,0)
- message box (ret)
|
2. Basic operation of the diagram command
The diagram command is to find this figure in a given area, the picture is expected to be made, or it can be the original image, or it can be a processed figure
Find a diagram command
Fincpic (X1,y1,x2,y2,path,delta_color,sim,scantype,rx,ry)
Find Image (X1,y1,x2,y2, image path, color, similarity, direction, return x coordinate, return y coordinate)
Note: The image needs to be in BMP format.
The smaller the area, the faster the search
Use the picture path to use the resource path as much as possible
Find Diagram Command Support transparency
You can adjust the color deviation or change the similarity
Functional prototypes |
Find figure (X1,y1,x2,y2, path, color offset, similarity, scan mode, return x, return y) |
Function description |
The screen image returns the XY coordinates, as well as the picture index. |
picture Path, support multi-picture with | symbol separate, temporarily need to write absolute path
x1 |
Upper-Left coordinate x |
y1 |
Upper-left coordinate y |
x2 |
lower right coordinate x |
y2 |
lower right coordinate y |
picture path |
color offset |
color color deviation such as "203040" means RGB color offset is 20 30 40 (Here is 16 binary representation) |
similarity |
color Similarity (value range 0.5~1.0) |
scan mode |
scan mode, 0: From left to right, top to bottom 1: From left to right, bottom to top 2: Right to left, top to bottom 3: Right to left, bottom to top |
return x |
The x-coordinate returned |
returns y |
returned y-coordinate |
return value |
returns the ordinal of the found picture, starting at 0. If not found return-1 |
|
function examples |
Variable X=-1,y=-1 Variable ret= for figure (0,0,2000,2000, "/sdcard/123.bmp", "000000", 1,0,x,y) if (ret>=0) Mouse movement (x, Y) left mouse button click () End |
|
Instance interface:---recover content end---
Instance Code
Function button Point Find color _ Click () //Here Add the code you want to execute var color value var x=0 var y=0 color value = GetColor (544,69) if (color value ==# 89FCA0) MouseMove (544,69) else MessageBox ("not Found") endendfunction button Area Find color _ Click () //Add the code you want to execute here var x=-1,y=-1 var ret=findcolor (0,0,900,900, "89fca0", 1,0,x,y) if (ret>=0) MouseMove (x, y) End endfunction button Find Diagram _ Click () //Here Add the code you want to execute var x=-1,y=-1 var ret=findpic (0,0,2000,2000, "F :/co-curricular/Tutor Courseware/T language/Fifth lesson color Basic operation/Fifth lesson Figure Color Basic operation/Resource/1.bmp "," 203040 ", 1,0,x,y) if (ret>=0) MouseMove (x, y) Mouseleftclick () End endfunction button 0_ Click () //Here Add the code you want to execute var x=-1,y=-1 var ret=findpics ( 0,0,2000,2000, "f:/Course/Tutor Courseware/T language/Fifth lesson color Basic operation/Fifth lesson color Basic Operations/Resources/2.bmp", "203040", 1,0,x,y) MessageBox (x& "," & Y) endfunction button Exit _ Click () //Here Add the code you want to execute exit () end
The third T language Instance development chart color operation