CN114548136A - Method, device, equipment and medium for analyzing light-reflecting two-dimensional code picture - Google Patents

Method, device, equipment and medium for analyzing light-reflecting two-dimensional code picture Download PDF

Info

Publication number
CN114548136A
CN114548136A CN202111368352.9A CN202111368352A CN114548136A CN 114548136 A CN114548136 A CN 114548136A CN 202111368352 A CN202111368352 A CN 202111368352A CN 114548136 A CN114548136 A CN 114548136A
Authority
CN
China
Prior art keywords
straight line
pattern
point
dimensional code
vertical
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
CN202111368352.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.)
Fujian Star Net Tianhe Intelligent Technology Co ltd
Original Assignee
Fujian Star Net Tianhe Intelligent 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 Fujian Star Net Tianhe Intelligent Technology Co ltd filed Critical Fujian Star Net Tianhe Intelligent Technology Co ltd
Priority to CN202111368352.9A priority Critical patent/CN114548136A/en
Publication of CN114548136A publication Critical patent/CN114548136A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1443Methods for optical code recognition including a method step for retrieval of the optical code locating of the code in an image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1452Methods for optical code recognition including a method step for retrieval of the optical code detecting bar code edges
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/146Methods for optical code recognition the method including quality enhancement steps

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Electromagnetism (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Length Measuring Devices By Optical Means (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a method, a device, equipment and a medium for analyzing a light-reflecting two-dimensional code picture, wherein the method comprises the following steps: s1, carrying out binarization processing on the two-dimensional code image to obtain a binary image, and carrying out edge detection on the binary image to obtain an edge image; s2, performing two-dimensional code Pattern detection on the binary image to obtain Pattern candidate point coordinates which may be a Pattern, and calculating according to morphological characteristics of the binary image to obtain Pattern center coordinates; the edge graph is subjected to inverse perspective transformation, and a linear perspective change trend is determined; s3, matching the coordinates of the Pattern alternative points and the linear perspective transformation trend in the binary image to obtain the positions of three Pattern point pairs; and S4, positioning the position of the fourth point pair according to the positions of the three matched Pattern point pairs and the linear perspective transformation trend. The invention can still ensure the successful analysis of the two-dimension code under the interference of a strong illumination environment by utilizing the global information of the two-dimension code edge map.

Description

Method, device, equipment and medium for analyzing light-reflecting two-dimensional code picture
Technical Field
The invention relates to the technical field of computers, in particular to a method, a device, equipment and a medium for analyzing a light-reflecting two-dimensional code picture.
Background
The current general flow of the two-dimensional code analysis technology is as follows: firstly, two-dimensional code target detection is carried out on an input picture to obtain a two-dimensional code ROI (region of interest), and then a binarization algorithm is carried out on the ROI to obtain a binarization image. And executing a Pattern detection algorithm on the two-dimensional code binary image to obtain the Pattern position of the two-dimensional code Pattern. And estimating the original size of the two-dimensional code according to the size and the relative position of the Pattern of the two-dimensional code. And then carrying out visual angle correction and matrix conversion on the two-dimensional code image to obtain the BitMatrix.
However, in outdoor strong lighting scenes, the two-dimensional code image collected by the camera usually has stronger reflection. In the flow of the two-dimensional code analysis algorithm, strong reflection often causes serious interference to the two-dimensional code visual angle correction algorithm, so that the two-dimensional code cannot be analyzed under outdoor strong illumination.
In the current mainstream two-dimensional code identification and analysis algorithm, view correction is usually based on a mode of solving a homography matrix by corresponding points.
Mainstream method 1: three of four point pairs required for solving the homography matrix are obtained through a Pattern detection algorithm, and a fourth point required for calculating the homography matrix is obtained through estimation and multiple attempts. The use effect is poor under the scenes of strong light reflection and large perspective angle, the resolution success rate is about 12%, and the performance is not ideal. One important reason why the mainstream algorithm is ineffective for the strongly-reflecting two-dimensional code is that the global information of the image and the change of the perspective projection on the two-dimensional image are not considered when the fourth corresponding point pair is estimated.
Mainstream method 2: and solving the homography matrix by taking four corner points of the outer contour of the two-dimensional code as corresponding point pairs. The method does not consider environmental interference (such as light reflection) and a disordered background which possibly exist in the image, and is poor in robustness.
Therefore, it is significant if successful analysis of the two-dimensional code can be ensured even under interference of a strong light environment during analysis.
Disclosure of Invention
The invention aims to solve the technical problem of providing a method, a device, equipment and a medium for analyzing a reflecting two-dimensional code picture, which can still ensure the successful analysis of a two-dimensional code under the interference of a strong illumination environment.
In a first aspect, the present invention provides a method for analyzing a light-reflecting two-dimensional code picture, including the following steps:
s1, carrying out binarization processing on the two-dimensional code image to obtain a binary image, and carrying out edge detection on the binary image to obtain an edge image;
s2, performing two-dimensional code Pattern detection on the binary image to obtain Pattern candidate point coordinates which may be a Pattern, and calculating according to morphological characteristics of the binary image to obtain Pattern center coordinates;
the edge graph is subjected to inverse perspective transformation, and a linear perspective change trend is determined;
s3, matching the coordinates of the Pattern alternate points and the linear perspective transformation trend in the binary image to obtain the positions of three Pattern point pairs;
and S4, positioning the position of the fourth point pair according to the positions of the three matched Pattern point pairs and the linear perspective transformation trend.
In a second aspect, the present invention provides an apparatus for analyzing a reflective two-dimensional code picture, which is characterized in that: the method comprises the following steps:
the preprocessing module is used for carrying out binarization processing on the two-dimensional code image to obtain a binary image and carrying out edge detection on the binary image to obtain an edge image;
the morphological characteristic processing module is used for carrying out two-dimensional code Pattern detection on the binary image to obtain Pattern alternate point coordinates which may be a Pattern, and calculating according to morphological characteristics of the binary image to obtain Pattern center coordinates;
the inverse perspective transformation module is used for performing inverse perspective transformation on the edge map and determining a linear perspective change trend;
the Pattern point pair matching module is used for matching three Pattern point pairs in the binary image according to the Pattern candidate point coordinates and the linear perspective transformation trend to obtain positions of the three Pattern point pairs;
and the fourth point pair positioning module is used for positioning the position of the fourth point pair according to the positions of the three matched Pattern point pairs and the linear perspective transformation trend.
In a third aspect, the present invention provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of the first aspect when executing the program.
In a fourth aspect, the invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method of the first aspect.
One or more technical solutions provided in the embodiments of the present invention have at least the following technical effects or advantages: according to the method, the two-dimensional code is binarized to obtain the binary image, and the two-dimensional code Pattern point pairs are obtained on the binary image in a matching manner based on the perspective projection theorem according to the priori knowledge of vanishing points, so that the Pattern positioning accuracy is improved; and then, performing edge detection on the binary image to obtain an edge image, namely, positioning a fourth point pair position according to the positions of the three Pattern point pairs obtained by matching and the linear perspective transformation trend by using the global information of the edge image, so as to analyze the whole two-dimensional code image. The change trend of the perspective straight line angle is estimated based on the image global information, the whole two-dimensional code image can be analyzed as long as the local reflection does not influence the matching of three Pattern point pairs, and compared with other existing analysis algorithms, the anti-interference capability of the local reflection of the two-dimensional code is greatly improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
The invention will be further described with reference to the following examples with reference to the accompanying drawings.
FIG. 1 is a flow chart of a method according to one embodiment of the present invention;
fig. 2 is a schematic diagram illustrating a state of detecting a straight line in an edge graph by applying a hough straight line transformation algorithm according to an embodiment of the present invention, where (a) is detecting a horizontal straight line in the edge graph, and (b) is detecting a vertical straight line in the edge graph;
FIG. 3 is a diagram illustrating the definition of a polar coordinate summation plane, wherein (a) is a diagram illustrating a state of a certain point of an image represented on a linear coordinate system, and (b) is a diagram illustrating a passing point A (X) on the linear coordinate system0,Y0) Drawing state diagrams of straight lines 1, 2, 3 and 4, wherein (c) is the state diagram of the straight lines 1, 2, 3 and 4 when the polar coordinate system rho-theta is expressed as 1, 2, 3 and 4;
fig. 4 is a state diagram in which straight lines are mapped to a hough plane, wherein (a) and (b) are state diagrams in which a horizontal straight line group and a vertical straight line group are mapped to the hough plane, respectively;
FIG. 5 is a diagram illustrating a state of calculating the eigenvalues of each eigenvector from the linear parameters of all data points calculated by the horizontal linear accumulation plane;
FIG. 6 is a schematic diagram of the process of screening correct coordinate pairings by a straight line perspective trend;
fig. 7 is a schematic view of a state in which mutually parallel straight lines in a three-dimensional space on a two-dimensional code edge map intersect at a vanishing point on a two-dimensional plane after perspective projection;
FIG. 8 is a state diagram of the vanishing point and the center point of the lower left Pattern as the estimation lines;
fig. 9 is a schematic state diagram of two-dimensional codes obtained by performing estimation lines in the horizontal and vertical directions, obtaining a fourth positioning point, and analyzing the fourth positioning point;
FIG. 10 is a schematic structural diagram of an apparatus according to a second embodiment of the present invention;
fig. 11 is a schematic structural diagram of an electronic device according to a third embodiment of the invention;
FIG. 12 is a schematic structural diagram of a medium according to a fourth embodiment of the present invention.
Detailed Description
The embodiment of the application provides a method, a device, equipment and a medium for analyzing a reflected two-dimensional code picture, and the successful analysis of the two-dimensional code can still be guaranteed under the interference of a strong illumination environment.
The technical scheme in the embodiment of the application has the following general idea: firstly, binarizing the two-dimensional code to obtain a binary image, and matching on the binary image based on perspective projection theorem to obtain two-dimensional code Pattern point pairs according to the prior knowledge of vanishing points, so that the Pattern positioning accuracy is improved; and then, performing edge detection on the binary image to obtain an edge image, namely, positioning a fourth point pair position according to the positions of the three Pattern point pairs obtained by matching and the linear perspective transformation trend by using the global information of the edge image, so as to analyze the whole two-dimensional code image. The change trend of the perspective straight line angle is estimated based on the image global information, the whole two-dimensional code image can be analyzed as long as the local reflection does not influence the matching of three Pattern point pairs, and compared with other existing analysis algorithms, the anti-interference capability of the local reflection of the two-dimensional code is greatly improved.
Example one
As shown in fig. 1, the present embodiment provides a method for analyzing a light-reflecting two-dimensional code picture, including the following steps:
s1, carrying out binarization processing on the two-dimensional code image to obtain a binary image, and carrying out edge detection on the binary image to obtain an edge image; the method comprises the following steps:
intercepting a two-dimensional code image in a large image through an SSD (Single Shot Multi Box Detector) target detection model, calculating through a FastWindows algorithm to obtain a binary image, and detecting edges of the binary image through a Canny edge detection algorithm to obtain an edge image;
s2, performing two-dimensional code Pattern detection on the binary image to obtain Pattern candidate point coordinates which may be a Pattern, and calculating according to morphological characteristics of the binary image to obtain Pattern center coordinates;
the edge graph is subjected to inverse perspective transformation, and a linear perspective change trend is determined;
s3, matching the coordinates of the Pattern alternate points and the linear perspective transformation trend in the binary image to obtain the positions of three Pattern point pairs;
and S4, positioning the position of the fourth point pair according to the positions of the three matched Pattern point pairs and the linear perspective transformation trend.
As a more preferred or specific implementation manner of this embodiment, the method further has the following features:
in step S2, the specific step of performing the inverse perspective transformation on the edge map is:
s21, detecting straight lines in the edge graph by applying a Hough straight line transformation algorithm, wherein the straight lines comprise horizontal straight lines and vertical straight lines;
as shown in fig. 2 (a), a horizontal straight line in the edge map, and as shown in fig. 2 (b), a vertical straight line in the edge map.
S22, grouping the horizontal straight lines and the vertical straight lines to obtain horizontal straight line groups and vertical straight line groups; respectively mapping the horizontal straight line group and the vertical straight line group to a Hough plane, wherein each straight line is correspondingly represented as a data point; mapping the horizontal straight line group to the Hough plane refers to representing each straight line in the horizontal straight line group in an accumulation coordinate system by using a data point (rho, theta) to obtain a horizontal straight line accumulator plane; mapping the vertical straight line group to the Hough plane means that each straight line in the vertical straight line group is represented by a data point (rho, theta) in an accumulation coordinate system to obtain a vertical straight line accumulator plane;
the accumulated coordinate system is a pole coordinate system, the abscissa is rho, and the ordinate is theta;
the hough line transformation represents a straight line in a detected image in the form of a polar coordinate accumulation plane. As shown in fig. 3, which is the definition of the polar accumulation plane: as shown in fig. 3 (a), a certain point of the image is represented as a (X) on the rectilinear coordinate system0,Y0) As shown in FIG. 3 (b), a passing point A (X) on the linear coordinate system0,Y0) As shown in fig. 3 (c), the straight lines 1, 2, 3, and 4 are expressed as four points 1, 2, 3, and 4 in the polar coordinate system ρ — θ.
Mapping a straight line to a hough plane, as shown in fig. 4, means that the straight line is represented by one data point (ρ, θ) in an accumulated coordinate system, as shown in (a) and (b) of fig. 4, which are states where a horizontal straight line group and a vertical straight line group, respectively, are mapped to the hough plane, respectively.
S23, carrying out PCA principal component analysis on the data points in the two Hough planes, and calculating the principal vector direction of each data point to be used as a linear perspective change trend; the method comprises the following steps: calculating the characteristic value of each characteristic vector according to the linear parameters rho and theta of all data points (rho, theta) in the horizontal linear accumulator plane or the vertical linear accumulator plane, and taking the characteristic vector with the maximum characteristic value as a main characteristic vector and a linear angle change trend; then, a straight line general equation is used for expressing the main characteristic vector, and a theta parameter corresponding to the straight line is calculated according to a known straight line rho parameter.
As shown in fig. 5, taking the horizontal straight line accumulation plane as an example, the straight line parameters ρ and θ of all data points (ρ, θ) are calculated to calculate the eigenvalue (indicated by the arrow length) of each eigenvector (indicated by the arrow direction), and since the horizontal straight line is two-dimensional data, two eigenvectors (a left arrow and a downward arrow each indicate one eigenvector) can be calculated, the eigenvectors are sorted from large to small in eigenvalue, and the length of the left arrow is greater than that of the downward arrow, which indicates that the eigenvector at the left is the largest, and is retained and discarded as the trend of change of the straight line angle. And the main characteristic vector is expressed by using a straight line general equation, and the theta parameter corresponding to the straight line can be calculated according to the known straight line rho parameter.
The step S3 is specifically:
s31, randomly selecting three points from the Pattern alternative points to serve as a group of possible Pattern matching points;
s32, respectively making a horizontal direction straight line and a vertical direction straight line according to the first point of the perspective straight line angle transformation trend, and respectively calculating the distance from the second point and the third point to the direction straight line and the vertical direction straight line;
and S33, judging the size between the distance and a preset threshold value, if the distance is smaller than the preset threshold value, accepting the group of Pattern matching points, if the distance is larger than the preset threshold value, excluding the group of Pattern matching points, selecting the next group of possible Pattern matching points, and returning to S32 until receiving a certain group of Pattern matching points or exhausting all possible Pattern matching point combinations.
As shown in fig. 6, the process of screening for the correct coordinate pairing by a straight line perspective trend is illustrated:
as shown in fig. 6 (a), it is assumed that 5 candidate point coordinates A, B, C, D, E that may be Pattern are obtained after Pattern detection;
as shown in (b) of fig. 6, D, C, E is arbitrarily selected as a group of possible pattern matching points, a point D that has been passed through according to the perspective straight line angle transformation trend is respectively made into horizontal and vertical straight lines, then distances from the point E and the point C to the horizontal and vertical straight lines are respectively calculated, the distance and a preset threshold value are determined, and if the determined result is that the distance is greater than the preset threshold value, the group of pattern matching points D, C, E is excluded, and the next group of possible pattern matching points is selected;
as shown in (C) of fig. 6, A, B, C is arbitrarily selected as a possible Pattern pair, a horizontal straight line and a vertical straight line are respectively made according to the perspective straight line angle transformation trend passing point a, the distances from the point B and the point C to the horizontal straight line and the vertical straight line are respectively calculated, the distance and a preset threshold value are judged, and if the judgment result is that the distance is smaller than the threshold value, the Pattern pair A, B, C is accepted; as shown in fig. 6 (d), the A, B, C three-point positions are regarded as three Pattern point pair positions, and the process ends.
The step S4 is specifically:
s41, in the edge graph, making a horizontal estimation line at the vanishing point of the horizontal straight line group and the Pattern center of the lower left Pattern point pair, and making a vertical estimation line at the vanishing point of the vertical straight line group and the Pattern center of the upper right Pattern point pair to obtain an intersection point of the horizontal estimation line and the vertical estimation line, wherein the intersection point is used as the position of a fourth Pattern point pair required by transformation;
and S42, calculating a homography matrix according to the positions of the four Pattern point pairs, and executing inverse perspective transformation to obtain the analyzed two-dimensional code picture.
As shown in fig. 7, lines parallel to each other in a three-dimensional space on a two-dimensional code edge map (outline map) are subjected to perspective projection, and then meet at a point on a two-dimensional plane, which is called a vanishing point.
As shown in fig. 8, an estimation line is made between the over vanishing point and the center point of the lower left Pattern, and the straight line is parallel to the top edge and the bottom edge of the square outer contour of the two-dimensional code in the three-dimensional space according to the perspective projection theorem.
As shown in fig. 9, estimation lines in the horizontal and vertical directions are made, respectively, and the estimated line intersection is the fourth anchor point required for transformation. A homography matrix is calculated from the four corresponding point pairs, and an inverse perspective transformation is performed to obtain the right image in fig. 9, i.e. the two-dimensional code diagram obtained by analysis.
Based on the same inventive concept, the application also provides a device corresponding to the method in the first embodiment, which is detailed in the second embodiment.
Example two
As shown in fig. 10, in this embodiment, an apparatus for analyzing a light-reflecting two-dimensional code picture is provided, including:
the preprocessing module is used for carrying out binarization processing on the two-dimensional code picture to obtain a binary image and carrying out edge detection on the binary image to obtain an edge image;
the morphological characteristic processing module is used for carrying out two-dimensional code Pattern detection on the binary image to obtain Pattern alternate point coordinates which may be a Pattern, and calculating according to morphological characteristics of the binary image to obtain Pattern center coordinates;
the inverse perspective transformation module is used for performing inverse perspective transformation on the edge map and determining a linear perspective change trend;
the Pattern point pair matching module is used for matching three Pattern point pairs in the binary image according to the Pattern candidate point coordinates and the linear perspective transformation trend to obtain positions of the three Pattern point pairs;
and the fourth point pair positioning module is used for positioning the position of the fourth point pair according to the positions of the three matched Pattern point pairs and the linear perspective transformation trend.
As a more preferred or specific implementation manner of this embodiment, the apparatus further has the following features:
the specific process of the inverse perspective transformation module for performing the inverse perspective transformation on the edge map is as follows:
s21, detecting straight lines in the edge graph by applying a Hough straight line transformation algorithm, wherein the straight lines comprise horizontal straight lines and vertical straight lines;
s22, grouping the horizontal straight lines and the vertical straight lines to obtain horizontal straight line groups and vertical straight line groups; respectively mapping the horizontal straight line group and the vertical straight line group to a Hough plane, wherein each straight line is correspondingly represented as a data point; mapping the horizontal straight line group to the Hough plane refers to representing each straight line in the horizontal straight line group in an accumulation coordinate system by using a data point (rho, theta) to obtain a horizontal straight line accumulator plane; mapping the vertical straight line group to the Hough plane means that each straight line in the vertical straight line group is represented by a data point (rho, theta) in an accumulation coordinate system to obtain a vertical straight line accumulator plane; the accumulated coordinate system is a pole coordinate system, the abscissa is rho, and the ordinate is theta;
s23, carrying out PCA principal component analysis on the data points in the two Hough planes, and calculating the principal vector direction of each data point to be used as a linear perspective change trend; the method comprises the following steps: calculating the characteristic value of each characteristic vector according to the linear parameters rho and theta of all data points (rho, theta) in the horizontal linear accumulator plane or the vertical linear accumulator plane, and taking the characteristic vector with the maximum characteristic value as a main characteristic vector and a linear angle change trend; then, a straight line general equation is used for expressing the main characteristic vector, and a theta parameter corresponding to the straight line is calculated according to a known straight line rho parameter.
The Pattern point pair matching module specifically realizes the following processes:
s31, randomly selecting three points from the Pattern alternative points to serve as a group of possible Pattern matching points;
s32, respectively making a horizontal direction straight line and a vertical direction straight line according to the first point of the perspective straight line angle transformation trend, and respectively calculating the distance from the second point and the third point to the direction straight line and the vertical direction straight line;
and S33, judging the size between the distance and a preset threshold value, if the distance is smaller than the preset threshold value, accepting the group of Pattern matching points, if the distance is larger than the preset threshold value, excluding the group of Pattern matching points, selecting the next group of possible Pattern matching points, and returning to S32 until receiving a certain group of Pattern matching points or exhausting all possible Pattern matching point combinations.
The fourth point-to-point positioning module specifically implements the following process:
s41, in the edge graph, making a horizontal estimation line at the vanishing point of the horizontal straight line group and the Pattern center of the lower left Pattern point pair, and making a vertical estimation line at the vanishing point of the vertical straight line group and the Pattern center of the upper right Pattern point pair to obtain an intersection point of the horizontal estimation line and the vertical estimation line, wherein the intersection point is used as the position of a fourth Pattern point pair required by transformation;
and S42, calculating a homography matrix according to the positions of the four Pattern point pairs, and executing inverse perspective transformation to obtain the analyzed two-dimensional code picture.
Since the apparatus described in the second embodiment of the present invention is an apparatus used for implementing the method of the first embodiment of the present invention, based on the method described in the first embodiment of the present invention, a person skilled in the art can understand the specific structure and the deformation of the apparatus, and thus the details are not described herein. All the devices adopted in the method of the first embodiment of the present invention belong to the protection scope of the present invention.
Based on the same inventive concept, the application provides an electronic device embodiment corresponding to the first embodiment, which is detailed in the third embodiment.
EXAMPLE III
The present embodiment provides an electronic device, as shown in fig. 11, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, any implementation manner of the first embodiment may be implemented.
Since the electronic device described in this embodiment is a device used for implementing the method in the first embodiment of the present application, based on the method described in the first embodiment of the present application, a specific implementation of the electronic device in this embodiment and various variations thereof can be understood by those skilled in the art, and therefore, how to implement the method in the first embodiment of the present application by the electronic device is not described in detail herein. The equipment used by those skilled in the art to implement the methods in the embodiments of the present application is within the scope of the present application.
Based on the same inventive concept, the application provides a storage medium corresponding to the fourth embodiment, which is described in detail in the fourth embodiment.
Example four
The present embodiment provides a computer-readable storage medium, as shown in fig. 12, on which a computer program is stored, and when the computer program is executed by a processor, any one of the first embodiment can be implemented.
The technical scheme provided in the embodiment of the application at least has the following technical effects or advantages: firstly, binarizing the two-dimensional code to obtain a binary image, and matching on the binary image based on perspective projection theorem to obtain two-dimensional code Pattern point pairs according to the prior knowledge of vanishing points, so that the Pattern positioning accuracy is improved; and then, performing edge detection on the binary image to obtain an edge image, namely, positioning a fourth point pair position according to the positions of the three Pattern point pairs obtained by matching and the linear perspective transformation trend by using the global information of the edge image, so as to analyze the whole two-dimensional code image. The change trend of the perspective straight line angle is estimated based on the image global information, the whole two-dimensional code image can be analyzed as long as the local reflection does not influence the matching of three Pattern point pairs, and compared with other existing analysis algorithms, the anti-interference capability of the local reflection of the two-dimensional code is greatly improved.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus or system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Although specific embodiments of the invention have been described above, it will be understood by those skilled in the art that the specific embodiments described are illustrative only and are not limiting upon the scope of the invention, and that equivalent modifications and variations can be made by those skilled in the art without departing from the spirit of the invention, which is to be limited only by the appended claims.

