CN116958990A - Price tag cutting method, price tag cutting device, electronic equipment and computer readable storage medium - Google Patents

Price tag cutting method, price tag cutting device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN116958990A
CN116958990A CN202310853243.9A CN202310853243A CN116958990A CN 116958990 A CN116958990 A CN 116958990A CN 202310853243 A CN202310853243 A CN 202310853243A CN 116958990 A CN116958990 A CN 116958990A
Authority
CN
China
Prior art keywords
corner
price tag
point
points
position sequence
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310853243.9A
Other languages
Chinese (zh)
Inventor
敖川
郑韬
梁睿
陈果
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Innovation Qizhi Chengdu Technology Co ltd
Original Assignee
Innovation Qizhi Chengdu Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Innovation Qizhi Chengdu Technology Co ltd filed Critical Innovation Qizhi Chengdu Technology Co ltd
Priority to CN202310853243.9A priority Critical patent/CN116958990A/en
Publication of CN116958990A publication Critical patent/CN116958990A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/15Cutting or merging image elements, e.g. region growing, watershed or clustering-based techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/62Text, e.g. of license plates, overlay texts or captions on TV images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/146Aligning or centring of the image pick-up or image-field
    • G06V30/147Determination of region of interest
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/18Extraction of features or characteristics of the image
    • G06V30/1801Detecting partial patterns, e.g. edges or contours, or configurations, e.g. loops, corners, strokes or intersections

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Character Input (AREA)

Abstract

The application provides a price tag cutting method, a price tag cutting device, electronic equipment and a computer readable storage medium, wherein the price tag cutting method comprises the following steps: acquiring a plurality of corner coordinates of a character area of the price tag through a preset algorithm; the preset algorithm comprises a price tag detection algorithm; adjusting the position sequence of the plurality of corner coordinates in the text region into a first position sequence; wherein the first position sequence representation comprises the angular point position of each angular point in the text region and the sequence of a plurality of angular points; judging whether the character area corresponds to the corner points of the identification area of the price tag identification model according to the coordinates of the plurality of corner points; if the character area does not correspond to the corner points of the identification area of the price tag identification model, the first position sequence is adjusted, and an adjusted position sequence is obtained; the character area of the adjusted position sequence corresponds to the corner point of the identification area of the price tag identification model; and recognizing and cutting the text areas of which the plurality of angular points are arranged according to the adjusted position sequence, so that the accuracy of the cut image is improved.

Description

