CN106022203A - Mobile terminal image capture method - Google Patents
Mobile terminal image capture method Download PDFInfo
- Publication number
- CN106022203A CN106022203A CN201610333214.XA CN201610333214A CN106022203A CN 106022203 A CN106022203 A CN 106022203A CN 201610333214 A CN201610333214 A CN 201610333214A CN 106022203 A CN106022203 A CN 106022203A
- Authority
- CN
- China
- Prior art keywords
- pixel
- quick response
- response code
- color
- scan
- 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
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K7/00—Methods or arrangements for sensing record carriers, e.g. for reading patterns
- G06K7/10—Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
- G06K7/14—Methods 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/1404—Methods for optical code recognition
- G06K7/1408—Methods for optical code recognition the method being specifically adapted for the type of code
- G06K7/1417—2D bar codes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/22—Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K7/00—Methods or arrangements for sensing record carriers, e.g. for reading patterns
- G06K7/10—Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
- G06K2007/10524—Hand-held scanners
Abstract
The invention provides a mobile terminal image capture method. The method comprises the steps of detecting the position of a two-dimensional code positioning frame; and positioning the edge of the positioning frame to determine an edge direction of a two-dimensional code. Compared with an existing method, the mobile terminal image capture method is simpler and more convenient, and the identification efficiency is improved.
Description
Technical field
The present invention relates to image recognition, particularly to a kind of mobile terminal image-capturing method.
Background technology
Quick Response Code has the advantages such as memory capacity is big, data type abundant, security and stability is high;So by extensively
General apply in a lot of industries.After mobile Internet gradually grows up, Quick Response Code is again at mobile Internet
In occupy critical role, the most much by the Mobile solution known to masses all with Quick Response Code scanning function,
The functions such as Quick Response Code is very easy in Mobile solution to inquire about, pays, download, the most deeply affect daily
Life.But Quick Response Code also has a series of relevant issues while gradually developing and promoting.Existing
In actually used, the environment residing for Quick Response Code is changeable: on electronic curtain, leaflet, outdoor advertising first-class,
Image in 2 D code collected for mobile device has many impacts, it is possible that distortion and uneven illumination
Etc. problem, may result in Quick Response Code cannot accurately identify.
Summary of the invention
For solving the problem existing for above-mentioned prior art, the present invention proposes a kind of mobile terminal image capturing
Method, including:
The position of detection Quick Response Code posting, positions the edge of posting, to determine the limit of Quick Response Code
Edge direction.
Preferably, described method also includes:
First Quick Response Code is carried out the scanning in horizontally and vertically both direction;Find possess posting with
Lower feature record, i.e. black and white block ratio are the region of predefined ratio;
Scan the region possessing posting feature obtained in the horizontal direction, the gray value in region is united
Meter;Select the pixel that a class value is minimum, calculate the equation apart from the closest straight line of this group pixel,
It is defined as the left hand edge direction of Quick Response Code;
Selecting the pixel that a class value is maximum, calculating organizes the equation of the closest straight line of pixel from this, really
It is set to the right hand edge direction of Quick Response Code;
In the region possessing posting feature that vertical direction scanning Quick Response Code obtains, the gray value to this region
Add up, select the pixel that a class value is minimum, calculate and organize the closest straight line of pixel from this
Equation, it is simply that the top edge direction of Quick Response Code;
Selecting the pixel that a class value is maximum, calculating from this equation organizing the closest straight line of pixel is exactly
The lower limb direction of Quick Response Code;
Concrete detecting step includes:
Step 1: the color of horizontal direction scanning first pixel of Quick Response Code record is W;
Step 2: continue to scan on, until finding the pixel that color be B different with W, records current face
Color is a length of LenA of the pixel point set of W;Continue to scan on until the pixel that color is W occurs again,
The length records recording the pixel point set that current color is B is LenB;
Step 3: judge the difference of LenA and LenB whether in the first error threshold, if not then returning
To the 2nd step, if it is forward the 4th step to;
Step 4: continue to scan on, until finding the pixel that color be B different with W, records current face
Color is a length of LenC of the pixel point set of W;
Step 5: judge LenC/3 and (LenA+LenB)/2 whether in the second error threshold, if not
Return to the 2nd step, if forwarding the 6th step to;
Step 6: continue to scan on, until finding the pixel that color be W different with B, records current face
Color is a length of LenD of the pixel point set of B;
Step 7: judge LenD and (LenA+LenB+LenC)/5 whether in the 3rd error threshold, if
It is not to revert to the 2nd step, if forwarding the 8th step to;
Step 8: continue to scan on, until finding the pixel that color be B different with W, records once
Color be the length records of the pixel point set of W be LenE;
Step 9: judge LenE and (LenA+LenB+LenC+LenD)/6 whether in the 4th error threshold,
If not returning to the 2nd step, if it is using LenA, LenB, LenC, LenD and LenE as symbol
Close the region of posting feature;
Wherein, horizontal sweep obtains all results area, the starting pixels point of posting field and termination picture
Vegetarian refreshments;Choose and terminate N number of pixel that pixel set intermediate value is maximum;According to known N number of pixel
Coordinate position (x1, y1), (x2, y2) ..., (xn, yn) make fitting a straight line y=kx+b, try to achieve k's and b
Value makes error sum of squares ∑ (yi-(kxi+b))2For minimum, then y=kx+b is exactly required linear equation.
The present invention compared to existing technology, has the advantage that
The present invention proposes a kind of mobile terminal image-capturing method, more simple and convenient compared to existing method,
Improve recognition efficiency.
Accompanying drawing explanation
Fig. 1 is the flow chart of mobile terminal image-capturing method according to embodiments of the present invention.
Detailed description of the invention
Hereafter provide one or more embodiment of the present invention together with the accompanying drawing of the diagram principle of the invention is detailed
Thin description.Describe the present invention in conjunction with such embodiment, but the invention is not restricted to any embodiment.This
Bright scope is limited only by the appended claims, and the present invention contains many replacements, amendment and equivalent.?
Middle elaboration many detail is described below to provide thorough understanding of the present invention.For exemplary purposes
And these details are provided, and can also be according to right without some in these details or all details
Claim realizes the present invention.
An aspect of of the present present invention provides a kind of mobile terminal image-capturing method.Fig. 1 is real according to the present invention
Execute the mobile terminal image-capturing method flow chart of example.
The present invention utilizes location and the sampling of a kind of mobile terminal capture image according to the own characteristic of Quick Response Code
Method, more simple and convenient relative to the rim detection of traditional method, to after geometric correction still with distortion
Quick Response Code is sampled, and improves recognition efficiency.
For Quick Response Code this self with the high symbol of feature and stability, it is possible to use two-dimensional code symbol
Feature detects.The detection method to posting location is utilized to come location, the edge to posting, so that it may
To obtain the edge direction of Quick Response Code.
First Quick Response Code is carried out the scanning in horizontally and vertically both direction;It is special that discovery possesses posting
Levying, black and white block ratio is the region of 1:1:3:1:1, records.Scanning Quick Response Code obtains in the horizontal direction
Possess the region of posting feature, the gray value in region is added up.Select the pixel that a class value is minimum,
Calculate the equation apart from this group closest straight line of pixel, it is simply that the left hand edge direction of Quick Response Code;With
Reason selects the pixel that a class value is maximum, and calculating is exactly two from this equation organizing the closest straight line of pixel
The right hand edge direction of dimension code.Then the region possessing posting feature obtained at vertical direction scanning Quick Response Code,
The gray value in this region is added up.Select the pixel that a class value is minimum, calculate and organize pixel from this
The equation of closest straight line, it is simply that the top edge direction of Quick Response Code;In like manner select the picture that a class value is maximum
Vegetarian refreshments, calculating is from the lower limb direction that this equation organizing the closest straight line of pixel is exactly Quick Response Code.
Concrete detecting step is as follows:
Step 1: the color of horizontal direction scanning first pixel of Quick Response Code record is W;
Step 2: continue to scan on, until finding the pixel that color be B different with W, records current face
Color is a length of LenA of the pixel point set of W;Continue to scan on until the pixel that color is W occurs again,
The length records recording the pixel point set that current color is B is LenB;
Step 3: judge the difference of LenA and LenB whether in the first error threshold, if not then returning
To the 2nd step, if it is forward the 4th step to;
Step 4: continue to scan on, until finding the pixel that color be B different with W, records current face
Color is a length of LenC of the pixel point set of W;
Step 5: judge LenC/3 and (LenA+LenB)/2 whether in the second error threshold, if not
Return to the 2nd step, if forwarding the 6th step to.
Step 6: continue to scan on, until finding the pixel that color be W different with B, records current face
Color is a length of LenD of the pixel point set of B;
Step 7: judge LenD and (LenA+LenB+LenC)/5 whether in the 3rd error threshold, if
It is not to revert to the 2nd step, if forwarding the 8th step to.
Step 8: continue to scan on, until finding the pixel that color be B different with W, records once
Color be the length records of the pixel point set of W be LenE;
Step 9: judge LenE and (LenA+LenB+LenC+LenD)/6 whether in the 4th error threshold,
If not returning to the 2nd step, if it is using LenA, LenB, LenC, LenD and LenE as symbol
Close the region of posting feature.
Horizontal sweep obtains all results area, the starting pixels point of posting field and termination pixel;Choose
Terminate N number of pixel that pixel set intermediate value is maximum, obtain apart from the shortest linear equation of N number of pixel
It it is exactly the right hand edge direction of Quick Response Code;N number of pixel that selected value is minimum from starting pixels point set,
It it is exactly the left hand edge direction of Quick Response Code to the linear equation the shortest apart from this N number of pixel;Vertical sweep time side
Method is identical with horizontal sweep method, can obtain top edge and the lower limb direction of Quick Response Code.
About the linear equation that the N number of pixel of computed range is the shortest, specifically, according to known N number of picture
Coordinate position (the x of vegetarian refreshments1, y1), (x2, y2) ..., (xn, yn) make fitting a straight line y=kx+b, try to achieve k
Error sum of squares ∑ (y is made with the value of bi-(kxi+b))2For minimum, then y=kx+b is exactly required linear equation.
Traditional Quick Response Code method of sampling, after geometric correction it is possible that wrong sampled value, this
Invention can obtain actual samples region according to compatibility in the ranks, samples this region.I.e. determining often
After occuring simultaneously in the actual samples region of a line and every string, carry out pixels statistics to determine the gray scale of final current block.
The calculating of the compatibility between pixel column is crucial, specifically comprises the following steps that
Step 1: from the beginning of the upper left angle point of Quick Response Code, scans every one-row pixels and is recorded as a function;
Step 2: start scanning from the first row and calculate, holds concurrently the function of row scanning with the function of adjacent rows
Content calculates.If compatibility is less than threshold value, forward the 4th step to.If compatibility is higher than threshold value, then adjoin
Row is defined as same row block.Continue to scan on, until occurring in that the compatibility of adjacent rows is less than threshold value, each
The width of individual row block is not less than 2.
Step 3: after obtaining the sample area of row block, forwards the 2nd step to, starts to calculate, directly from next line
To the sample area obtaining row block.
Step 4: if compatibility is less than threshold value, then adjacent rows is defined as being not belonging to same row block).Forward to
2nd step, starts to calculate from next line.
Step 5: image is carried out column scan according to identical process, obtains number and the sample area of row module.
Step 6: after obtaining the sample area of row and column, the block gray scales of statistics respective regions, according to
Monochrome pixels ratio determines the block gray scale in this region.
Definition Mat is the function compatibility with the function of row or column pixel of row or column pixel, definition
Mat=1/ (1+ ∑x|f(x,r)-g(x,r)|)
Wherein (x, r) is the function of r row to f, and (x r) is the function of r-1 row to g.The biggest two the function compatibility of Mat
The highest, it is meant that two row pixels are the biggest may belong to same row block.According to the Mat in sampled result
Big value and minima carry out decision threshold.
After two-dimension code area is accurately positioned, will be decoded, main point of Quick Response Code of the present invention decoding
Obtain Quick Response Code width for scanning, determine Quick Response Code direction, identify two-dimensional code data.The present invention does not process whole
Individual two-dimension code area, only processes the data in limited bar scan line.Algorithm mainly divides following several step.
(1) in regioselective scanning process, the longest scan line.Length by this scan line Yu two-dimension code area
Compare.If in the difference of this scan line and two-dimension code area length in the range of minimum unit width, then
Determine that this scan line is the scan line that can scan the whole unit of Quick Response Code.Otherwise, then it is assumed that this scan line
The whole unit of Quick Response Code can not be scanned, need to determine one group in two dimension according to four summits of two-dimension code area
Parallel scan lines in code region, thus can avoid Quick Response Code damaged, the situation of scanning mistake.
(2) in scanning process, the scanning number using bilinearity difference arithmetic acquisition scanning step to be a pixel
According to, represent by array line [n], the wherein length of n scan line.
Gray value in array line is judged.If the XOR value of a point and its subsequent point is 1, this
Individual point is taken as marginal point, if the gray value of this point is 1, is stored in array wb [w], if the ash of this point
Angle value is 0 and is stored in array bw [m].Gaussian filter in Susan operator is sized to 1.Writing edge
Edge point place pixel index position in line [n] array, is i.e. marginal point phase para-position in scan line
Put.Positive and negative according to first derivative will be stored in array to white marginal point respectively by white to black and by black
In wb [m], bw [m].Therefore first point of wb [m] is the starting point of scan line, last point of bw [m]
It should be the terminating point of scan line.
After obtaining the marginal point pressing all bars that scanning sequency arranges position in scan line, can according to following formula
Obtaining the width in all continuous homochromy regions in Quick Response Code, cross arrangement bar and sky are complete two dimensions in order
The continuous homochromy zone width information of code
wwide[m]=wb [m+1]-bw [m]
bwide[m]=bw [m]-wb [m]
The narrowest cell width is considered as the width of a module, according to below equation, unit is designated as difference
Regularization value { 1,2,3,4}.
1.6S>7biThen Bi=1;
1.6S<7bi< 2.6S then Bi=2;
2.6S>7bi< 3.6S then Bi=3;
3.6S<7biThen Bi=4;
biFor the width of i-th unit, BiFor corresponding regularization value.Obtain root after continuous homochromy area arrangement
It is decoded according to the coding schedule of PDF417.
In sum, the present invention proposes a kind of mobile terminal image-capturing method, compared to existing method more
Simple and convenient, improve recognition efficiency.
Obviously, it should be appreciated by those skilled in the art, each module or each step of the above-mentioned present invention are permissible
Realizing by general calculating system, they can concentrate in single calculating system, or is distributed in many
On the network that individual calculating system is formed, alternatively, they can use the executable program code of calculating system
Realize, it is thus possible to be stored in storage system being performed by calculating system.So, this
Bright be not restricted to any specific hardware and software combine.
It should be appreciated that the above-mentioned detailed description of the invention of the present invention is used only for exemplary illustration or explains this
The principle of invention, and be not construed as limiting the invention.Therefore, without departing from the spirit and scope of the present invention
In the case of any modification, equivalent substitution and improvement etc. done, should be included in protection scope of the present invention
Within.Additionally, claims of the present invention be intended to fall into scope and edge or
Whole in the equivalents at this scope of person and edge change and modifications example.
Claims (2)
1. a mobile terminal image-capturing method, positions Quick Response Code for mobile terminal, its feature
It is, including:
The position of detection Quick Response Code posting, positions the edge of posting, to determine the limit of Quick Response Code
Edge direction.
Method the most according to claim 1, it is characterised in that described method also includes:
First Quick Response Code is carried out the scanning in horizontally and vertically both direction;Find possess posting with
Lower feature record, i.e. black and white block ratio are the region of predefined ratio;
Scan the region possessing posting feature obtained in the horizontal direction, the gray value in region is united
Meter;Select the pixel that a class value is minimum, calculate the equation apart from the closest straight line of this group pixel,
It is defined as the left hand edge direction of Quick Response Code;
Selecting the pixel that a class value is maximum, calculating organizes the equation of the closest straight line of pixel from this, really
It is set to the right hand edge direction of Quick Response Code;
In the region possessing posting feature that vertical direction scanning Quick Response Code obtains, the gray value to this region
Add up, select the pixel that a class value is minimum, calculate and organize the closest straight line of pixel from this
Equation, it is simply that the top edge direction of Quick Response Code;
Selecting the pixel that a class value is maximum, calculating from this equation organizing the closest straight line of pixel is exactly
The lower limb direction of Quick Response Code;
Concrete detecting step includes:
Step 1: the color of horizontal direction scanning first pixel of Quick Response Code record is W;
Step 2: continue to scan on, until finding the pixel that color be B different with W, records current face
Color is a length of LenA of the pixel point set of W;Continue to scan on until the pixel that color is W occurs again,
The length records recording the pixel point set that current color is B is LenB;
Step 3: judge the difference of LenA and LenB whether in the first error threshold, if not then returning
To the 2nd step, if it is forward the 4th step to;
Step 4: continue to scan on, until finding the pixel that color be B different with W, records current face
Color is a length of LenC of the pixel point set of W;
Step 5: judge LenC/3 and (LenA+LenB)/2 whether in the second error threshold, if not
Return to the 2nd step, if forwarding the 6th step to;
Step 6: continue to scan on, until finding the pixel that color be W different with B, records current face
Color is a length of LenD of the pixel point set of B;
Step 7: judge LenD and (LenA+LenB+LenC)/5 whether in the 3rd error threshold, if
It is not to revert to the 2nd step, if forwarding the 8th step to;
Step 8: continue to scan on, until finding the pixel that color be B different with W, records once
Color be the length records of the pixel point set of W be LenE;
Step 9: judge LenE and (LenA+LenB+LenC+LenD)/6 whether in the 4th error threshold,
If not returning to the 2nd step, if it is using LenA, LenB, LenC, LenD and LenE as symbol
Close the region of posting feature;
Wherein, horizontal sweep obtains all results area, the starting pixels point of posting field and termination picture
Vegetarian refreshments;Choose and terminate N number of pixel that pixel set intermediate value is maximum;According to known N number of pixel
Coordinate position (x1, y1), (x2, y2) ..., (xn, yn) make fitting a straight line y=kx+b, try to achieve k's and b
Value makes error sum of squares ∑ (yi-(kxi+b))2For minimum, then y=kx+b is exactly required linear equation.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610333214.XA CN106022203A (en) | 2016-05-19 | 2016-05-19 | Mobile terminal image capture method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610333214.XA CN106022203A (en) | 2016-05-19 | 2016-05-19 | Mobile terminal image capture method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106022203A true CN106022203A (en) | 2016-10-12 |
Family
ID=57097799
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610333214.XA Pending CN106022203A (en) | 2016-05-19 | 2016-05-19 | Mobile terminal image capture method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106022203A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111507120A (en) * | 2019-01-31 | 2020-08-07 | 北京骑胜科技有限公司 | Two-dimensional code positioning frame identification method and device, electronic equipment and storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102136058A (en) * | 2011-04-26 | 2011-07-27 | 中国农业大学 | Bar code image identification method |
-
2016
- 2016-05-19 CN CN201610333214.XA patent/CN106022203A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102136058A (en) * | 2011-04-26 | 2011-07-27 | 中国农业大学 | Bar code image identification method |
Non-Patent Citations (1)
Title |
---|
宋贤媛: "快速响应码识别技术的研究", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111507120A (en) * | 2019-01-31 | 2020-08-07 | 北京骑胜科技有限公司 | Two-dimensional code positioning frame identification method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106169080B (en) | A kind of combustion gas index automatic identifying method based on image | |
US8505823B2 (en) | Noise removal from color barcode images | |
RU2573255C2 (en) | Method and system for determining colour from image | |
CN101650783B (en) | Image identification method and imaging apparatus | |
CN110599548A (en) | Camera calibration method and device, camera and computer readable storage medium | |
CN101248454B (en) | Image processing method and image processor, digital camera equipment, and recording medium with image processing program stored thereon | |
US8469274B2 (en) | Method for fast locating decipherable pattern | |
US20140314320A1 (en) | Apparatus and method for automatically recognizing a qr code | |
US20100008568A1 (en) | Method for classifying a digital image | |
US20110297748A1 (en) | Method and portable apparatus for recognizing bar codes | |
CN110493595B (en) | Camera detection method and device, storage medium and electronic device | |
TW201113815A (en) | QR code processing method and apparatus thereof | |
KR20070114648A (en) | The two-directional bar code symbol and its encoding and decoding method | |
CN105308944A (en) | Classifying objects in images using mobile devices | |
CN106056021A (en) | Hue-based volume-flexible color two-dimensional code stream data communication method and system | |
CN105512598A (en) | Adaptive matching identification method of QR code image sampling | |
CN111209870A (en) | Binocular living body camera rapid registration method, system and device thereof | |
CN111724354B (en) | Image processing-based method for measuring wheat ear length and wheat ear number of multiple wheat plants | |
CN104484679B (en) | Non- standard rifle shooting warhead mark image automatic identifying method | |
CN108898597B (en) | Method for identifying painting and calligraphy based on smart phone | |
CN106022203A (en) | Mobile terminal image capture method | |
CN106022190A (en) | Image scanning method for mobile phone client | |
CN110084269A (en) | Characteristics of image optimization method based on cloud computing | |
CN109146834A (en) | Car damage identification method and device, computer readable storage medium, terminal | |
CN110472085A (en) | 3-D image searching method, system, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20161012 |
|
RJ01 | Rejection of invention patent application after publication |