Claims (10)

1. The method for analyzing the light-reflecting two-dimensional code picture is characterized by comprising the following steps of: the method comprises the following steps:
s1, carrying out binarization processing on the two-dimensional code image to obtain a binary image, and carrying out edge detection on the binary image to obtain an edge image;
s2, performing two-dimensional code Pattern detection on the binary image to obtain Pattern candidate point coordinates which may be a Pattern, and calculating according to morphological characteristics of the binary image to obtain Pattern center coordinates;
the edge graph is subjected to inverse perspective transformation, and a linear perspective change trend is determined;
s3, matching the coordinates of the Pattern alternate points and the linear perspective transformation trend in the binary image to obtain the positions of three Pattern point pairs;
and S4, positioning the position of the fourth point pair according to the positions of the three matched Pattern point pairs and the linear perspective transformation trend.
2. The method for analyzing the light-reflecting two-dimensional code picture according to claim 1, wherein the method comprises the following steps: in step S2, the specific step of performing the inverse perspective transformation on the edge map is:
s21, detecting straight lines in the edge graph by applying a Hough straight line transformation algorithm, wherein the straight lines comprise horizontal straight lines and vertical straight lines;
s22, grouping the horizontal straight lines and the vertical straight lines to obtain horizontal straight line groups and vertical straight line groups; respectively mapping the horizontal straight line group and the vertical straight line group to a Hough plane, wherein each straight line is correspondingly represented as a data point; mapping the horizontal straight line group to the Hough plane refers to representing each straight line in the horizontal straight line group in an accumulation coordinate system by using a data point (rho, theta) to obtain a horizontal straight line accumulator plane; mapping the vertical straight line group to the Hough plane means that each straight line in the vertical straight line group is represented by a data point (rho, theta) in an accumulation coordinate system to obtain a vertical straight line accumulator plane; the accumulated coordinate system is a pole coordinate system, the abscissa is rho, and the ordinate is theta;
s23, carrying out PCA principal component analysis on the data points in the two Hough planes, and calculating the principal vector direction of each data point to be used as a linear perspective change trend; the method comprises the following steps: calculating the characteristic value of each characteristic vector according to the linear parameters rho and theta of all data points (rho, theta) in the horizontal linear accumulator plane or the vertical linear accumulator plane, and taking the characteristic vector with the maximum characteristic value as a main characteristic vector and a linear angle change trend; then, a straight line general equation is used for expressing the main characteristic vector, and a theta parameter corresponding to the straight line is calculated according to a known straight line rho parameter.
3. The method for analyzing the light-reflecting two-dimensional code picture according to claim 2, wherein the method comprises the following steps: the step S3 is specifically:
s31, randomly selecting three points from the Pattern alternative points to serve as a group of possible Pattern matching points;
s32, respectively making a horizontal direction straight line and a vertical direction straight line according to the first point of the perspective straight line angle transformation trend, and respectively calculating the distance from the second point and the third point to the direction straight line and the vertical direction straight line;
and S33, judging the size between the distance and a preset threshold value, if the distance is smaller than the preset threshold value, accepting the group of Pattern matching points, if the distance is larger than the preset threshold value, excluding the group of Pattern matching points, selecting the next group of possible Pattern matching points, and returning to S32 until receiving a certain group of Pattern matching points or exhausting all possible Pattern matching point combinations.
4. The method for analyzing the light-reflecting two-dimensional code picture according to claim 1, wherein the method comprises the following steps: the step S4 is specifically:
s41, in the edge graph, making a horizontal estimation line at the vanishing point of the horizontal straight line group and the Pattern center of the lower left Pattern point pair, and making a vertical estimation line at the vanishing point of the vertical straight line group and the Pattern center of the upper right Pattern point pair to obtain an intersection point of the horizontal estimation line and the vertical estimation line, wherein the intersection point is used as the position of a fourth Pattern point pair required by transformation;
and S42, calculating a homography matrix according to the positions of the four Pattern point pairs, and executing inverse perspective transformation to obtain the analyzed two-dimensional code picture.
5. The utility model provides an analytical equipment of reflection of light two-dimensional code picture which characterized in that: the method comprises the following steps:
the preprocessing module is used for carrying out binarization processing on the two-dimensional code image to obtain a binary image and carrying out edge detection on the binary image to obtain an edge image;
the morphological characteristic processing module is used for carrying out two-dimensional code Pattern detection on the binary image to obtain Pattern alternate point coordinates which may be a Pattern, and calculating according to morphological characteristics of the binary image to obtain Pattern center coordinates;
the inverse perspective transformation module is used for performing inverse perspective transformation on the edge map and determining a linear perspective change trend;
the Pattern point pair matching module is used for matching three Pattern point pairs in the binary image according to the Pattern candidate point coordinates and the linear perspective transformation trend to obtain positions of the three Pattern point pairs;
and the fourth point pair positioning module is used for positioning the position of the fourth point pair according to the positions of the three matched Pattern point pairs and the linear perspective transformation trend.
6. The device for analyzing the light-reflecting two-dimensional code picture according to claim 5, wherein: the specific process of the inverse perspective transformation module for performing the inverse perspective transformation on the edge map is as follows:
s21, detecting straight lines in the edge graph by applying a Hough straight line transformation algorithm, wherein the straight lines comprise horizontal straight lines and vertical straight lines;
s22, grouping the horizontal straight lines and the vertical straight lines to obtain horizontal straight line groups and vertical straight line groups; respectively mapping the horizontal straight line group and the vertical straight line group to a Hough plane, wherein each straight line is correspondingly represented as a data point; mapping the horizontal straight line group to the Hough plane refers to representing each straight line in the horizontal straight line group in an accumulation coordinate system by using a data point (rho, theta) to obtain a horizontal straight line accumulator plane; mapping the vertical straight line group to the Hough plane means that each straight line in the vertical straight line group is represented by a data point (rho, theta) in an accumulation coordinate system to obtain a vertical straight line accumulator plane; the accumulated coordinate system is a pole coordinate system, the abscissa is rho, and the ordinate is theta;
s23, carrying out PCA principal component analysis on the data points in the two Hough planes, and calculating the principal vector direction of each data point to be used as a linear perspective change trend; the method comprises the following steps: calculating the characteristic value of each characteristic vector according to the linear parameters rho and theta of all data points (rho, theta) in the horizontal linear accumulator plane or the vertical linear accumulator plane, and taking the characteristic vector with the maximum characteristic value as a main characteristic vector and a linear angle change trend; then, a straight line general equation is used for expressing the main characteristic vector, and a theta parameter corresponding to the straight line is calculated according to a known straight line rho parameter.
7. The device for analyzing the light-reflecting two-dimensional code picture according to claim 5, wherein: the Pattern point pair matching module specifically realizes the following processes:
s31, randomly selecting three points from the Pattern alternative points to serve as a group of possible Pattern matching points;
s32, respectively making a horizontal direction straight line and a vertical direction straight line according to the first point of the perspective straight line angle transformation trend, and respectively calculating the distance from the second point and the third point to the direction straight line and the vertical direction straight line;
and S33, judging the size between the distance and a preset threshold value, if the distance is smaller than the preset threshold value, accepting the group of Pattern matching points, if the distance is larger than the preset threshold value, excluding the group of Pattern matching points, selecting the next group of possible Pattern matching points, and returning to S32 until receiving a certain group of Pattern matching points or exhausting all possible Pattern matching point combinations.
8. The device for analyzing the reflective two-dimensional code picture according to claim 5, wherein: the fourth point-to-point positioning module specifically implements the following process:
s41, in the edge graph, making a horizontal estimation line at the vanishing point of the horizontal straight line group and the Pattern center of the lower left Pattern point pair, and making a vertical estimation line at the vanishing point of the vertical straight line group and the Pattern center of the upper right Pattern point pair to obtain an intersection point of the horizontal estimation line and the vertical estimation line, wherein the intersection point is used as the position of a fourth Pattern point pair required by transformation;
and S42, calculating a homography matrix according to the positions of the four Pattern point pairs, and executing inverse perspective transformation to obtain the analyzed two-dimensional code picture.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 4 when executing the program.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 4.
CN202111368352.9A 2021-11-18 2021-11-18 Method, device, equipment and medium for analyzing light-reflecting two-dimensional code picture Pending CN114548136A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111368352.9A CN114548136A (en) 2021-11-18 2021-11-18 Method, device, equipment and medium for analyzing light-reflecting two-dimensional code picture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111368352.9A CN114548136A (en) 2021-11-18 2021-11-18 Method, device, equipment and medium for analyzing light-reflecting two-dimensional code picture

