CN109740402B - Two-dimensional code direction and position obtaining method based on frequency spectrum information - Google Patents

Two-dimensional code direction and position obtaining method based on frequency spectrum information Download PDF

Info

Publication number
CN109740402B
CN109740402B CN201910002627.3A CN201910002627A CN109740402B CN 109740402 B CN109740402 B CN 109740402B CN 201910002627 A CN201910002627 A CN 201910002627A CN 109740402 B CN109740402 B CN 109740402B
Authority
CN
China
Prior art keywords
image
dimensional code
code
point
roi
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.)
Active
Application number
CN201910002627.3A
Other languages
Chinese (zh)
Other versions
CN109740402A (en
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.)
Tztek Technology Co Ltd
Original Assignee
Tztek 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 Tztek Technology Co Ltd filed Critical Tztek Technology Co Ltd
Priority to CN201910002627.3A priority Critical patent/CN109740402B/en
Publication of CN109740402A publication Critical patent/CN109740402A/en
Application granted granted Critical
Publication of CN109740402B publication Critical patent/CN109740402B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a two-dimensional code direction and position acquisition method based on frequency spectrum information, which does not comprise a threshold judgment process, is insensitive to the change of image quality, solves direction and period information and then accurately positions a two-dimensional code area, and has higher positioning accuracy. The method comprises the steps of obtaining ROI image binaryzation through positioning, then solving canny edges, then transferring the edge image from a space image to a spectrum image, then positioning extreme points of the spectrum image, then carrying out ROI image affine transformation, then carrying out edge fine positioning and code point separation, and finally solving code point separation codes.

Description

