Identify the text of the specified window

Identify the text of the specified window 1. Simple requirements Read the text of a specified window through image and text recognition. Get the window handle, save the screenshot as bitmap, and call the image and text recognition library. The test result is that the recognition of Chinese is not particularly good. It should be noted that tessdata must be downloaded from the specified directory page. 2. Reference package a. Reference tesseract4.1 b. Emgu.CV component 3. Upload the code using System; using System.Drawing; using System.Drawing.Imaging; using System.Runtime.InteropServices; using Emgu.CV; using Emgu.CV.OCR; using Emgu.CV.Structure; using Tesseract; using System.Windows.Forms; using Pix = Tesseract.Pix; using PageSegMode = Tesseract.PageSegMode; public class Program { [DllImport(“user32.dll”, SetLastError = true)] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport(“user32.dll”)] public static extern IntPtr GetWindowDC(IntPtr hWnd); [DllImport(“user32.dll”)] public static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC); [DllImport(“gdi32.dll”)] public static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos); [DllImport(“user32.dll”, SetLastError = true)] public static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect); [DllImport(“user32.dll”)] public static extern bool SetForegroundWindow(IntPtr hWnd); [StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left; public int Top; public int Right; public int Bottom; } [DllImport(“user32.dll”, CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)] public static extern void…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: 34331943@QQ.com

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索