Price tag cutting method, price tag cutting device, electronic equipment and computer readable storage medium
Technical Field
The application relates to the technical field of price tag identification, in particular to a price tag cutting method, a price tag cutting device, electronic equipment and a computer readable storage medium.
Background
In a channel display scenario, retail price management of goods is one of its main requirements, and is therefore critical to the accuracy of OCR of price tags.
At present, the optical character recognition algorithm of the price tag mainly adopts a rotary card shell algorithm, but the rotary card shell algorithm performs image cutting through a rotary rectangular frame, so that when the character area of the price tag is in a quadrilateral form, the rotary rectangular frame of the rotary card shell algorithm can cut a non-character area into the character area, and further the character recognition accuracy of a formed cut image in a subsequent character recognition stage is reduced.
Disclosure of Invention
The embodiment of the application aims to provide a price tag cutting method, a price tag cutting device, electronic equipment and a computer readable storage medium, which are used for solving the problem that the accuracy of character recognition is reduced when a rotating rectangular frame is used for image cutting by the current rotating card shell algorithm.
In a first aspect, the present application provides a method for cutting out price tags, the method comprising: acquiring a plurality of corner coordinates of a character area of the price tag through a preset algorithm; the preset algorithm comprises a price tag detection algorithm; adjusting the position sequence of the plurality of corner coordinates in the text region into a first position sequence; wherein the first position sequence representation comprises the angular point position of each angular point in the text region and the sequence of a plurality of angular points; judging whether the character area corresponds to the corner points of the identification area of the price tag identification model according to the coordinates of the plurality of corner points; if the character area does not correspond to the corner points of the identification area of the price tag identification model, the first position sequence is adjusted, and an adjusted position sequence is obtained; the character area of the adjusted position sequence corresponds to the corner point of the identification area of the price tag identification model; and identifying and cutting the text areas of which the plurality of corner points are arranged according to the adjusted position sequence.
According to the price tag cutting method, firstly, the position sequences of the plurality of corner points of the character area obtained by a price tag detection algorithm are adjusted to be the first position sequences, then whether the character area corresponds to the corner points of the identification area of the price tag identification model is judged according to the coordinates of the plurality of corner points, and under the condition that the character area does not correspond to the corner points of the identification area of the price tag identification model, the position sequences are adjusted to enable the character area formed by the corner points of the adjusted position sequences to correspond to the corner points of the identification area of the price tag identification model, so that cutting identification is conducted on the character area, therefore, the corner points of the character area and the identification area are judged correspondingly by using the four vertexes of the original quadrangle of the character area detected in the price tag detection stage, the cutting image cannot contain the character area, accuracy of the cutting image is improved, and accuracy of subsequent price tag character identification is improved.
In an optional implementation manner of the first aspect, determining, according to a plurality of corner coordinates, whether the text region corresponds to a corner of the identification region of the price tag identification model includes: determining the corner with the smallest ordinate among the plurality of corner as a target corner; calculating the included angle between the connecting line of the target corner point and the adjacent corner point and the abscissa axis; wherein, the adjacent corner points represent corner points adjacent to the target corner point in the first position sequence, and the abscissa axis represents the direction of the coordinate axis established in the horizontal direction by taking the upper left corner of the character area as the origin; and judging whether the character area corresponds to the corner point of the identification area of the price tag identification model according to the size of the included angle.
According to the method, whether the character region is wrongly rotated or not is determined by judging whether the included angle between the connecting line of the target corner point of the character region and the adjacent corner point and the abscissa axis exceeds the included angle threshold, so that the corresponding points of the identification region and the character region are changed in advance under the condition that the character region is wrongly rotated, the defect that the OCR identification is wrong due to the fact that the rotating card-shell algorithm is wrongly rotated in the image region caused by thin high characters is avoided, and the reliability of character identification of the follow-up price tag is improved.
In an optional implementation manner of the first aspect, determining whether the text area corresponds to a corner point of the identification area of the price tag identification model according to the size of the included angle includes: judging whether the included angle between the connecting line of the target corner and the adjacent corner and the corresponding abscissa axis direction in the corner coordinates is larger than a preset included angle threshold value or not; if the included angle between the connecting line of the target point and the adjacent point and the direction of the abscissa axis is larger than the preset included angle threshold, determining that the character area does not correspond to the corner point of the identification area of the price tag identification model.
In an alternative implementation of the first aspect, wherein the first sequence of positions is a sequence of clockwise positions; the adjacent corner points are adjacent points of the target corner points in the clockwise sequence direction.
In an alternative embodiment of the first aspect, the preset angle threshold is 45 °. According to the method, under the condition that the preset included angle threshold value is 45 degrees through multiple experimental statistics, if the included angle between the connecting line of the target corner point and the adjacent corner point and the corresponding abscissa axis direction in the corner point coordinates is larger than 45 degrees, it is determined that the character area does not correspond to the corner point of the identification area of the price tag identification model, and therefore accuracy of judging whether the character area corresponds to the corner point of the identification area of the price tag identification model is improved.
In an optional implementation manner of the first aspect, determining, as the target corner, a corner with the smallest ordinate among the plurality of corner points, includes: acquiring the corner point with the smallest ordinate among a plurality of corner point coordinates, wherein the corner point coordinates are coordinates of the corner point in a preset coordinate system, the preset coordinate system is established by taking the upper left corner of a character area as an origin, the horizontal direction as an abscissa axis and the vertical direction as an ordinate axis; if the number of the corner points with the minimum ordinate is 1, the corner point with the minimum ordinate is taken as a target corner point; and if the number of the corner points with the minimum ordinate is larger than 1, taking the corner point with the minimum abscissa of the corner points with the minimum ordinate as the target corner point. In the embodiment, when the number of the corner points with the minimum ordinate is greater than 1, the corner point with the minimum abscissa among the corner points with the minimum ordinate is taken as the target corner point, so that the problem that the target corner points cannot be determined due to the fact that the number of the corner points with the minimum ordinate is multiple is avoided, and the accuracy of determining the target corner points is improved.
In an optional implementation manner of the first aspect, the first position sequence is a clockwise sequence with the target corner as an upper left corner of the text region; adjusting the first sequence of positions, comprising: and adjusting each angular point to a position in a clockwise direction to obtain an adjusted position sequence.
In a second aspect, the application provides a price tag cutting device, which comprises an acquisition module, an adjustment module, a judgment module and an identification cutting module; the acquiring module is used for acquiring a plurality of corner coordinates of the text area of the price tag through a preset algorithm; the preset algorithm comprises a price tag detection algorithm; the adjusting module is used for adjusting the position sequences of the corner coordinates in the text region into a first position sequence; wherein the first position sequence representation comprises the angular point position of each angular point in the text region and the sequence of a plurality of angular points; the judging module is used for judging whether the character area corresponds to the corner of the identification area of the price tag identification model according to the coordinates of the plurality of corner points; the adjusting module is further used for adjusting the first position sequence after the judging module judges that the character area does not correspond to the corner points of the identification area of the price tag identification model, and obtaining an adjusted position sequence; the character area of the adjusted position sequence corresponds to the corner point of the identification area of the price tag identification model; and the recognition cutting module is used for recognizing and cutting the text areas of which the plurality of angular points are arranged according to the adjusted position sequence.
According to the price tag cutting device, the position sequences of the corner points of the character area obtained by the price tag detection algorithm are firstly adjusted to be the first position sequences, then whether the character area corresponds to the corner points of the identification area of the price tag identification model is judged according to the coordinates of the corner points, and under the condition that the character area does not correspond to the corner points of the identification area of the price tag identification model, the position sequences are adjusted to enable the character area formed by the corner points of the adjusted position sequences to correspond to the corner points of the identification area of the price tag identification model, so that cutting identification is conducted on the character area.
In an optional implementation manner of the second aspect, the determining module is specifically configured to determine, as the target corner, a corner with the smallest ordinate among the plurality of corner points; calculating the included angle between the connecting line of the target corner point and the adjacent corner point and the abscissa axis; wherein, the adjacent corner points represent corner points adjacent to the target corner point in the first position sequence, and the abscissa axis represents the direction of the coordinate axis established in the horizontal direction by taking the upper left corner of the character area as the origin; and judging whether the character area corresponds to the corner point of the identification area of the price tag identification model according to the size of the included angle.
In an optional implementation manner of the second aspect, the determining module is further specifically configured to determine whether an included angle between a line connecting the target corner and the neighboring corner and a corresponding abscissa axis direction in the corner coordinates is greater than a preset included angle threshold; if the included angle between the connecting line of the target point and the adjacent point and the direction of the abscissa axis is larger than the preset included angle threshold, determining that the character area does not correspond to the corner point of the identification area of the price tag identification model.
In an optional implementation manner of the second aspect, the determining module is further specifically configured to obtain a corner point with a minimum ordinate among a plurality of corner point coordinates, where the corner point coordinates are coordinates of the corner point in a preset coordinate system, the preset coordinate system is established with an upper left corner of the text region as an origin, a horizontal direction as an abscissa axis, and a vertical direction as an ordinate axis; if the number of the corner points with the minimum ordinate is 1, the corner point with the minimum ordinate is taken as a target corner point; and if the number of the corner points with the minimum ordinate is larger than 1, taking the corner point with the minimum abscissa of the corner points with the minimum ordinate as the target corner point.
In an optional implementation manner of the second aspect, the first position sequence is a clockwise sequence taking the target corner as an upper left corner of the text region, and the adjusting module is specifically configured to adjust each corner by one position in a clockwise direction, so as to obtain an adjusted position sequence.
In a third aspect, the present application provides an electronic device comprising a memory storing a computer program and a processor executing the computer program to perform the method of any of the alternative implementations of the first aspect.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method of any of the alternative implementations of the first aspect.
In a fifth aspect, the present application provides a computer program product which, when run on a computer, causes the computer to perform the method of any of the alternative implementations of the first aspect.
The foregoing description is only an overview of the present application, and is intended to be implemented in accordance with the teachings of the present application in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present application more readily apparent.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and should not be considered as limiting the scope, and other related drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a first flowchart of a price tag clipping method according to an embodiment of the present application;
FIG. 2 is an exemplary diagram of a text recognition area provided by an embodiment of the present application;
FIG. 3 is a second flowchart of a price tag clipping method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a price tag cutting device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Icon: 400-an acquisition module; 410 an adjustment module; 420-judging module; 430-identifying a clipping module; 5-an electronic device; 501-a processor; 502-memory; 503-communication bus.
Detailed Description
Embodiments of the technical scheme of the present application will be described in detail below with reference to the accompanying drawings. The following examples are only for more clearly illustrating the technical aspects of the present application, and thus are merely examples, and are not intended to limit the scope of the present application.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having" and any variations thereof in the description of the application and the claims and the description of the drawings above are intended to cover a non-exclusive inclusion.
In the description of embodiments of the present application, the technical terms "first," "second," and the like are used merely to distinguish between different objects and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated, a particular order or a primary or secondary relationship. In the description of the embodiments of the present application, the meaning of "plurality" is two or more unless explicitly defined otherwise.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
In the description of the embodiments of the present application, the term "and/or" is merely an association relationship describing an association object, and indicates that three relationships may exist, for example, a and/or B may indicate: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
In the description of the embodiments of the present application, the term "plurality" means two or more (including two), and similarly, "plural sets" means two or more (including two), and "plural sheets" means two or more (including two).
In the description of the embodiments of the present application, the orientation or positional relationship indicated by the technical terms "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc. are based on the orientation or positional relationship shown in the drawings, and are merely for convenience of description and simplification of the description, and do not indicate or imply that the apparatus or element referred to must have a specific orientation, be configured and operated in a specific orientation, and therefore should not be construed as limiting the embodiments of the present application.
In the description of the embodiments of the present application, unless explicitly specified and limited otherwise, the terms "mounted," "connected," "secured" and the like should be construed broadly and may be, for example, fixedly connected, detachably connected, or integrally formed; or may be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communicated with the inside of two elements or the interaction relationship of the two elements. The specific meaning of the above terms in the embodiments of the present application will be understood by those of ordinary skill in the art according to specific circumstances.
In the art, an optical character recognition (optical character recognition, OCR) renal sinus learning algorithm is generally divided into three stages, including a price tag detection stage, a price tag clipping stage and a price tag recognition stage, wherein the price tag detection stage mainly detects the position of a potential price tag character in an image, returns a quadrangle (four point coordinates) of the position of the price tag character, the price tag clipping algorithm clips a corresponding image area from the quadrangle image, and sends the clipped image area into the price tag recognition algorithm, so that an OCR character result of the price tag is obtained, and price information is obtained from the character result.
At present, the optical character recognition algorithm of the price tag mainly adopts a rotary card shell algorithm, but the rotary card shell algorithm performs image cutting through a rotary rectangular frame, so that when the character area of the price tag is in a quadrilateral form, the rotary rectangular frame of the rotary card shell algorithm can cut a non-character area into the character area, and further the character recognition accuracy of a formed cut image in a subsequent character recognition stage is reduced.
In view of this, the present application provides a price tag cutting method, apparatus, electronic device, and computer-readable storage medium, in which the cut image does not include a text region in the case of using four vertices of an original quadrangle of the text region detected in the price tag detection stage to position the text region; in addition, whether the text region is wrongly rotated or not is determined by judging whether the included angle between the connecting line of the target corner point of the text region and the adjacent corner point and the abscissa axis exceeds an included angle threshold value, so that the corresponding points of the identification region and the text region are changed in advance under the condition that the text region is wrongly rotated, the defect that the OCR identification error is caused by the wrong rotation of the image region due to thin high text in the rotary text jamming algorithm is avoided, and the reliability of the character identification of the follow-up price tag is improved.
Specifically, the present application provides a price tag cutting method, which can be applied to a computing device, including but not limited to a computer, a server, a chip, a processor, etc., as shown in fig. 1, and can be implemented by:
step S100: and obtaining a plurality of corner coordinates of the text area of the price tag through a preset algorithm.
Step S110: and adjusting the position sequence of the plurality of corner coordinates in the text region to be a first position sequence.
Step S120: and judging whether the character area corresponds to the corner points of the identification area of the price tag identification model according to the coordinates of the plurality of corner points, and if so, turning to step S130.
Step S130: and adjusting the first position sequence and obtaining the adjusted position sequence.
Step S140: and identifying and cutting the text areas of which the plurality of corner points are arranged according to the adjusted position sequence.
For step S100, the preset algorithm is a price tag detection algorithm, which can detect a price tag and a position where a price tag text is located in an image, form one or more text regions, and output a quadrangle (four corner coordinates of each quadrangle, such as four corner coordinates of each square region shown in fig. 2) corresponding to each text region, where, as a possible implementation manner, the present application can obtain a plurality of corner coordinates of the text region of the price tag through the price tag detection algorithm; as another possible implementation manner, the price tag detection algorithm is not in the scope of the present application, and the present application may receive a plurality of corner coordinates of a text area transmitted by other devices, where the plurality of corner coordinates of the text area are identified by the other devices through the price tag detection algorithm.
The method comprises the steps of firstly adjusting a position sequence of a plurality of corner coordinates in a text region to be a first position sequence, wherein four corner coordinates of a quadrangle identified by a price tag detection algorithm only have coordinate information and have no position information, so that the position of which corner of the quadrangle is distributed by the four corner coordinates is unknown, and on the basis, adjusting the position sequence of the plurality of corner coordinates in the text region to be the first position sequence, for example, the four points of the text region are [ (x) respectively 1 ,y 1 ),(x 2 ,y 2 ),(x 3 ,y 3 ),(x 4 ,y 4 )]The first position sequence is assumed to be clockwise, and the coordinate point sequence can be adjusted to be clockwise according to the scheme.
Specifically, in the case that the first position sequence is clockwise, the method can specifically calculate c= (x) by performing the first position sequence adjustment 2 -x 1 )*(y 3 -y 2 )-(y 2 -y 1 )*(x 3 -x 2 ) If C<0, the order of adjusting the corner points is [ (x) 1 ,y 1 ),(x 4 ,y 4 ),(x 3 ,y 3 ),(x 2 ,y 2 )]The method comprises the steps of carrying out a first treatment on the surface of the If C is more than or equal to 0, maintaining the corner sequence as [ (x) 1 ,y 1 ),(x 2 ,y 2 ),(x 3 ,y 3 ),(x 4 ,y4)]。
According to the scheme, under the condition that the angular point position sequence of the character area is adjusted to be the first position sequence, whether the character area with the angular point position sequence being the first position sequence corresponds to the angular point of the identification area of the price tag identification model is judged according to the plurality of angular point coordinates. The price tag recognition model has a certain recognition size and recognition area corner sequence, for example, the recognition size of the price tag recognition model is h, the recognition area corner sequence is [ (0, 0), (w, h), (0, h) ] and the four corners of the character area need to be in one-to-one correspondence with the four corners of the price tag recognition model to form four corresponding points.
As a possible implementation manner, as shown in fig. 3, the method may determine whether a text region with a corner position sequence being a first position sequence corresponds to a corner of a recognition region of a price tag recognition model, including:
step S300: and determining the corner with the smallest ordinate among the plurality of corner points as a target corner.
Step S310: and calculating the included angle between the connecting line of the target corner point and the adjacent corner point and the abscissa axis.
Step S320: and judging whether the character area corresponds to the corner point of the identification area of the price tag identification model according to the size of the included angle.
In the above embodiment, the method first determines, as the target corner, the corner with the smallest ordinate among the plurality of corners of the text region, where the method may set up a coordinate system with the upper left corner of the text region as the origin, the horizontal direction as the horizontal axis, and the numerical direction as the vertical axis, and on the contrary, the corner with the smallest ordinate is taken as the target corner. For example, assume the four corner coordinates [ (x) described above 1 ,y 1 ),(x 2 ,y 2 ),(x 3 ,y 3 ),(x 4 ,y 4 )]Middle y 1 Minimum, then the scheme will (x) 1 ,y 1 ) And determining the corner points as target corner points.
In addition, a plurality of corner points with minimum ordinate may appear in the four corner points, and in this case, if the number of corner points with minimum ordinate is determined to be 1, the corner point with minimum ordinate is taken as the target corner point; and if the number of the corner points with the minimum ordinate is determined to be more than 1, taking the corner point with the minimum abscissa of the corner points with the minimum ordinate as the target corner point. For example, assume the four corner coordinates [ (x) described above 1 ,y 1 ),(x 2 ,y 2 ),(x 3 ,y 3 ),(x 4 ,y 4 )]Middle y 1 And y 2 Equal, and y 1 And y 2 Minimum in the ordinate of the four corner coordinates, on the basis of which x is assumed 1 Less than x 2 Then the scheme will (x) 1 ,y 1 ) And determining the corner points as target corner points.
Under the condition that the target corner point in the four corner points is determined, the scheme calculates the included angle between the connecting line of the target corner point and the adjacent corner point and the abscissa axis, wherein the adjacent corner point represents the corner point adjacent to the target corner point in the first position sequence. For example, assuming that the target corner point is an upper left corner point, the neighboring corner point may be a lower corner point of the upper left corner point in the clockwise direction or an upper corner point of the upper left corner point in the clockwise direction.
Specifically, the present solution can calculate the angle a between the target corner and the adjacent corner according to the following formula:
wherein, the liquid crystal display device comprises a liquid crystal display device,and->Characterizing the abscissa and ordinate of the corner of the object, < >>And->And the abscissa and the ordinate of adjacent corner points representing the corner points of the target, and a represents the included angle.
According to the scheme, under the condition that the included angle a is obtained through calculation, whether the character area corresponds to the corner point of the identification area of the price tag identification model or not can be judged according to the included angle a. As a possible implementation manner, the scheme can determine whether the included angle a is greater than a preset included angle threshold, and if the included angle a is greater than the preset included angle threshold, determine that the text area does not correspond to the corner point of the identification area of the price tag identification model; if the included angle a is not larger than the preset included angle threshold, the character area is judged to correspond to the corner point of the identification area of the price tag identification model.
As a specific implementation mode, the preset included angle threshold value in the scheme can be 45 degrees, namelyOn the basis, the scheme can judge whether the included angle a is larger than +.>If the included angle a is greater than +.>Judging that the character area does not correspond to the corner points of the identification area of the price tag identification model; if the included angle a is not greater than +.>And judging that the text area corresponds to the corner point of the identification area of the price tag identification model.
It should be noted that, the preset included angle threshold value set in the schemeThe application is not limited to the case that the target corner point is the upper left corner, the adjacent corner point is the upper right corner, and the first position sequence is the included angle threshold value set in the clockwise direction, and the included angle threshold value may be changed when the target corner point or the adjacent corner point is changed.
According to the scheme, whether the character area corresponds to the corner points of the identification area of the price tag identification model or not can be judged, if the character area corresponds to the corner points of the identification area of the price tag identification model, the first position sequence adjusted by the scheme is correct, and for this reason, the position sequence of the four corner points is not adjusted any more, and the price tag identification model is directly adopted to cut and identify the character area with the four corner points arranged according to the first position sequence.
If the text region does not correspond to the corner point of the identification region of the price tag identification model, it is explained that the first position sequence adjusted by the scheme is incorrect, and in this case, the first position sequence is usually rotated by 90 ° by mistake for the rotation stuck algorithm, so that each corner point is adjusted by one position in the clockwise direction by the scheme, thereby obtaining an adjusted position sequence, for example, assuming that the first position sequence is in the clockwise direction [ (x) 1 ,y 1 ),(x 2 ,y 2 ),(x 3 ,y 3 ),(x 4 ,y 4 )],(x 1 ,y 1 ) Is the upper left corner point (x) 2 ,y 2 ) Is the upper right corner point, (x) 3 ,y 3 ) Is the lower right corner point, (x) 4 ,y 4 ) For the lower left corner, the target corner selected in the scheme is the upper left corner (x 1 ,y 1 ) By calculating the upper left corner (x 1 ,y 1 ) And upper right corner point (x) 2 ,y 2 ) The included angle a between the connecting line of the (E) and the x-axis is determined to be larger than a preset included angle threshold valueOn the basis of this, the scheme adjusts the first position sequence, specifically (x 4 ,y 4 ) As the upper left corner point, (x) 1 ,y 1 ) As the upper right corner point, (x) 2 ,y 2 ) As lower right corner point, (x) 3 ,y 3 ) As the lower left corner point, an adjusted position sequence is obtained, and under the condition of cutting identification, the price tag identification model is adopted to cut and identify the text areas of the four corner points arranged according to the adjusted position sequence.
Specifically, in the scheme, when a price tag recognition model is adopted for cutting recognition, corner points of the adjusted position sequence are respectively in one-to-one correspondence with four points [ (0, 0), (w, h), (0, h) ] to form four pairs of corresponding points, then a projection matrix is estimated according to an 8-point method, and a cut image is obtained after warp is carried out according to the obtained projection matrix.
According to the price tag cutting method, firstly, the position sequences of the plurality of corner points of the character area obtained by a price tag detection algorithm are adjusted to be first position sequences, then whether the character area corresponds to the corner points of the identification area of the price tag identification model or not is judged according to the coordinates of the plurality of corner points, and under the condition that the character area does not correspond to the corner points of the identification area of the price tag identification model, the position sequences are adjusted to enable the character area formed by the corner points of the adjusted position sequences to correspond to the corner points of the identification area of the price tag identification model, so that cutting identification is conducted on the character area, therefore, the four vertexes of the original quadrangle of the character area detected in the price tag detection stage are used for conducting corner point correspondence judgment on the character area and the identification area, the cutting image does not contain the character area, accuracy of the cutting image is improved, and accuracy of subsequent price tag character identification is improved; in addition, whether the text region is wrongly rotated or not is determined by judging whether the included angle between the connecting line of the target corner point of the text region and the adjacent corner point and the abscissa axis exceeds an included angle threshold value, so that the corresponding points of the identification region and the text region are changed in advance under the condition that the text region is wrongly rotated, the defect that the OCR identification error is caused by the wrong rotation of the image region due to thin high text in the rotary text jamming algorithm is avoided, and the reliability of the character identification of the follow-up price tag is improved.
Fig. 4 shows a schematic block diagram of a price tag cutting device according to the present application, and it should be understood that the device corresponds to the embodiment of the method executed in fig. 1-3, and is capable of executing the steps involved in the foregoing method, and specific functions of the device may be referred to in the foregoing description, and detailed descriptions thereof are omitted herein as appropriate to avoid redundancy. The device includes at least one software functional module that can be stored in memory in the form of software or firmware (firmware) or cured in an Operating System (OS) of the device. Specifically, the device comprises: an acquisition module 400, an adjustment module 410, a determination module 420, and an identification clipping module 430; the acquiring module 400 is configured to acquire a plurality of corner coordinates of a text region of a price tag through a preset algorithm; the preset algorithm comprises a price tag detection algorithm; an adjustment module 410, configured to adjust a position sequence of the plurality of corner coordinates in the text region to a first position sequence; wherein the first position sequence representation comprises the angular point position of each angular point in the text region and the sequence of a plurality of angular points; a determining module 420, configured to determine whether the text area corresponds to the corner of the identification area of the price tag identification model according to the plurality of corner coordinates; the adjusting module 410 is further configured to adjust the first position sequence after the determining module determines that the text region does not correspond to the corner point of the identification region of the price tag identification model, and obtain an adjusted position sequence; the character area of the adjusted position sequence corresponds to the corner point of the identification area of the price tag identification model; the recognition clipping module 430 is configured to recognize and clip text regions in which the plurality of corner points are arranged according to the adjusted position sequence.
According to the price tag cutting device, the position sequences of the corner points of the character area obtained by the price tag detection algorithm are firstly adjusted to be the first position sequences, then whether the character area corresponds to the corner points of the identification area of the price tag identification model is judged according to the coordinates of the corner points, and under the condition that the character area does not correspond to the corner points of the identification area of the price tag identification model, the position sequences are adjusted to enable the character area formed by the corner points of the adjusted position sequences to correspond to the corner points of the identification area of the price tag identification model, so that cutting identification is conducted on the character area.
In an optional implementation manner of this embodiment, the determining module 420 is specifically configured to determine, as the target corner, a corner with the smallest ordinate among the plurality of corner points; calculating the included angle between the connecting line of the target corner point and the adjacent corner point and the abscissa axis; wherein, the adjacent corner points represent corner points adjacent to the target corner point in the first position sequence, and the abscissa axis represents the direction of the coordinate axis established in the horizontal direction by taking the upper left corner of the character area as the origin; and judging whether the character area corresponds to the corner point of the identification area of the price tag identification model according to the size of the included angle.
In an optional implementation manner of this embodiment, the determining module 420 is further specifically configured to determine whether an included angle between a line connecting the target corner and the neighboring corner and a corresponding abscissa axis direction in the corner coordinates is greater than a preset included angle threshold; if the included angle between the connecting line of the target point and the adjacent point and the direction of the abscissa axis is larger than the preset included angle threshold, determining that the character area does not correspond to the corner point of the identification area of the price tag identification model.
In an optional implementation manner of this embodiment, the determining module 420 is further specifically configured to obtain a corner point with a smallest ordinate among a plurality of corner point coordinates, where the corner point coordinates are coordinates of the corner point in a preset coordinate system, the preset coordinate system is established with an upper left corner of the text region as an origin, a horizontal direction as an abscissa axis, and a vertical direction as an ordinate axis; if the number of the corner points with the minimum ordinate is 1, the corner point with the minimum ordinate is taken as a target corner point; and if the number of the corner points with the minimum ordinate is larger than 1, taking the corner point with the minimum abscissa of the corner points with the minimum ordinate as the target corner point.
In an optional implementation manner of this embodiment, the first position sequence is a clockwise sequence with the target corner as the upper left corner of the text region, and the adjusting module 410 is specifically configured to adjust each corner to a position in a clockwise direction, so as to obtain an adjusted position sequence.
According to some embodiments of the present application, as shown in fig. 5, the present application provides an electronic device 5, including: the processor 501 and the memory 502, the processor 501 and the memory 502 being interconnected and communicating with each other by a communication bus 503 and/or other form of connection mechanism (not shown), the memory 502 storing a computer program executable by the processor 501, the processor 501 executing the computer program when the computing device is running to perform the method performed by the external machine in any alternative implementation, such as step S100 and step S140: acquiring a plurality of corner coordinates of a character area of the price tag through a preset algorithm, adjusting a position sequence of the corner coordinates in the character area to be a first position sequence, judging whether the character area corresponds to the corner of the identification area of the price tag identification model according to the corner coordinates, if so, adjusting the first position sequence, acquiring an adjusted position sequence, and identifying and cutting the character area of which the corner is arranged according to the adjusted position sequence.
The present application provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs a method according to any of the preceding alternative implementations.
The storage medium may be implemented by any type of volatile or nonvolatile Memory device or combination thereof, such as static random access Memory (Static Random Access Memory, SRAM), electrically erasable Programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), erasable Programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), programmable Read-Only Memory (PROM), read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk.
The present application provides a computer program product which, when run on a computer, causes the computer to perform the method in any of the alternative implementations.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application, and are intended to be included within the scope of the appended claims and description. In particular, the technical features mentioned in the respective embodiments may be combined in any manner as long as there is no structural conflict. The present application is not limited to the specific embodiments disclosed herein, but encompasses all technical solutions falling within the scope of the claims.