Two-dimensional code direction and position obtaining method based on frequency spectrum information
Technical Field
The invention relates to the technical field of two-dimensional code positioning, in particular to a method for acquiring the direction and position of a two-dimensional code based on frequency spectrum information.
Background
The two-dimensional code records data symbol information by black and white alternate graphs distributed on a plane (in a two-dimensional direction) according to a certain rule by using a certain specific geometric figure; the concept of "0" and "1" bit stream forming the internal logic basis of computer is used ingeniously in coding, several geometric forms correspondent to binary system are used to represent literal numerical information, and can be automatically read by means of image input equipment or photoelectric scanning equipment so as to implement automatic information processing. In factory production, a large amount of product information can be stored in a two-dimensional code (especially a DataMatrix code), the two-dimensional code is an important element for quality control of a factory, and the decoding requirement of the two-dimensional code generally exists in automatic measurement and detection equipment.
The two-dimensional code decoding algorithm in the prior art is generally divided into three steps:
1) initial positioning, namely segmenting an image, and respectively calculating whether each part contains a two-dimensional code to realize the initial positioning of the two-dimensional code, wherein the step is to include an ROI (region of interest) of the two-dimensional code (the area of the ROI is 2 to 4 times of the actual area of the two-dimensional code generally);
2) precise positioning, namely solving straight line information in an ROI (region of interest) by adopting Hough transform, determining the posture (rotation direction) of the two-dimensional code according to the information such as the length, the angle and the intersection point position of a straight line, and separating the two-dimensional code region from a background image by performing operations such as opening and closing on a binary image so as to realize the precise positioning of the two-dimensional code; after four boundaries of the two-dimensional code are accurately positioned, affine transformation, projection transformation and other transformation operations are carried out on the area in the boundaries, and the original two-dimensional code is transformed into a rectangular two-dimensional code;
3) code point segmentation-segmenting code points in an image, judging 0/1 states of the code points, and performing decoding calculation.
In the prior art, operations such as binarization, morphology, Hough transform and the like are required in the decoding process, the operations are sensitive to a selected threshold value and have poor adaptability, and the accurate solution of the direction and the position of the two-dimensional code is difficult to realize for an image with poor imaging quality, so that the decoding rate of a code scanning system is influenced. In an industrial environment, due to the processing quality difference of the workpiece and the influence of environmental illumination, the quality of the two-dimensional code image in the shot workpiece picture has large change, and then the decoding rate of the code scanning system is influenced, so that corresponding information cannot be accurately obtained, and adverse influence is brought to subsequent production.
Disclosure of Invention
In order to solve the problems, the invention provides a two-dimensional code direction and position obtaining method based on frequency spectrum information, which does not comprise a threshold value judging process, is insensitive to the change of image quality, solves direction and period information and then accurately positions a two-dimensional code area, and has higher positioning precision.
The two-dimensional code direction and position obtaining method based on the frequency spectrum information is characterized by comprising the following steps: the method comprises the steps of obtaining ROI image binaryzation through positioning, then solving canny edges, then transferring the edge image from a space image to a spectrum image, then positioning extreme points of the spectrum image, then carrying out ROI image affine transformation, then carrying out edge fine positioning and code point separation, and finally solving code point separation codes.
It is further characterized in that:
the specific operation steps of the method are as follows,
a, performing binarization operation on a two-dimensional code ROI image by using a local binarization method to strengthen edge gradient information in the image;
b, solving the edge of the binarized image, and reinforcing the direction and period information in the two-dimensional code image;
c, converting the edge image from the space image to the frequency spectrum image;
d, calculating a plus or minus 1-level extreme point in the two-dimensional spectrum image, wherein the normal direction of a connecting line of the plus or minus 1-level extreme point and the minus 1-level extreme point is the direction of the two-dimensional code boundary, and the ratio of the boundary pixel value of the ROI image to the distance between the plus or minus 1-level extreme points is the space period of the two-dimensional code points;
e, performing affine transformation on the ROI image according to the two-dimensional code boundary direction solved in the step d, and enabling the boundaries of the two-dimensional code to be parallel to the corresponding boundaries of the image after the affine transformation respectively;
f, taking an image in the central range of the image, projecting the image to the boundary, searching extreme points in the projected curve, recording the positions of the extreme points, wherein the extreme points are the code point centers of the two-dimensional code, and performing code point segmentation on the ROI image after affine transformation according to the positions of the code point centers and the code point period;
g, judging the segmented code point values according to the code point characteristics (0/1), and determining the precise boundary of the two-dimensional code according to the distribution of the code point values;
and h, reading each code point value of the two-dimensional code, and decoding the content of the two-dimensional code.
Before the ROI image binarization operation is carried out, the ROI area is solved through two-dimensional code primary positioning.
It is further characterized in that:
in the step c, two-dimensional Fourier transform is specifically adopted to convert the edge image from a space image to a frequency spectrum image;
and f, for an ROI image with the resolution of NxN, enabling two edges of the two-dimensional code to be parallel to two edges of the image after affine transformation respectively, taking an image within the range of the center (N/2: 3N/2 ) of the image, projecting the image on the two edges, searching extreme points in a projected curve, and recording the positions of the extreme points, wherein the extreme points are the code point centers of the two-dimensional code.
After the technical scheme is adopted, the method does not comprise a threshold judgment process, is insensitive to the change of image quality, solves direction and period information and then accurately positions the two-dimensional code area, and is higher in positioning accuracy.
Drawings
FIG. 1 is a block flow diagram of the method of the present invention;
FIG. 2 is a schematic diagram illustrating the effect of the algorithm of the present invention, wherein a is an initially positioned ROI image; b is the distribution of the spectral intensity in different directions; c is the positioning result.
Detailed Description
The two-dimensional code direction and position obtaining method based on the frequency spectrum information is shown in fig. 1-2: the method comprises the steps of obtaining ROI image binaryzation through positioning, then solving canny edges, then transferring the edge image from a space image to a spectrum image, then positioning extreme points of the spectrum image, then carrying out ROI image affine transformation, then carrying out edge fine positioning and code point separation, and finally solving code point separation codes.
The specific operation steps of the method are as follows,
a, performing binarization operation on a two-dimensional code ROI image by using a local binarization method to strengthen edge gradient information in the image;
b, strengthening direction and period information in the two-dimensional code image by solving the edge of the binarized image;
c, converting the edge image from the space image to the frequency spectrum image;
d, calculating a plus or minus 1-level extreme point in the two-dimensional spectrum image, wherein the normal direction of a connecting line of the plus or minus 1-level extreme point and the minus 1-level extreme point is the direction of the two-dimensional code boundary, and the ratio of the boundary pixel value of the ROI image to the distance between the plus or minus 1-level extreme points is the space period of the two-dimensional code points;
e, performing affine transformation on the ROI image according to the two-dimensional code boundary direction solved in the step d, and enabling the boundaries of the two-dimensional code to be parallel to the corresponding boundaries of the image after the affine transformation respectively;
f, taking an image in the central range of the image, projecting the image to the boundary, searching extreme points in the projected curve, recording the positions of the extreme points, wherein the extreme points are the code point centers of the two-dimensional code, and performing code point segmentation on the ROI image after affine transformation according to the positions of the code point centers and the code point period;
g, judging the segmented code point values according to the code point characteristics (0/1), and determining the precise boundary of the two-dimensional code according to the distribution of the code point values;
and h, reading each code point value of the two-dimensional code, and decoding the content of the two-dimensional code.
Before the ROI image binarization operation is carried out, solving the ROI area through two-dimensional code primary positioning;
and c, specifically adopting two-dimensional Fourier transform to convert the edge image from the space image to the frequency spectrum image.
In the specific embodiment, for an ROI image with a resolution of nxn, the two-dimensional code direction and position obtaining method includes the following steps:
a, performing binarization operation on a two-dimensional code ROI image by using a local binarization method to strengthen edge gradient information in the image;
b, solving the edge of the binarized image through a canny algorithm, and strengthening the direction and period information in the two-dimensional code image;
c, performing two-dimensional Fourier transform on the edge image to convert the edge image from the space image to a frequency spectrum image;
d, calculating a plus or minus 1-level extreme point in the two-dimensional spectrum image, wherein the normal direction of a connecting line of the plus or minus 1-level extreme point and the minus 1-level extreme point is the direction of the boundary of the two-dimensional code, and the ratio of N to the distance between the plus or minus 1-level extreme points is the space period of the two-dimensional code;
e, performing affine transformation on the ROI image according to the two-dimensional code boundary direction solved in the step d, and enabling two edges of the two-dimensional code to be parallel to two edges of the image after the affine transformation respectively;
f, taking an image in the range of the image center [ N/2:3N/2, N/2:3N/2], projecting the image to two sides, searching extreme points in the projected curve, recording the positions of the extreme points, wherein the extreme points are the code point centers of the two-dimensional codes, and performing code point segmentation on the ROI image after affine transformation according to the positions of the code point centers and the code point period;
g, judging the segmented code point values according to the code point characteristics (0/1), and determining the precise boundary of the two-dimensional code according to the distribution of the code point values;
and h, reading each code point value of the two-dimensional code, and decoding the content of the two-dimensional code.
In an industrial environment, due to the processing quality difference of a workpiece and the influence of environmental illumination, the quality of a two-dimensional code image in a shot workpiece picture has large variation, in order to improve the accuracy of a two-dimensional code decoding system, a method for solving the direction and the position of the two-dimensional code by using frequency spectrum information does not include a threshold value judgment process, is insensitive to the variation of the image quality, accurately positions a two-dimensional code area after solving the direction and period information, and is higher in positioning accuracy.
The detailed description of the embodiments of the present invention is provided above, but the present invention is only the preferred embodiments of the present invention, and should not be considered as limiting the scope of the present invention. All equivalent changes and modifications made within the scope of the invention as claimed should be covered by this patent.

