Make the desert font and use Python to call the Desert Tools method to identify the text

Source: Internet
Author: User
Tags python script

1. Making Font

1. Capturing the desired picture

2. This captures the "Firefox home" four characters, then the color of the text

3. The color consists of three parts, i.e. R G B wherein the r is represented by 00-FF (16 binary) or 0-255 numerical value. The same GB is the same thing. In this case there is a problem of deviation, which requires a deviation to cover all the colors within the deviation.

4. After the deviation will find the font becomes clear, click to extract the lattice, and then define the text name, you can add to the font

2. Use Python to identify text with the font

1. Load Dm.dll

$regsvr the DLL file path

2. Writing a Python script to recognize text using the font

#CODING:GBKImportWIN32COM.CLIENTDM= Win32com.client.Dispatch ('Dm.dmsoft') dm.setdict (0,'C:\dm_soft.txt') dm.usedict (0)"""function Prototype: string Findstrex (X1,y1,x2,y2,string,color_format,sim) parameter definition: X1 Number: The upper-left x-coordinate of the region Y1 shaping number: The upper-left y-coordinate of the region X2 shaping number: The right bottom x-coordinate of the area y2 Number of shapes: the right bottom y-coordinate of the region string string: The string to be found, which can be a combination of strings, such as "Changan | luoyang | Dayan Pagoda", Middle with "|" To split a string Color_format string: A color format string that can contain a newline delimiter, with the syntax "," followed by a split string. You can view the following example. Note that both RGB and HSV formats are supported. SIM Double-precision floating-point number: Similarity, range of 0.1-1.0"""ret= DM. Findstrfaste (0, 0, getsystemmetrics (0), GetSystemMetrics (1),"Firefox homepage","000000-909090", 1.0) ret= Ret.split ("|")ifRet[0] = = U"-1" :    Print "Find the word"

3. In addition, you can use the desert to achieve mouse movement, click and so on.

Dm.moveto (x, y) DM. RightClick ()

Make the desert font and use Python to call the Desert Tools method to identify the text

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.