In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
In order to solve this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Environment configuration
This article takes C# and VB.NET code as an example to introduce how to scan and read the text in a picture.
The program environment is as follows:
Visual Studio version requires no less than 2017
Image scanning tool: Spire.OCR for .NET
Image format: png (the image format here supports JPG, PNG, GIF, BMP, TIFF, etc.)
Scanned picture text: Chinese (English, Japanese, Korean, German, French, etc.)
.NET Framework 4.6.1
The following are the specific steps and methods of operation.
Operation steps
Step 1. Create a .NET Framework console application in Visual Studio.
Step 2. Right-click the program project properties to set the target platform to x64.
Because Spire.OCR for .NET only supports 64-bit operating system systems, you must perform this step.
Step 3. Install Spire.OCR for .NET in the VS program. (★ is recommended to install via Nuget)
In solution Explorer, right-click reference, and select manage NuGet packages.
In the open interface, click the Browse tab and enter [Spire.OCR] in the search box. Click "install"
Step 4. After the installation is complete, locate the packages folder generated by default under the installation path, and copy the 6 dll files under the folder path:
F:\ VS2017Project\ ScanImageAndReadCharacter_OCR\ packages\ Spire.OCR.1.8.0\ runtimes\ win-x64\ native
Copy to the running path of the VS program project:
F:\ VS2017Project\ ScanImageAndReadCharacter_OCR\ ScanImageAndReadCharacter_OCR\ bin\ Debug
Call the API interface to scan and read the text in the picture
After completing the above steps, execute the following program code to read the text on the picture:
C#using Spire.OCR;using System.IO;namespace ScanImageAndReadCharacter_OCR {class Program {static void Main (string [] args) {/ / create an instance of the OcrScanner class OcrScanner scanner = new OcrScanner (); / / call the OcrScanner.Scan (string fileName) method to scan the text scanner.Scan ("image.png") on the picture String text = scanner.Text.ToString (); / / the text obtained by saving the scan is .txt document File.WriteAllText ("output.txt", text); System.Diagnostics.Process.Start ("output.txt") } VB.NETImports Spire.OCRImports System.IONamespace ScanImageAndReadCharacter_OCR Class Program Private Shared Sub Main (args As String ()) 'create an instance of OcrScanner class Dim scanner As New OcrScanner ()' call the OcrScanner.Scan (string fileName) method to scan the text on the picture scanner.Scan ("image.png") Dim text As String = Scanner.Text.ToString () 'saves the text obtained by the scan as .txt document File.WriteAllText ("output.txt" Text) System.Diagnostics.Process.Start ("output.txt") End Sub End ClassEnd Namespace
Scan and read the picture:
Matters needing attention
1. Only 64-bit platforms and systems are supported
two。 .net Framework is only supported in 1.8.0 and later
This is the answer to the question about how C# .NET can scan and identify the text in the picture. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.