Claims (10)

1. A method of price tag cutting, the method comprising:
acquiring a plurality of corner coordinates of a character area of the price tag through a preset algorithm; wherein the preset algorithm comprises a price tag detection algorithm;
adjusting the position sequences of the corner coordinates in the text region to be first position sequences; wherein the first position sequence representation comprises the angular point position of each angular point in the text region and the order of the plurality of angular points;
judging whether the character area corresponds to the corner of the identification area of the price tag identification model according to the plurality of corner coordinates;
if the character area does not correspond to the corner points of the identification area of the price tag identification model, the first position sequence is adjusted, and an adjusted position sequence is obtained; the character area of the adjusted position sequence corresponds to the corner point of the identification area of the price tag identification model;
and identifying and cutting the character areas of which the plurality of corner points are arranged according to the adjusted position sequence.
2. The method according to claim 1, wherein determining whether the text region corresponds to a corner point of the identification region of the price tag identification model according to the plurality of corner point coordinates comprises:
determining the corner with the smallest ordinate among the plurality of corner as a target corner;
calculating the included angle between the connecting line of the target angular point and the adjacent angular point and the abscissa axis; wherein the adjacent corner points represent corner points adjacent to the target corner point in the first position sequence, and the abscissa axis represents the direction of the coordinate axis established in the horizontal direction by taking the upper left corner of the text region as the origin;
and judging whether the character area corresponds to the corner point of the identification area of the price tag identification model according to the included angle.
3. The method according to claim 2, wherein determining whether the text region corresponds to a corner point of the identification region of the price tag identification model according to the included angle comprises:
judging whether the included angle between the connecting line of the target angular point and the adjacent angular point and the corresponding abscissa axis direction in the angular point coordinates is larger than a preset included angle threshold value or not;
if the included angle between the connecting line of the target point and the adjacent point and the direction of the abscissa axis is larger than the preset included angle threshold, determining that the character area does not correspond to the corner point of the identification area of the price tag identification model.
4. A method according to claim 3, wherein the first sequence of positions is a sequence of clockwise positions; the adjacent corner points are adjacent points of the target corner points in the clockwise sequence direction.
5. A method according to claim 3, wherein the predetermined angle threshold is 45 °.
6. The method according to claim 2, wherein determining the corner point with the smallest ordinate among the plurality of corner points as the target corner point comprises:
acquiring a corner point with the smallest ordinate among a plurality of corner point coordinates, wherein the corner point coordinates are coordinates of the corner point in a preset coordinate system, the preset coordinate system is established by taking the upper left corner of a character area as an original point, the horizontal direction as an abscissa axis and the vertical direction as an ordinate axis;
if the number of the corner points with the minimum ordinate is 1, taking the corner point with the minimum ordinate as a target corner point;
and if the number of the corner points with the minimum ordinate is larger than 1, taking the corner point with the minimum abscissa of the corner points with the minimum ordinate as the target corner point.
7. The method of claim 1, wherein the first sequence of positions is a clockwise sequence with the target corner as an upper left corner of the text region; the adjusting the first sequence of positions includes:
and adjusting each angular point to a position in a clockwise direction to obtain an adjusted position sequence.
8. The price tag cutting device is characterized by comprising an acquisition module, an adjustment module, a judgment module and an identification cutting module;
the acquiring module is used for acquiring a plurality of corner coordinates of the character area of the price tag through a preset algorithm; wherein the preset algorithm comprises a price tag detection algorithm;
the adjusting module is used for adjusting the position sequences of the corner coordinates in the text region into a first position sequence; wherein the first position sequence representation comprises the angular point position of each angular point in the text region and the order of the plurality of angular points;
the judging module is used for judging whether the character area corresponds to the corner point of the identification area of the price tag identification model according to the plurality of corner point coordinates;
the adjusting module is further configured to adjust the first position sequence after the judging module judges that the text area does not correspond to the corner point of the identification area of the price tag identification model, and obtain an adjusted position sequence; the character area of the adjusted position sequence corresponds to the corner point of the identification area of the price tag identification model;
the recognition and cutting module is used for recognizing and cutting the text areas of which the plurality of corner points are arranged according to the adjusted position sequence.
9. An electronic device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the method of any one of claims 1 to 7 when executing the computer program.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method of any of claims 1 to 7.
CN202310853243.9A 2023-07-12 2023-07-12 Price tag cutting method, price tag cutting device, electronic equipment and computer readable storage medium Pending CN116958990A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310853243.9A CN116958990A (en) 2023-07-12 2023-07-12 Price tag cutting method, price tag cutting device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310853243.9A CN116958990A (en) 2023-07-12 2023-07-12 Price tag cutting method, price tag cutting device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN116958990A true CN116958990A (en) 2023-10-27

