Search

CN-121982725-A - Text recognition method and related device

CN121982725ACN 121982725 ACN121982725 ACN 121982725ACN-121982725-A

Abstract

The application discloses a text recognition method and a related device, the method comprises the steps of obtaining a target image comprising a target object, obtaining a text region corresponding to a text to be recognized from the target image, determining an angle adjustment mode of the text region based on the position relation between the text region and the target object, and adjusting the text region by using the angle adjustment mode, wherein the angle adjustment mode is adjusted according to a first angle or a second angle, determining center coordinates matched with the text region based on coordinates of each text pixel point in the text region after adjustment, converting all the text pixel points into a polar coordinate system based on the center coordinates, and obtaining text information matched with the text to be recognized by using the text pixel points under the polar coordinate system. Through the mode, the text recognition method and device can improve the efficiency and accuracy of text recognition.

Inventors

  • CHEN YUANYUAN
  • Jin Zhiwu
  • CAO YING
  • FAN FEIFAN
  • CHEN HAO
  • XIONG JIANPING

Assignees

  • 浙江大华技术股份有限公司

Dates

Publication Date
20260505
Application Date
20251209

Claims (10)

  1. 1. A method of text recognition, comprising: acquiring a target image comprising a target object, and acquiring a text region corresponding to a text to be identified from the target image; Determining an angle adjusting mode of the text region based on the position relation between the text region and the target object, and adjusting the text region by using the angle adjusting mode, wherein the angle adjusting mode is adjusted according to a first angle or a second angle; determining center coordinates matched with the text region based on the coordinates of each text pixel point in the text region after adjustment; and converting all the text pixel points into a polar coordinate system based on the circle center coordinates, and acquiring text information matched with the text to be identified by using the text pixel points under the polar coordinate system.
  2. 2. The text recognition method according to claim 1, wherein the determining an angle adjustment manner of the text region based on the positional relationship between the text region and the target object, the adjusting the text region using the angle adjustment manner, comprises: Determining the central ordinate of a target area corresponding to the target object in the target image; Acquiring the average value of the ordinate of all the text pixel points in the text region, and determining the actual position relation of the text region relative to the target region based on the comparison relation between the average value of the ordinate and the central ordinate; in response to the fact that the actual position relation is inconsistent with a preset reference position relation, rotating the target image by the first angle by taking the center point of the target image as the center; And rotating the target image by the second angle with the center point of the target image as the center in response to the actual position relationship being consistent with the reference position relationship.
  3. 3. The text recognition method according to claim 1, wherein the determining center coordinates matched with the text region based on the coordinates of each text pixel point in the text region after adjustment includes: Determining the text area corresponding to the text to be recognized based on the number of all text pixels in the text area after adjustment, and Acquiring first sum values of corresponding abscissas of all the adjusted text pixel points and second sum values of corresponding ordinates of all the adjusted text pixel points; and taking the first ratio of the first sum value to the text area as a circle center abscissa and the second ratio of the second sum value to the text area as a circle center ordinate, wherein the circle center abscissa and the circle center ordinate form a circle center coordinate of a circle center point matched with the text area.
  4. 4. The text recognition method according to claim 3, wherein the converting all the text pixels into a polar coordinate system based on the center coordinates, and obtaining the text information of the text matching to be recognized by using the text pixels in the polar coordinate system includes: determining a coordinate conversion interval based on the coordinates of each text pixel point after adjustment and the circle center coordinates; Converting text pixels located in the coordinate conversion section into a polar coordinate system, and identifying texts formed by all text pixels in the polar coordinate system to obtain the text information.
  5. 5. The text recognition method according to claim 4, wherein the determining a coordinate conversion section based on the coordinates of each of the text pixels and the center coordinates after the adjustment includes: acquiring a reference distance between each text pixel point and the center coordinates based on the coordinates of each text pixel point and the center coordinates after adjustment; Obtaining a distance maximum value and a distance minimum value from the reference distances corresponding to all the text pixel points; and determining the coordinate conversion section based on the distance maximum value and the distance minimum value.
  6. 6. The text recognition method according to claim 1, wherein before determining the center coordinates matched with the text region based on the coordinates of each text pixel point in the text region after adjustment, further comprising: acquiring a pixel point sequence formed by all the text pixel points in the text region; acquiring a pixel point curvature value corresponding to the current text pixel point based on coordinates corresponding to the current text pixel point and adjacent text pixel points in the pixel point sequence; Determining that the text to be identified is annular text in response to the sum of squares of the curvature values of the pixel points corresponding to all the text pixel points being greater than a preset threshold value, jumping to the coordinates of each text pixel point in the text region after adjustment, and determining circle center coordinates matched with the text region; And judging the text to be identified as a transverse text according to the sum of squares of curvature values of the pixel points corresponding to all the text pixel points being smaller than or equal to a preset threshold value, and acquiring text information matched with the text to be identified based on the adjusted text area.
  7. 7. The text recognition method according to claim 6, wherein the acquiring text information of the text to be recognized matching based on the adjusted text region includes: fitting the text region to a quadrilateral region; carrying out affine transformation on the quadrilateral region to obtain a transformed rectangular region, and acquiring text information matched with the text to be identified based on text pixel points in the rectangular region.
  8. 8. The text recognition method according to any one of claims 1 to 7, wherein the target object includes a target steel coil, the text to be recognized includes at least one of material information, production lot information, and specification size information, the first angle is 180 °, and the second angle is 0 °.
  9. 9. An electronic device comprising a memory and a processor coupled to each other, the memory having program instructions stored therein, the processor for executing the program instructions to implement the method of any of claims 1-8.
  10. 10. A computer readable storage medium having stored thereon program instructions, which when executed by a processor, implement the method of any of claims 1-8.

Description

Text recognition method and related device Technical Field The present application relates to the field of text recognition technology, and in particular, to a text recognition method and related device. Background In the field of image analysis, text recognition technology faces morphological challenges for a long time, wherein characters corresponding to annular text are not in the same plane or level, so that nonlinear changes of dimensions, shapes and intervals of the characters are caused, traditional Optical Character Recognition (OCR) technology based on plane assumption cannot be directly applied, and character segmentation and feature extraction become extremely difficult. In view of this, how to provide a text recognition method with higher efficiency and accuracy for a complex scene of a ring text is a problem to be solved. Disclosure of Invention The application mainly solves the technical problem of providing a text recognition method and a related device, which can improve the efficiency and accuracy of text recognition. The technical scheme includes that a target image comprising a target object is obtained, a text region corresponding to a text to be recognized is obtained from the target image, an angle adjusting mode of the text region is determined based on the position relation between the text region and the target object, the text region is adjusted by the angle adjusting mode, the angle adjusting mode is adjusted according to a first angle or a second angle, the center coordinates matched with the text region are determined based on the coordinates of each text pixel point in the text region after adjustment, all the text pixel points are converted into a polar coordinate system based on the center coordinates, and text information matched with the text to be recognized is obtained by using the text pixel points in the polar coordinate system. In order to solve the technical problem, another technical scheme adopted by the application is to provide electronic equipment which comprises a memory and a processor, wherein the memory and the processor are mutually coupled, the memory stores program instructions, and the processor is used for executing the program instructions to realize the method in the technical scheme. In order to solve the technical problem, a further technical scheme adopted by the application is to provide a computer readable storage medium, wherein program instructions are stored on the computer readable storage medium, and the program instructions realize the method in the technical scheme when being executed by a processor. The text recognition method has the advantages that the text recognition method is different from the situation in the prior art, after the text region is determined from the target image comprising the target object, the text region is adjusted in a fixed angle according to the position relation of the text region relative to the target object, so that the text region is recognized according to the correct text typesetting sequence in the subsequent text recognition process, and the angle adjustment efficiency of the text region is improved. And determining the center coordinates matched with the complete text region according to the coordinates of each text pixel point in the text region after angle adjustment, so as to improve the fit degree of the center coordinates and the text region, and being beneficial to improving the accuracy of text recognition after converting the text region according to the center coordinates. Drawings In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. Wherein: FIG. 1 is a flow chart of an embodiment of a text recognition method of the present application; Fig. 2 is a flowchart of step S102 in fig. 1 according to another embodiment; fig. 3 is a flowchart of step S103 in fig. 1 according to another embodiment; fig. 4 is a flowchart of step S104 in fig. 1 according to another embodiment; fig. 5 is a schematic flow chart corresponding to another embodiment before step S103 in fig. 1; FIG. 6 is a schematic diagram of an embodiment of a target image; FIG. 7 is a schematic diagram of an embodiment of an electronic device of the present application; fig. 8 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application. Detailed Description The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are o