Claims (4)

1. The two-dimensional code direction and position obtaining method based on the frequency spectrum information is characterized by comprising the following steps: the method comprises the steps of carrying out binarization on an ROI image obtained through positioning, then carrying out canny edge solution, then carrying out conversion from a space image to a frequency spectrum image on the edge image, then positioning an extreme point of the frequency spectrum image, carrying out affine transformation on the ROI image, then carrying out edge fine positioning and code point separation, and finally carrying out solution on a code point separation code system; the specific operation steps are as follows:
a, performing binarization operation on a two-dimensional code ROI image by using a local binarization method to strengthen edge gradient information in the image;
b, solving the edge of the binarized image, and reinforcing the direction and period information in the two-dimensional code image;
c, converting the edge image from the space image to the frequency spectrum image;
d, calculating a +/-1-level extreme point in the two-dimensional frequency spectrum image, wherein the normal direction of a connecting line of the + 1-level extreme point and the-1-level extreme point is the direction of the two-dimensional code boundary, and the ratio of the boundary pixel value of the ROI image to the distance between the two-level extreme points is the space period of the two-dimensional code points;
e, performing affine transformation on the ROI image according to the two-dimensional code boundary direction solved in the step d, and enabling the boundaries of the two-dimensional code to be parallel to the corresponding boundaries of the image after the affine transformation respectively;
f, taking an image in the central range of the image, projecting the image to the boundary, searching extreme points in the projected curve, recording the positions of the extreme points, wherein the extreme points are the code point centers of the two-dimensional code, and performing code point segmentation on the ROI image after affine transformation according to the positions of the code point centers and the code point period;
g, judging the segmented code point values according to the code point characteristics (0/1), and determining the precise boundary of the two-dimensional code according to the distribution of the code point values;
and h, reading each code point value of the two-dimensional code, and decoding the content of the two-dimensional code.
2. The two-dimensional code direction and position acquisition method based on spectrum information as claimed in claim 1, wherein: before the ROI image binarization operation is carried out, the ROI area is solved through two-dimensional code primary positioning.
3. The two-dimensional code direction and position acquisition method based on spectrum information as claimed in claim 1, wherein: and c, specifically, converting the edge image from the space image to the frequency spectrum image by adopting two-dimensional Fourier transform.
4. The two-dimensional code direction and position acquisition method based on spectrum information as claimed in claim 1, wherein: and f, for an ROI image with the resolution of NxN, enabling two edges of the two-dimensional code to be parallel to two edges of the image after affine transformation respectively, taking an image within the range of the center (N/2: 3N/2 ) of the image, projecting the image on the two edges, searching extreme points in a projected curve, and recording the positions of the extreme points, wherein the extreme points are the code point centers of the two-dimensional code.
CN201910002627.3A 2019-01-02 2019-01-02 Two-dimensional code direction and position obtaining method based on frequency spectrum information Active CN109740402B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910002627.3A CN109740402B (en) 2019-01-02 2019-01-02 Two-dimensional code direction and position obtaining method based on frequency spectrum information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910002627.3A CN109740402B (en) 2019-01-02 2019-01-02 Two-dimensional code direction and position obtaining method based on frequency spectrum information