Family

ID=88455907

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310853243.9A Pending CN116958990A (en) 2023-07-12 2023-07-12 Price tag cutting method, price tag cutting device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN116958990A (en)

Similar Documents

Publication Publication Date Title
EP3079101B1 (en) Image processing apparatus, image processing method and computer-readable storage medium
EP3836003B1 (en) Qr code positioning method and apparatus
CN110097068B (en) Similar vehicle identification method and device
KR102435365B1 (en) Certificate recognition method and apparatus, electronic device, computer readable storage medium
US20130256416A1 (en) Barcode recognion method and computer product thereof
US20170109427A1 (en) Information processing apparatus, information processing method, and storage medium
CN108734161B (en) Method, device and equipment for identifying prefix number area and storage medium
CN111340020B (en) Formula identification method, device, equipment and storage medium
CN112528776B (en) Text line correction method and device
CN111488753A (en) Two-dimensional code identification method and device, electronic equipment and readable storage medium
CN116168351B (en) Inspection method and device for power equipment
CN111222452A (en) Face matching method and device, electronic equipment and readable storage medium
CN112036362A (en) Image processing method, image processing device, computer equipment and readable storage medium
CN117670884A (en) Image labeling method, device, equipment and storage medium
CN111141208A (en) Parallel line detection method and device
CN116958990A (en) Price tag cutting method, price tag cutting device, electronic equipment and computer readable storage medium
JP2898562B2 (en) License plate determination method
CN111275693B (en) Counting method and counting device for objects in image and readable storage medium
CN113361413B (en) Mileage display area detection method, device, equipment and storage medium
JPH01271883A (en) Detecting system for center of fingerprint
CN112069849A (en) Identification and positioning method, device, equipment and storage medium based on multiple two-dimensional codes
EP4336444A1 (en) Corner detection method and apparatus
CN117197422B (en) Identification code positioning method, electronic equipment and storage medium
CN113538449A (en) Image correction method, device, server and storage medium
US9202097B2 (en) Information processing apparatus, information processing method, and computer program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination