CN109711223A - A kind of promotion QR code decoding rate method and apparatus - Google Patents
A kind of promotion QR code decoding rate method and apparatus Download PDFInfo
- Publication number
- CN109711223A CN109711223A CN201811627842.4A CN201811627842A CN109711223A CN 109711223 A CN109711223 A CN 109711223A CN 201811627842 A CN201811627842 A CN 201811627842A CN 109711223 A CN109711223 A CN 109711223A
- Authority
- CN
- China
- Prior art keywords
- code
- image
- position sensing
- processing
- information
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 48
- 238000009499 grossing Methods 0.000 claims abstract description 61
- 230000001737 promoting effect Effects 0.000 claims abstract description 16
- 238000001514 detection method Methods 0.000 claims description 30
- 239000011159 matrix material Substances 0.000 claims description 29
- 238000004458 analytical method Methods 0.000 claims description 12
- 238000003706 image smoothing Methods 0.000 claims description 6
- 238000013507 mapping Methods 0.000 claims description 5
- 230000005055 memory storage Effects 0.000 claims 1
- 238000003672 processing method Methods 0.000 description 9
- 238000005516 engineering process Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 5
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 238000009792 diffusion process Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000002184 metal Substances 0.000 description 1
- 229920003023 plastic Polymers 0.000 description 1
- 239000004033 plastic Substances 0.000 description 1
- 239000011148 porous material Substances 0.000 description 1
Landscapes
- Image Analysis (AREA)
Abstract
The present invention relates to a kind of methods for promoting QR code decoding rate, comprising the following steps: the image for obtaining a frame QR code carries out the processing of position sensing graphic searching to image, and record position detects the quantity and key graphic information of figure;The quantity of position sensing figure is more than or equal to setting value and is then decoded processing;The quantity of position sensing figure is less than setting value and is smoothed to image, the processing of position sensing graphic searching is carried out to the image that smoothing processing is crossed again, and judge whether the position sensing figure number searched after smoothing processing is more than or equal to setting value, it is then decoded processing if it is greater than or equal to setting value, otherwise terminates decoding process;According to the position sensing figure and key graphic information found, QR code is decoded, successfully decoded then exports result, decoding failure then judges whether image passes through smoothing processing, as image has been subjected to smoothing processing, then terminate decoding process, if image is without smoothing processing, then returns to above-mentioned smoothing step.
Description
Technical field
The present invention relates to a kind of method and apparatus for promoting QR code decoding rate, belong to two dimensional code identification technology field.
Background technique
Barcode technology is that the collection to grow up on computer technology and Information Technology Foundation encodes, printing, data acquisition with
The emerging technology of identifying processing, quick and precisely and reliably due to its identification, the advantages such as low in cost are widely applied barcode technology
In business, warehouse logistics management, Industry Control and mobile payment field.
Bar code can be divided into bar code and two-dimensional bar code again, and bar code is by one group by certain regularly arranged item
With the label of sky composition;Different coding rules indicates different information.Two-dimensional bar code is with specific several picture by certain
Rule is distributed the barcode technology of chequered with black and white rectangle square matrix record data symbol information on two-dimensional surface;Two dimensional code, which has, to be deposited
It is big to store up capacity, includes abundant information, and analysis mode is special, there is a very strong confidentiality, but due to the two-dimensional characteristics of two dimensional code,
The horizontal information different from storing in vertical direction is bigger compared to bar code decoding difficulty.
Two dimensional code application scenarios are very extensive in real life, the medium of carried two dimensional code be also it is various, have
Metal, plastics, papery and mobile phone screen etc., the two dimensional code printed on different media, which pores over effect, biggish difference;Especially
It is using paper as the printing two dimensional code of medium, the problem of due to paper and printer, print in many cases two
The case where there are ink diffusions at code edge is tieed up, and paper is easier to wear in real life, causes acquired image can not
The case where decoding.
Summary of the invention
In order to solve above-mentioned problems of the prior art, it is flat that the present invention provides a kind of image for promoting QR code decoding rate
Sliding processing method and equipment,
Technical scheme is as follows:
Technical solution one:
The image for obtaining a frame QR code carries out the processing of position sensing graphic searching to image, and record position detects the quantity of figure
And key graphic information;
The quantity of position sensing figure is more than or equal to setting value and is then decoded processing;The quantity of position sensing figure is less than setting
Value is smoothed image, then carries out the processing of position sensing graphic searching to the image that smoothing processing is crossed, and judges smooth
Whether the position sensing figure number searched after processing is more than or equal to setting value, and place is then decoded if it is greater than or equal to setting value
Reason, otherwise terminates decoding process;
According to the position sensing figure and key graphic information found, QR code is decoded, successfully decoded then export as a result,
Decoding failure then judges whether image passes through smoothing processing, if image has been subjected to smoothing processing, then terminates decoding process, such as image
Without smoothing processing, then return above-mentioned steps image is successively smoothed, position sensing graphic searching processing reconciliation
Code processing.
Further, when obtaining the image of a frame QR code, whether a flag bit A is set to judge the image
Smoothing processing mistake, A are that TURE representative image has already passed through smoothing processing, and FALSE representative image is without smoothing processing, A default
For FALSE;After being smoothed to image, A is set to TURE.
Further, the key graphic information includes that the width information of single-bit module and the center of position sensing figure are sat
Mark;The position sensing graphic searching processing method particularly includes:
The module width standard proportional of figure is detected according to QR code position, traverses whole image, as being consecutively detected in a region
QR code position detects the module width standard proportional of figure, then marking current region, there are a position sensing figures;
The width for being consecutively detected the region of module width standard proportional of QR code position detection figure is obtained, by width divided by position
The stent block number for setting detection figure, obtains the width information of single-bit module;
Obtain first of the region that the module width standard proportional of QR code position detection figure is consecutively detected on two-dimensional directional
Test point and the last one test point, calculate separately in horizontal direction the intermediate value of first test point and the last one test point and
The intermediate value of first test point and the last one test point in vertical direction, obtains the centre coordinate of position sensing figure.
Further, the smoothing processing method particularly includes:
Obtain the gray value of any pixel point and its neighborhood territory pixel point in image;Establish the weight matrix of 3x3;By pixel and its
The gray value of neighborhood territory pixel point be multiplied and sum with the weight on the corresponding position on weight matrix after again divided by weight matrix
Each weights sum, obtains weighted average, which is replaced to the gray value of former centre of neighbourhood pixel;
According to step as above, whole image is traversed, the gray value of all pixels point in more new images;
The wherein weight matrix of the 3x3 is established by the noise that analysis plural number is difficult in decoded QR code image.
Further, according to the position sensing figure and key graphic information found, QR code is decoded specific
Method are as follows:
The centre coordinate of figure is detected according to the width information of each position detection figure, single-bit module that find and each position,
Determine QR code region;
According to the width information of the centre coordinate of two position sensing figures, single-bit module, the unilateral number of modules of QR code is calculated, it will
The unilateral number of modules of QR code with and the intrinsic number of modules of QR code version compare, determine the version of QR code;
QR code version information and the format information being stored near position sensing figure are extracted, according to QR code version information and format
Information decodes QR code.
Technical solution two:
A kind of equipment promoting QR code decoding rate, including memory and processor, the memory are stored with instruction, described instruction
Suitable for being loaded by processor and executing following steps:
The image for obtaining a frame QR code carries out the processing of position sensing graphic searching to image, and record position detects the quantity of figure
And key graphic information;
The quantity of position sensing figure is more than or equal to setting value and is then decoded processing;The quantity of position sensing figure is less than setting
Value is smoothed image, then carries out the processing of position sensing graphic searching to the image that smoothing processing is crossed, and judges smooth
Whether the position sensing figure number searched after processing is more than or equal to setting value, and place is then decoded if it is greater than or equal to setting value
Reason, otherwise terminates decoding process;
According to the position sensing figure and key graphic information found, QR code is decoded, successfully decoded then export as a result,
Decoding failure then judges whether image passes through smoothing processing, if image has been subjected to smoothing processing, then terminates decoding process, such as image
Without smoothing processing, then return above-mentioned steps image is successively smoothed, position sensing graphic searching processing reconciliation
Code processing.
Further, when obtaining the image of a frame QR code, whether a flag bit A is set to judge the image
Smoothing processing mistake, A are that TURE representative image has already passed through smoothing processing, and FALSE representative image is without smoothing processing, A default
For FALSE;After being smoothed to image, A is set to TURE.
Further, the key graphic information includes that the width information of single-bit module and the center of position sensing figure are sat
Mark;The position sensing graphic searching processing method particularly includes:
The module width standard proportional of figure is detected according to QR code position, traverses whole image, as being consecutively detected in a region
QR code position detects the module width standard proportional of figure, then marking current region, there are a position sensing figures;
The width for being consecutively detected the region of module width standard proportional of QR code position detection figure is obtained, by width divided by position
The stent block number for setting detection figure, obtains the width information of single-bit module;
Obtain first of the region that the module width standard proportional of QR code position detection figure is consecutively detected on two-dimensional directional
Test point and the last one test point, calculate separately in horizontal direction the intermediate value of first test point and the last one test point and
The intermediate value of first test point and the last one test point in vertical direction, obtains the centre coordinate of position sensing figure.
Further, the smoothing processing method particularly includes:
Obtain the gray value of any pixel point and its neighborhood territory pixel point in image;Establish the weight matrix of 3x3;By pixel and its
The gray value of neighborhood territory pixel point be multiplied and sum with the weight on the corresponding position on weight matrix after again divided by weight matrix
Each weights sum, obtains weighted average, which is replaced to the gray value of former centre of neighbourhood pixel;
According to step as above, whole image is traversed, the gray value of all pixels point in more new images;
The wherein weight matrix of the 3x3 is established by the noise that analysis plural number is difficult in decoded QR code image.
Further, according to the position sensing figure and key graphic information found, QR code is decoded specific
Method are as follows:
The centre coordinate of figure is detected according to the width information of each position detection figure, single-bit module that find and each position,
Determine QR code region;
According to the width information of the centre coordinate of two position sensing figures, single-bit module, the unilateral number of modules of QR code is calculated, it will
The unilateral number of modules of QR code with and the intrinsic number of modules of QR code version compare, determine the version of QR code;
QR code version information and the format information being stored near position sensing figure are extracted, according to QR code version information and format
Information decodes QR code.
The invention has the following beneficial effects:
1, the present invention just judges that can QR code be decoded by position sensing figure and key graphic information, to being just judged as
Cannot decoded image be smoothed;It finds to decode in decoding process to just being judged as to be decoded, then
The image is also smoothed, is further continued for being decoded image;By smoothing processing, reduces the noise in image, mention
Rise the decoding rate of image.
2, the present invention directly indicates whether image passes through smoothing processing by setting flag bit A, and whether simplification judges image
By the process of smoothing processing.
3, the present invention detects the module width standard proportional and stent block number of figure by continuously detection QR code position, really
Surely it whether there is position sensing figure, and record area position, believed by the width that regional location obtains single-bit module in image
The centre coordinate of breath and position sensing figure, is skillfully constructed.
4, the noise that the present invention is largely difficult in decoded QR code image by analysis obtains pixel and field pixel
Weight matrix whole image is traversed by average weighted method, the gray value of more new images inhibits the noise in image,
Noise is weakened on decoded influence.
Detailed description of the invention
Fig. 1 is the flow chart that the present invention promotes QR code decoding rate;
Fig. 2 is QR code graphical information distributing position figure;
Fig. 3 is the graphical information that QR code position detects figure;
Fig. 4 is the schematic diagram for searching QR code position detection figure;
Fig. 5 is the schematic diagram for calculating the width information of QR code single-bit module;
Fig. 6 is the schematic diagram for determining QR code region;
Fig. 7 is the schematic diagram of the QR code of version 1;
Fig. 8 is the schematic table for extracting pixel (x, y) and neighborhood territory pixel point gray value;
Fig. 9 is the schematic diagram of weight matrix.
Specific embodiment
It is next in the following with reference to the drawings and specific embodiments that the present invention will be described in detail.
Embodiment one
Referring to Fig. 1, a method of promoting QR code decoding rate, comprising the following steps:
The image for obtaining a frame QR code carries out the processing of position sensing graphic searching to image, and record position detects the quantity of figure
And key graphic information;
The quantity of position sensing figure is more than or equal to setting value, and (the present embodiment setting value is 2, is just only had altogether for a QR code
Three position sensing figures, if only one can not so calculate other two positions;Know two position sensing figures
Can be according to the relationship between two position sensing figures, such as distance, relative position speculates the position of third position sensing figure
It sets;Can not successfully decoded less than two) then it is decoded processing;The quantity of position sensing figure is less than setting value and carries out to image
Smoothing processing, then the processing of position sensing graphic searching is carried out to the image that smoothing processing is crossed, and search after judging smoothing processing
Position sensing figure number whether be more than or equal to setting value, processing is then decoded if it is greater than or equal to setting value, is otherwise terminated
Decoding process;
According to the position sensing figure and key graphic information found, QR code is decoded, successfully decoded then export as a result,
Decoding failure then judges whether image passes through smoothing processing, if image has been subjected to smoothing processing, then terminates decoding process, such as image
Without smoothing processing, then return above-mentioned steps image is successively smoothed, position sensing graphic searching processing reconciliation
Code processing.
The present embodiment just judges that can QR code be decoded by position sensing figure and key graphic information, to just sentencing
Break for cannot decoded image be smoothed, reduce image in noise, promote the discrimination of image;It can to being just judged as
It finds to decode in decoding process to be decoded, then the image is also smoothed, be further continued for carrying out image
Decoding.
Embodiment two
Further, when obtaining the image of a frame QR code, a flag bit A is set to judge whether the image is smoothed
Processed, A is that TURE representative image has already passed through smoothing processing, and FALSE representative image is defaulted as without smoothing processing, A
FALSE;After being smoothed to image, A is set to TURE.By the way that flag bit A is arranged, directly indicate whether image passes through
Smoothing processing, simplification judge whether image passes through the process of smoothing processing.
Further, referring specifically to Fig. 2-6, the key graphic information includes that the width information of single-bit module and position are visited
The centre coordinate of mapping shape;The position sensing graphic searching processing method particularly includes:
Referring specifically to Fig. 4, the module width standard proportional 1:1:3:1:1 of figure is detected according to QR code position, it is entire by row traversal
Image, the module width standard proportional as being consecutively detected QR code position detection figure in a region, then record this 1:1:3:
The initial position of 1:1 proportional region and final position, make a record;Start to compare initial position and end until full figure search finishes
The record Accurate Analysis being only closely located to;As shown in Figure 4 for the position sensing figure in the upper left corner, it is assumed that 1:1:3:1:1 in figure
The initial position of proportional region is that A final position is B, then first judges A, whether there is 1:1:3:1:1 ratio between B, then again
It is searched for, B starting search downwards, every time mobile a line image data, is judged in certain distance with the presence or absence of 1:5 upwards by A:
1 another proportionate relationship of position sensing figure then can be determined that a range is in position sensing figure determined by AB if it exists
Within;The lookup on orthogonal direction is done to position A and B again, there are the ratios of 1:1:3:1:1 so can consider this if appointed so
There are position sensing figures in a region.
The width for being consecutively detected the region of module width standard proportional of QR code position detection figure is obtained, width is removed
With the stent block number of position sensing figure, the width information of single-bit module is obtained;As shown in Figure 5, it is assumed that the 1:1:3 found:
First of the ratio of 1:1 is recorded as A, and the last one is recorded as B, counts the record between AB, it is assumed that and there are N item records, then
Calculate width Li(0 < i≤N of each) average length is acquired for L, then it is position that the width of single-bit module, which is MH=L/7(7,
The stent block number of graphic width is detected, the number of modules that the ratio of 1:1:3:1:1 accounts for just is 7 number of modules);It similarly calculates and hangs down
The upward MV of histogram;The width information of the single-bit module of the position sensing figure is M1=(MH+MV)/2;Calculate position spy
The width information of the single-bit module of mapping shape calculates the width information of the single-bit module of three or two position sensing figures
Mean value obtains final result.
Obtain the of the region that the module width standard proportional of QR code position detection figure is consecutively detected on two-dimensional directional
One test point and the last one test point calculate separately in horizontal direction in first test point and the last one test point
The intermediate value of first test point and the last one test point, obtains the centre coordinate of position sensing figure in value and vertical direction;
Such as Fig. 5, plane right-angle coordinate is established, it is assumed that first test point is A(xA, yA in horizontal direction), the last one test point
For B(xB, yB), the mean value in Y-coordinate for obtaining A and B is (yA+yB)/2;First test point C in vertical direction is sought again
(xC, yC) and the last one test point D(xD, yD) mean value (xC+xD)/2 in X-coordinate;Then in the position sensing figure
Heart coordinate is ((xC+xD)/2, (yA+yB)/2).
Further, the smoothing processing method particularly includes:
Such as Fig. 8, the gray value of any pixel point and its neighborhood territory pixel point in image is obtained, the pixel being located at coordinate (x, y)
Around there are eight pixel its coordinates to be respectively as follows: (x+1, y), (x-1, y), (x, y+1), (x, y-1), (x+1, y+1), (x+
1, y-1), (x-1, y+1), (x-1, y-1), p, p1, p2 ... p8 represent the gray value of pixel in figure;Such as Fig. 9,3x3 is established
Weight matrix;The gray value of pixel and its neighborhood territory pixel point is multiplied simultaneously with the weight on the corresponding position on weight matrix
Summation obtains pw=p1*w1+p2*w2+p3*w3+p4*w4+p*w5+p5*w6+p6*w7+p8*w9;Again divided by each in weight matrix
Weights sum obtains weighted average=pw/ (w1+w2+w3+w4+w5+w6+w7+w8+w9), which is replaced former
The gray value of centre of neighbourhood pixel;
According to step as above, whole image is traversed, the gray value of all pixels point in more new images;
The wherein weight matrix of the 3x3 is established by the noise that analysis plural number is difficult in decoded QR code image;Weight square
Battle array can establish multiple, and multiple weight matrixs can be chosen when traversing image and filter out noise in image.
Further, according to the position sensing figure and key graphic information found, QR code is decoded specific
Method are as follows:
The centre coordinate of figure is detected according to the width information of each position detection figure, single-bit module that find and each position,
Determine QR code region;With reference to Fig. 6, a delta-shaped region may be constructed by the center A of three position sensing figures, B, C, then
It is mobile to each outside diagonal according to geometrical relationship, that is, it can determine QR code region.
According to the width information of the centre coordinate of two position sensing figures, single-bit module, the unilateral module of QR code is calculated
Number, by the unilateral number of modules of QR code with and the intrinsic number of modules of QR code version compare, determine the version of QR code;With reference to Fig. 7,
By the centre coordinate of position sensing figure and the width information of single-bit module, determine the position of A point and B point, i.e., by A at
The centre coordinate of detection figure obtains A point abscissa to the width information of 3.5 single-bit modules of left, by detecting at B
The centre coordinate of figure translates the width information of 3.5 single-bit modules to right corner, obtains B point abscissa;AB point abscissa away from
From the width of QR code is obtained the unilateral number of modules of QR code divided by the width information of single-bit module by the as width of QR code;Cause
Correspond to the version of QR code for the unilateral number of modules of QR code, such as Fig. 7, the version of QR code is version 1 in figure, and unilateral number of modules is 21;
The unilateral number of modules of QR code obtained by calculation, compares with the unilateral number of modules of each QR code version, determines in image
The version of QR code.
With specific reference to Fig. 2, the version information and format information of QR code are to be stored in position sensing figure fixed area nearby
, QR code version information and the format information being stored near position sensing figure are extracted, according to QR code version information and format
Information decodes QR code.
The present embodiment not only has the beneficial effect of embodiment one, further, proposes specific implementation method, passes through
Flag bit A is set, indicates whether image passes through smoothing processing, simplification judges whether image passes through the process of smoothing processing;
The module width standard proportional and stent block number of figure are detected by continuously detecting QR code position, it is determined whether there are positions
Detection figure, and record area position are set, the width information and position sensing of single-bit module in image are obtained by regional location
The centre coordinate of figure;
The noise being largely difficult in decoded QR code image by analysis obtains the weight matrix of pixel and field pixel,
By average weighted method, whole image is traversed, the gray value of more new images inhibits the noise in image, weakens noise pair
Decoded influence;
The centre coordinate that figure is detected by position sensing figure, the width information of single-bit module and each position, determines QR code
Region;And the width of figure is detected by calculating position, the unilateral number of modules of position sensing figure is acquired, with each version QR code
Fixed unilateral number of modules compares, and determines the version of QR code;Lift the QR code version information for being stored in QR code areas adjacent again
It is decoded with format.
Embodiment three
A kind of equipment promoting QR code decoding rate, including memory and processor, the memory are stored with instruction, described instruction
Suitable for being loaded by processor and executing following steps:
The image for obtaining a frame QR code carries out the processing of position sensing graphic searching to image, and record position detects the quantity of figure
And key graphic information;
The quantity of position sensing figure is more than or equal to setting value, and (the present embodiment setting value is 2, is just only had altogether for a QR code
Three position sensing figures, if only one can not so calculate other two positions;Know two position sensing figures
Can be according to the relationship between two position sensing figures, such as distance, relative position speculates the position of third position sensing figure
It sets;Can not successfully decoded less than two) then it is decoded processing;The quantity of position sensing figure is less than setting value and carries out to image
Smoothing processing, then the processing of position sensing graphic searching is carried out to the image that smoothing processing is crossed, and search after judging smoothing processing
Position sensing figure number whether be more than or equal to setting value, processing is then decoded if it is greater than or equal to setting value, is otherwise terminated
Decoding process;
According to the position sensing figure and key graphic information found, QR code is decoded, successfully decoded then export as a result,
Decoding failure then judges whether image passes through smoothing processing, if image has been subjected to smoothing processing, then terminates decoding process, such as image
Without smoothing processing, then return above-mentioned steps image is successively smoothed, position sensing graphic searching processing reconciliation
Code processing.
The present embodiment just judges that can QR code be decoded by position sensing figure and key graphic information, to just sentencing
Break for cannot decoded image be smoothed, reduce image in noise, promote the discrimination of image;It can to being just judged as
It finds to decode in decoding process to be decoded, then the image is also smoothed, be further continued for carrying out image
Decoding.
Example IV
Further, when obtaining the image of a frame QR code, a flag bit A is set to judge whether the image is smoothed
Processed, A is that TURE representative image has already passed through smoothing processing, and FALSE representative image is defaulted as without smoothing processing, A
FALSE;After being smoothed to image, A is set to TURE.By the way that flag bit A is arranged, directly indicate whether image passes through
Smoothing processing, simplification judge whether image passes through the process of smoothing processing.
Further, referring specifically to Fig. 2-6, the key graphic information includes that the width information of single-bit module and position are visited
The centre coordinate of mapping shape;The position sensing graphic searching processing method particularly includes:
Referring specifically to Fig. 4, the module width standard proportional 1:1:3:1:1 of figure is detected according to QR code position, it is entire by row traversal
Image, the module width standard proportional as being consecutively detected QR code position detection figure in a region, then record this 1:1:3:
The initial position of 1:1 proportional region and final position, make a record;Start to compare initial position and end until full figure search finishes
The record Accurate Analysis being only closely located to;As shown in Figure 4 for the position sensing figure in the upper left corner, it is assumed that 1:1:3:1:1 in figure
The initial position of proportional region is that A final position is B, then first judges A, whether there is 1:1:3:1:1 ratio between B, then again
It is searched for, B starting search downwards, every time mobile a line image data, is judged in certain distance with the presence or absence of 1:5 upwards by A:
1 another proportionate relationship of position sensing figure then can be determined that a range is in position sensing figure determined by AB if it exists
Within;The lookup on orthogonal direction is done to position A and B again, there are the ratios of 1:1:3:1:1 so can consider this if appointed so
There are position sensing figures in a region.
The width for being consecutively detected the region of module width standard proportional of QR code position detection figure is obtained, width is removed
With the stent block number of position sensing figure, the width information of single-bit module is obtained;As shown in Figure 5, it is assumed that the 1:1:3 found:
First of the ratio of 1:1 is recorded as A, and the last one is recorded as B, counts the record between AB, it is assumed that and there are N item records, then
Calculate width Li(0 < i≤N of each) average length is acquired for L, then it is position that the width of single-bit module, which is MH=L/7(7,
The stent block number of graphic width is detected, the number of modules that the ratio of 1:1:3:1:1 accounts for just is 7 number of modules);It similarly calculates and hangs down
The upward MV of histogram;The width information of the single-bit module of the position sensing figure is M1=(MH+MV)/2;Calculate position spy
The width information of the single-bit module of mapping shape calculates the width information of the single-bit module of three or two position sensing figures
Mean value obtains final result.
Obtain the of the region that the module width standard proportional of QR code position detection figure is consecutively detected on two-dimensional directional
One test point and the last one test point calculate separately in horizontal direction in first test point and the last one test point
The intermediate value of first test point and the last one test point, obtains the centre coordinate of position sensing figure in value and vertical direction;
Such as Fig. 5, plane right-angle coordinate is established, it is assumed that first test point is A(xA, yA in horizontal direction), the last one test point
For B(xB, yB), the mean value in Y-coordinate for obtaining A and B is (yA+yB)/2;First test point C in vertical direction is sought again
(xC, yC) and the last one test point D(xD, yD) mean value (xC+xD)/2 in X-coordinate;Then in the position sensing figure
Heart coordinate is ((xC+xD)/2, (yA+yB)/2).
Further, the smoothing processing method particularly includes:
Such as Fig. 8, the gray value of any pixel point and its neighborhood territory pixel point in image is obtained, the pixel being located at coordinate (x, y)
Around there are eight pixel its coordinates to be respectively as follows: (x+1, y), (x-1, y), (x, y+1), (x, y-1), (x+1, y+1), (x+
1, y-1), (x-1, y+1), (x-1, y-1), p, p1, p2 ... p8 represent the gray value of pixel in figure;Such as Fig. 9,3x3 is established
Weight matrix;The gray value of pixel and its neighborhood territory pixel point is multiplied simultaneously with the weight on the corresponding position on weight matrix
Summation obtains pw=p1*w1+p2*w2+p3*w3+p4*w4+p*w5+p5*w6+p6*w7+p8*w9;Again divided by each in weight matrix
Weights sum obtains weighted average=pw/ (w1+w2+w3+w4+w5+w6+w7+w8+w9), which is replaced former
The gray value of centre of neighbourhood pixel;
According to step as above, whole image is traversed, the gray value of all pixels point in more new images;
The wherein weight matrix of the 3x3 is established by the noise that analysis plural number is difficult in decoded QR code image;Weight square
Battle array can establish multiple, and multiple weight matrixs can be chosen when traversing image and filter out noise in image.
Further, according to the position sensing figure and key graphic information found, QR code is decoded specific
Method are as follows:
The centre coordinate of figure is detected according to the width information of each position detection figure, single-bit module that find and each position,
Determine QR code region;With reference to Fig. 6, a delta-shaped region may be constructed by the center A of three position sensing figures, B, C, then
It is mobile to each outside diagonal according to geometrical relationship, that is, it can determine QR code region.
According to the width information of the centre coordinate of two position sensing figures, single-bit module, the unilateral module of QR code is calculated
Number, by the unilateral number of modules of QR code with and the intrinsic number of modules of QR code version compare, determine the version of QR code;With reference to Fig. 7,
By the centre coordinate of position sensing figure and the width information of single-bit module, determine the position of A point and B point, i.e., by A at
The centre coordinate of detection figure obtains A point abscissa to the width information of 3.5 single-bit modules of left, by detecting at B
The centre coordinate of figure translates the width information of 3.5 single-bit modules to right corner, obtains B point abscissa;AB point abscissa away from
From the width of QR code is obtained the unilateral number of modules of QR code divided by the width information of single-bit module by the as width of QR code;Cause
Correspond to the version of QR code for the unilateral number of modules of QR code, such as Fig. 7, the version of QR code is version 1 in figure, and unilateral number of modules is 21;
The unilateral number of modules of QR code obtained by calculation, compares with the unilateral number of modules of each QR code version, determines in image
The version of QR code.
With specific reference to Fig. 2, the version information and format information of QR code are to be stored in position sensing figure fixed area nearby
, QR code version information and the format information being stored near position sensing figure are extracted, according to QR code version information and format
Information decodes QR code.
The present embodiment not only has the beneficial effect of embodiment one, further, proposes specific implementation method, passes through
Flag bit A is set, indicates whether image passes through smoothing processing, simplification judges whether image passes through the process of smoothing processing;
The module width standard proportional and stent block number of figure are detected by continuously detecting QR code position, it is determined whether there are positions
Detection figure, and record area position are set, the width information and position sensing of single-bit module in image are obtained by regional location
The centre coordinate of figure;
The noise being largely difficult in decoded QR code image by analysis obtains the weight matrix of pixel and field pixel,
By average weighted method, whole image is traversed, the gray value of more new images inhibits the noise in image, weakens noise pair
Decoded influence;
The centre coordinate that figure is detected by position sensing figure, the width information of single-bit module and each position, determines QR code
Region;And the width of figure is detected by calculating position, the unilateral number of modules of position sensing figure is acquired, with each version QR code
Fixed unilateral number of modules compares, and determines the version of QR code;Lift the QR code version information for being stored in QR code areas adjacent again
It is decoded with format.
The above description is only an embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.
Claims (10)
1. a kind of method for promoting QR code decoding rate, which comprises the following steps:
The image for obtaining a frame QR code carries out the processing of position sensing graphic searching to image, and record position detects the quantity of figure
And key graphic information;
The quantity of position sensing figure is more than or equal to setting value and is then decoded processing;The quantity of position sensing figure is less than setting
Value is smoothed image, then carries out the processing of position sensing graphic searching to the image that smoothing processing is crossed, and judges smooth
Whether the position sensing figure number searched after processing is more than or equal to setting value, and place is then decoded if it is greater than or equal to setting value
Reason, otherwise terminates decoding process;
According to the position sensing figure and key graphic information found, QR code is decoded, successfully decoded then export as a result,
Decoding failure then judges whether image passes through smoothing processing, if image has been subjected to smoothing processing, then terminates decoding process, such as image
Without smoothing processing, then return above-mentioned steps image is successively smoothed, position sensing graphic searching processing reconciliation
Code processing.
2. a kind of method for promoting QR code decoding rate according to claim 1, it is characterised in that: obtaining a frame QR code
When image, whether a flag bit A is set to judge image smoothing processing mistake, A is that TURE representative image has passed through
Smoothing processing is crossed, FALSE representative image is defaulted as FALSE without smoothing processing, A;It, will after being smoothed to image
A is set to TURE.
3. a kind of method for promoting QR code decoding rate according to claim 1, it is characterised in that: the key graphic information
The centre coordinate of width information and position sensing figure including single-bit module;The position sensing graphic searching is handled specific
Method are as follows:
The module width standard proportional of figure is detected according to QR code position, traverses whole image, as being consecutively detected in a region
QR code position detects the module width standard proportional of figure, then marking current region, there are a position sensing figures;
The width for being consecutively detected the region of module width standard proportional of QR code position detection figure is obtained, by width divided by position
The stent block number for setting detection figure, obtains the width information of single-bit module;
Obtain first of the region that the module width standard proportional of QR code position detection figure is consecutively detected on two-dimensional directional
Test point and the last one test point, calculate separately in horizontal direction the intermediate value of first test point and the last one test point and
The intermediate value of first test point and the last one test point in vertical direction, obtains the centre coordinate of position sensing figure.
4. a kind of method for promoting QR code decoding rate according to claim 1, which is characterized in that the tool of the smoothing processing
Body method are as follows:
Obtain the gray value of any pixel point and its neighborhood territory pixel point in image;Establish the weight matrix of 3x3;By pixel and its
The gray value of neighborhood territory pixel point be multiplied and sum with the weight on the corresponding position on weight matrix after again divided by weight matrix
Each weights sum, obtains weighted average, which is replaced to the gray value of former centre of neighbourhood pixel;
According to step as above, whole image is traversed, the gray value of all pixels point in more new images;
The wherein weight matrix of the 3x3 is established by the noise that analysis plural number is difficult in decoded QR code image.
5. a kind of method for promoting QR code decoding rate according to claim 3, which is characterized in that visited according to the position found
Mapping shape and key graphic information, are decoded QR code method particularly includes:
The centre coordinate of figure is detected according to the width information of each position detection figure, single-bit module that find and each position,
Determine QR code region;
According to the width information of the centre coordinate of two position sensing figures, single-bit module, the unilateral number of modules of QR code is calculated, it will
The unilateral number of modules of QR code with and the intrinsic number of modules of QR code version compare, determine the version of QR code;
QR code version information and the format information being stored near position sensing figure are extracted, according to QR code version information and format
Information decodes QR code.
6. a kind of equipment for promoting QR code decoding rate, which is characterized in that including memory and processor, the memory storage
There is instruction, described instruction is suitable for being loaded by processor and executing following steps:
The image for obtaining a frame QR code carries out the processing of position sensing graphic searching to image, and record position detects the quantity of figure
And key graphic information;
The quantity of position sensing figure is more than or equal to setting value and is then decoded processing;The quantity of position sensing figure is less than setting
Value is smoothed image, then carries out the processing of position sensing graphic searching to the image that smoothing processing is crossed, and judges smooth
Whether the position sensing figure number searched after processing is more than or equal to setting value, and place is then decoded if it is greater than or equal to setting value
Reason, otherwise terminates decoding process;
According to the position sensing figure and key graphic information found, QR code is decoded, successfully decoded then export as a result,
Decoding failure then judges whether image passes through smoothing processing, if image has been subjected to smoothing processing, then terminates decoding process, such as image
Without smoothing processing, then return above-mentioned steps image is successively smoothed, position sensing graphic searching processing reconciliation
Code processing.
7. a kind of equipment for promoting QR code decoding rate according to claim 6, it is characterised in that: obtaining a frame QR code
When image, whether a flag bit A is set to judge image smoothing processing mistake, A is that TURE representative image has passed through
Smoothing processing is crossed, FALSE representative image is defaulted as FALSE without smoothing processing, A;It, will after being smoothed to image
A is set to TURE.
8. a kind of equipment for promoting QR code decoding rate according to claim 6, it is characterised in that: the key graphic information
The centre coordinate of width information and position sensing figure including single-bit module;The position sensing graphic searching is handled specific
Method are as follows:
The module width standard proportional of figure is detected according to QR code position, traverses whole image, as being consecutively detected in a region
QR code position detects the module width standard proportional of figure, then marking current region, there are a position sensing figures;
The width for being consecutively detected the region of module width standard proportional of QR code position detection figure is obtained, by width divided by position
The stent block number for setting detection figure, obtains the width information of single-bit module;
Obtain first of the region that the module width standard proportional of QR code position detection figure is consecutively detected on two-dimensional directional
Test point and the last one test point, calculate separately in horizontal direction the intermediate value of first test point and the last one test point and
The intermediate value of first test point and the last one test point in vertical direction, obtains the centre coordinate of position sensing figure.
9. a kind of equipment for promoting QR code decoding rate according to claim 6, which is characterized in that the tool of the smoothing processing
Body method are as follows:
Obtain the gray value of any pixel point and its neighborhood territory pixel point in image;Establish the weight matrix of 3x3;By pixel and its
The gray value of neighborhood territory pixel point be multiplied and sum with the weight on the corresponding position on weight matrix after again divided by weight matrix
Each weights sum, obtains weighted average, which is replaced to the gray value of former centre of neighbourhood pixel;
According to step as above, whole image is traversed, the gray value of all pixels point in more new images;
The wherein weight matrix of the 3x3 is established by the noise that analysis plural number is difficult in decoded QR code image.
10. a kind of equipment for promoting QR code decoding rate according to claim 8, which is characterized in that according to the position found
Figure and key graphic information are detected, QR code is decoded method particularly includes:
The centre coordinate of figure is detected according to the width information of each position detection figure, single-bit module that find and each position,
Determine QR code region;
According to the width information of the centre coordinate of two position sensing figures, single-bit module, the unilateral number of modules of QR code is calculated, it will
The unilateral number of modules of QR code with and the intrinsic number of modules of QR code version compare, determine the version of QR code;
QR code version information and the format information being stored near position sensing figure are extracted, according to QR code version information and format
Information decodes QR code.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811627842.4A CN109711223A (en) | 2018-12-28 | 2018-12-28 | A kind of promotion QR code decoding rate method and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811627842.4A CN109711223A (en) | 2018-12-28 | 2018-12-28 | A kind of promotion QR code decoding rate method and apparatus |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109711223A true CN109711223A (en) | 2019-05-03 |
Family
ID=66259258
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811627842.4A Pending CN109711223A (en) | 2018-12-28 | 2018-12-28 | A kind of promotion QR code decoding rate method and apparatus |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109711223A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111767752A (en) * | 2020-06-11 | 2020-10-13 | 网易宝有限公司 | Two-dimensional code identification method and device |
CN113158704A (en) * | 2021-04-07 | 2021-07-23 | 福州符号信息科技有限公司 | Method and system for rapidly positioning Dotcode code |
Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6094509A (en) * | 1994-06-07 | 2000-07-25 | United Parcel Service Of America, Inc. | Method and apparatus for decoding two-dimensional symbols in the spatial domain |
US7412106B1 (en) * | 2005-06-25 | 2008-08-12 | Cognex Technology And Investment Corporation | Methods for locating and decoding distorted two-dimensional matrix symbols |
US20100155464A1 (en) * | 2008-12-22 | 2010-06-24 | Canon Kabushiki Kaisha | Code detection and decoding system |
CN102136058A (en) * | 2011-04-26 | 2011-07-27 | 中国农业大学 | Bar code image identification method |
CN103914675A (en) * | 2014-03-17 | 2014-07-09 | 东华大学 | Garment QD code recognition method |
CN103955659A (en) * | 2014-04-22 | 2014-07-30 | 广州宽度信息技术有限公司 | Batch true-known code identification method |
CN103955663A (en) * | 2014-04-22 | 2014-07-30 | 广州宽度信息技术有限公司 | QR code fouling resistance identification method |
CN104951726A (en) * | 2015-06-25 | 2015-09-30 | 福建联迪商用设备有限公司 | Method and device for QR (quick response) two-dimension code position detection |
CN106326802A (en) * | 2016-08-19 | 2017-01-11 | 腾讯科技(深圳)有限公司 | Two-dimensional code correction method and device and terminal device |
TWI567655B (en) * | 2016-02-04 | 2017-01-21 | Calin Technology Co Ltd | Object of two - dimensional code discrimination method |
CN106503604A (en) * | 2016-10-18 | 2017-03-15 | 上海觉感视觉科技有限公司 | A kind of position sensing figure group technology of QR codes |
CN107908998A (en) * | 2017-11-28 | 2018-04-13 | 百富计算机技术(深圳)有限公司 | Quick Response Code coding/decoding method, device, terminal device and computer-readable recording medium |
CN108959998A (en) * | 2018-06-25 | 2018-12-07 | 天津英创汇智汽车技术有限公司 | Two-dimensional code identification method, apparatus and system |
-
2018
- 2018-12-28 CN CN201811627842.4A patent/CN109711223A/en active Pending
Patent Citations (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6094509A (en) * | 1994-06-07 | 2000-07-25 | United Parcel Service Of America, Inc. | Method and apparatus for decoding two-dimensional symbols in the spatial domain |
US7412106B1 (en) * | 2005-06-25 | 2008-08-12 | Cognex Technology And Investment Corporation | Methods for locating and decoding distorted two-dimensional matrix symbols |
US20100155464A1 (en) * | 2008-12-22 | 2010-06-24 | Canon Kabushiki Kaisha | Code detection and decoding system |
CN102136058A (en) * | 2011-04-26 | 2011-07-27 | 中国农业大学 | Bar code image identification method |
CN103914675A (en) * | 2014-03-17 | 2014-07-09 | 东华大学 | Garment QD code recognition method |
CN103955663A (en) * | 2014-04-22 | 2014-07-30 | 广州宽度信息技术有限公司 | QR code fouling resistance identification method |
CN103955659A (en) * | 2014-04-22 | 2014-07-30 | 广州宽度信息技术有限公司 | Batch true-known code identification method |
CN104951726A (en) * | 2015-06-25 | 2015-09-30 | 福建联迪商用设备有限公司 | Method and device for QR (quick response) two-dimension code position detection |
TWI567655B (en) * | 2016-02-04 | 2017-01-21 | Calin Technology Co Ltd | Object of two - dimensional code discrimination method |
CN106326802A (en) * | 2016-08-19 | 2017-01-11 | 腾讯科技(深圳)有限公司 | Two-dimensional code correction method and device and terminal device |
CN106503604A (en) * | 2016-10-18 | 2017-03-15 | 上海觉感视觉科技有限公司 | A kind of position sensing figure group technology of QR codes |
CN107908998A (en) * | 2017-11-28 | 2018-04-13 | 百富计算机技术(深圳)有限公司 | Quick Response Code coding/decoding method, device, terminal device and computer-readable recording medium |
CN108959998A (en) * | 2018-06-25 | 2018-12-07 | 天津英创汇智汽车技术有限公司 | Two-dimensional code identification method, apparatus and system |
Non-Patent Citations (2)
Title |
---|
李军: "QR码的图像恢复和识别技术研究与实现", 《中国优秀硕士学位论文全文数据库》 * |
王文豪等: "QR code二维条码的图像识别", 《计算机技术与发展》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111767752A (en) * | 2020-06-11 | 2020-10-13 | 网易宝有限公司 | Two-dimensional code identification method and device |
CN113158704A (en) * | 2021-04-07 | 2021-07-23 | 福州符号信息科技有限公司 | Method and system for rapidly positioning Dotcode code |
CN113158704B (en) * | 2021-04-07 | 2023-06-09 | 福州符号信息科技有限公司 | Method and system for rapidly positioning Dotcode code |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10679175B2 (en) | Two-dimensional code, system for creation of two-dimensional code, and analysis program | |
CN110443243B (en) | Water level monitoring method, storage medium, network device and water level monitoring system | |
US9799119B2 (en) | Detecting specified image identifiers on objects | |
CN100377167C (en) | Two-dimensional code area precisive positioning method for two-dimensional recognition | |
CN102521558B (en) | Bar code identifying method and device | |
CN102254144A (en) | Robust method for extracting two-dimensional code area in image | |
US9286501B2 (en) | Method and device for identifying a two-dimensional barcode | |
CN105989659B (en) | A kind of similar character recognition methods and paper money code recognition methods | |
CN101908136A (en) | Table identifying and processing method and system | |
JP2788604B2 (en) | Information display tag having two-dimensional information pattern, image processing method and image processing apparatus using the same | |
CN111461131A (en) | Identification method, device, equipment and storage medium for ID card number information | |
CN107451507A (en) | A kind of two-dimensional code identification method being used in dynamic image and device | |
US5563958A (en) | System and method for optical character recognition bar-coded characters | |
CN109711223A (en) | A kind of promotion QR code decoding rate method and apparatus | |
CN112733829B (en) | Feature block identification method, electronic equipment and computer readable storage medium | |
EP0651337A1 (en) | Object recognizing method, its apparatus, and image processing method and its apparatus | |
CN113435219A (en) | Anti-counterfeiting detection method and device, electronic equipment and storage medium | |
CN113988241A (en) | A kind of anti-counterfeiting label and its forming method, anti-counterfeiting method and printed matter | |
WO2020186900A1 (en) | Narrow-strip two-dimensional barcode, and method, apparatus and device for generating and recognizing narrow-strip two-dimensional barcode | |
CN110598575A (en) | Table layout analysis and extraction method and related device | |
JP3268552B2 (en) | Area extraction method, destination area extraction method, destination area extraction apparatus, and image processing apparatus | |
CN105930813B (en) | A method of detection composes a piece of writing this under any natural scene | |
WO2013096270A1 (en) | Systems and methods for locating characters on a document | |
CN115797942A (en) | Propaganda information interaction method and system | |
EP0702320A1 (en) | Skew 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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190503 |
|
RJ01 | Rejection of invention patent application after publication |