Publications (2)

Publication Number Publication Date
CN109740402A CN109740402A (en) 2019-05-10
CN109740402B true CN109740402B (en) 2022-04-22

Family

ID=66363092

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910002627.3A Active CN109740402B (en) 2019-01-02 2019-01-02 Two-dimensional code direction and position obtaining method based on frequency spectrum information

Country Status (1)

Country Link
CN (1) CN109740402B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113028989B (en) * 2021-03-05 2022-08-16 苏州天准软件有限公司 Method and device for acquiring three-dimensional information of object

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102012024771A1 (en) * 2012-12-17 2014-06-18 Markus Klippstein Method for identifying a subject matter by using code e.g. EAN code, involves forming UV-light responsive and fluorescent substance in form of one and/or two-dimensional codes, and applying code on subject matter
CN104408698A (en) * 2014-10-29 2015-03-11 中山大学 Compressed-sensing-based two-dimensional code image illumination equalization method
CN105260693A (en) * 2015-12-01 2016-01-20 浙江工业大学 Laser two-dimensional code positioning method
CN106485183A (en) * 2016-07-14 2017-03-08 深圳市华汉伟业科技有限公司 A kind of Quick Response Code localization method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102012024771A1 (en) * 2012-12-17 2014-06-18 Markus Klippstein Method for identifying a subject matter by using code e.g. EAN code, involves forming UV-light responsive and fluorescent substance in form of one and/or two-dimensional codes, and applying code on subject matter
CN104408698A (en) * 2014-10-29 2015-03-11 中山大学 Compressed-sensing-based two-dimensional code image illumination equalization method
CN105260693A (en) * 2015-12-01 2016-01-20 浙江工业大学 Laser two-dimensional code positioning method
CN106485183A (en) * 2016-07-14 2017-03-08 深圳市华汉伟业科技有限公司 A kind of Quick Response Code localization method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种基于曲线拟合提取干涉条纹中心点的新方法;蔡怀宇等;《光电子.激光》;20060125(第01期);全文 *

Also Published As

Publication number Publication date
CN109740402A (en) 2019-05-10

Similar Documents

Publication Publication Date Title
CN107633192B (en) Bar code segmentation and reading method based on machine vision under complex background
CN107609451A (en) A kind of high-precision vision localization method and system based on Quick Response Code
CN113344857B (en) Defect detection network training method, defect detection method and storage medium
US10528781B2 (en) Detection method and system for characteristic patterns of Han Xin codes
CN106529537A (en) Digital meter reading image recognition method
CN109190742B (en) Decoding method of coding feature points based on gray feature
CN110378957B (en) Torpedo tank car visual identification and positioning method and system for metallurgical operation
CN107301412B (en) Pointer instrument reading method based on image processing
CN112734729B (en) Water gauge water level line image detection method and device suitable for night light supplement condition and storage medium
CN113177959B (en) QR code real-time extraction method in rapid movement process
CN103729631A (en) Vision-based connector surface feature automatically-identifying method
CN110544235B (en) Flexible circuit board image area identification method based on differential geometry
CN111046881A (en) Pointer type instrument reading identification method based on computer vision and deep learning
CN105574161A (en) Trademark graph element identification method, device and system
CN109740402B (en) Two-dimensional code direction and position obtaining method based on frequency spectrum information
CN113538585B (en) High-precision multi-target intelligent identification, positioning and tracking method and system based on unmanned aerial vehicle
Zhou et al. An adaptive clustering method detecting the surface defects on linear guide rails
CN113034492A (en) Printing quality defect detection method and storage medium
CN113591875B (en) High-precision pointer type instrument identification method
CN116188755A (en) Instrument angle correction and reading recognition device based on deep learning
CN100465586C (en) Computer vision digitalized measuring scale system
CN114359322A (en) Image correction and splicing method, and related device, equipment, system and storage medium
CN110298799B (en) PCB image positioning correction method
CN112541943A (en) Robot positioning method based on visual road signs
Sowah et al. Intelligent instrument reader using computer vision and machine learning

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
GR01 Patent grant
GR01 Patent grant