Publications (1)

Publication Number Publication Date
CN114548136A true CN114548136A (en) 2022-05-27

Family

ID=81668514

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111368352.9A Pending CN114548136A (en) 2021-11-18 2021-11-18 Method, device, equipment and medium for analyzing light-reflecting two-dimensional code picture

Country Status (1)

Country Link
CN (1) CN114548136A (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5616905A (en) * 1994-02-24 1997-04-01 Kabushiki Kaisha Tec Two-dimensional code recognition method
US6082619A (en) * 1998-12-16 2000-07-04 Matsushita Electric Industrial Co., Ltd. Method for locating and reading a two-dimensional barcode
US20040020989A1 (en) * 2002-07-18 2004-02-05 Takeharu Muramatsu Two-dimensional code reading apparatus, two-dimensional code reading process, two-dimensional code reading program and recording medium for said program, portable terminal and digital camera
CN101059834A (en) * 2007-05-31 2007-10-24 中国农业大学 QR two-dimensional bar code recognition method based on pickup head for chatting
US20120189190A1 (en) * 2011-01-24 2012-07-26 Purdue Research Foundation Automatic detection and grouping of straight lines in images for personalization
CN103914675A (en) * 2014-03-17 2014-07-09 东华大学 Garment QD code recognition method
CN106485183A (en) * 2016-07-14 2017-03-08 深圳市华汉伟业科技有限公司 A kind of Quick Response Code localization method and system
CN106485255A (en) * 2016-09-29 2017-03-08 深圳元启智能技术有限公司 A kind of DM code positioning and the method and system of identification
CN106991460A (en) * 2017-01-23 2017-07-28 中山大学 A kind of quick detection and localization algorithm of QR codes
CN107545207A (en) * 2017-09-28 2018-01-05 云南电网有限责任公司电力科学研究院 DM two-dimensional code identification methods and device based on image procossing
CN111539238A (en) * 2020-04-27 2020-08-14 广州致远电子有限公司 Two-dimensional code image restoration method and device, computer equipment and storage medium
CN112241642A (en) * 2019-07-19 2021-01-19 杭州海康威视数字技术股份有限公司 Two-dimensional code identification method, device, equipment and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5616905A (en) * 1994-02-24 1997-04-01 Kabushiki Kaisha Tec Two-dimensional code recognition method
US6082619A (en) * 1998-12-16 2000-07-04 Matsushita Electric Industrial Co., Ltd. Method for locating and reading a two-dimensional barcode
US20040020989A1 (en) * 2002-07-18 2004-02-05 Takeharu Muramatsu Two-dimensional code reading apparatus, two-dimensional code reading process, two-dimensional code reading program and recording medium for said program, portable terminal and digital camera
CN101059834A (en) * 2007-05-31 2007-10-24 中国农业大学 QR two-dimensional bar code recognition method based on pickup head for chatting
US20120189190A1 (en) * 2011-01-24 2012-07-26 Purdue Research Foundation Automatic detection and grouping of straight lines in images for personalization
CN103914675A (en) * 2014-03-17 2014-07-09 东华大学 Garment QD code recognition method
CN106485183A (en) * 2016-07-14 2017-03-08 深圳市华汉伟业科技有限公司 A kind of Quick Response Code localization method and system
CN106485255A (en) * 2016-09-29 2017-03-08 深圳元启智能技术有限公司 A kind of DM code positioning and the method and system of identification
CN106991460A (en) * 2017-01-23 2017-07-28 中山大学 A kind of quick detection and localization algorithm of QR codes
CN107545207A (en) * 2017-09-28 2018-01-05 云南电网有限责任公司电力科学研究院 DM two-dimensional code identification methods and device based on image procossing
CN112241642A (en) * 2019-07-19 2021-01-19 杭州海康威视数字技术股份有限公司 Two-dimensional code identification method, device, equipment and storage medium
CN111539238A (en) * 2020-04-27 2020-08-14 广州致远电子有限公司 Two-dimensional code image restoration method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
Romero-Ramirez et al. Speeded up detection of squared fiducial markers
US10049492B2 (en) Method and apparatus for rendering facades of objects of interest from three-dimensional point clouds
Moghadam et al. Fast vanishing-point detection in unstructured environments
Hulik et al. Continuous plane detection in point-cloud data based on 3D Hough Transform
US9286538B1 (en) Adaptive 3D to 2D projection for different height slices and extraction of robust morphological features for 3D object recognition
US9811733B2 (en) Method, apparatus and system for selecting a frame
Boyer et al. SHREC 2011: robust feature detection and description benchmark
KR101988384B1 (en) Image matching apparatus, image matching system and image matching mehod
WO2019169635A1 (en) Object recognition
US20180268237A1 (en) Method and system for determining at least one property related to at least part of a real environment
Li et al. Road lane detection with gabor filters
US8396285B2 (en) Estimating vanishing points in images
CN103414861A (en) Method for self-adaptation geometric correction of projector picture
Tombari et al. Evaluation of stereo algorithms for 3d object recognition
Wang et al. Real-time plane segmentation and obstacle detection of 3D point clouds for indoor scenes
TW201434010A (en) Image processor with multi-channel interface between preprocessing layer and one or more higher layers
Kallasi et al. Computer vision in underwater environments: A multiscale graph segmentation approach
US7440636B2 (en) Method and apparatus for image processing
Shibata et al. Gpgpu-assisted subpixel tracking method for fiducial markers
Dou et al. Robust image matching based on SIFT and delaunay triangulation
CN114548136A (en) Method, device, equipment and medium for analyzing light-reflecting two-dimensional code picture
US11790204B2 (en) Read curved visual marks
Bergevin et al. Detection and characterization of junctions in a 2D image
JP6055307B2 (en) Corresponding point search device, camera posture estimation device, and programs thereof
Niroshika et al. BLAID: Boundaries from locally adaptive isotropic detection

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