CN109918961A - A kind of bar code localization method based on characteristics of image - Google Patents
A kind of bar code localization method based on characteristics of image Download PDFInfo
- Publication number
- CN109918961A CN109918961A CN201910129971.9A CN201910129971A CN109918961A CN 109918961 A CN109918961 A CN 109918961A CN 201910129971 A CN201910129971 A CN 201910129971A CN 109918961 A CN109918961 A CN 109918961A
- Authority
- CN
- China
- Prior art keywords
- image
- bar code
- text field
- barcode
- pixel
- 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.)
- Granted
Links
Landscapes
- Character Input (AREA)
- Image Analysis (AREA)
- Character Discrimination (AREA)
Abstract
The invention discloses a kind of bar code localization method based on characteristics of image, comprising: obtain image and pre-processing simultaneously is carried out to image, obtain binary image;The height and length of binary image are divided, image I is obtained2;Abstract image I2In the part containing character content and to the part carry out gradient judgement;To after correction or not needing the image of correction and point sampling such as carry out, lateral the barcode size or text field is found out;The judgement of black and white continuity is carried out to longitudinal the barcode size or text field, Barcode Length required for intercepting out;According to lateral the barcode size or text field and Barcode Length, the barcode size or text field in image is determined.The present invention can position under label or the inclined situation of image containing bar code.The morphological feature that the present invention takes full advantage of bar code by way of being similar to sampling improves much in speed compared with some other method to judge image.
Description
Technical field
The present invention relates to field of image processing more particularly to a kind of bar code localization methods based on characteristics of image.
Background technique
Bar code (barcode) is the multiple secret notes and blank for not waiting width, is arranged according to certain coding rule, is used
To express the graphical identifier of a group information.Bar code is automatic identification mode the most economical and the most practical up to now, is had defeated
The advantages that entering fast speed, high reliablity, informative and flexibly using, and since the production of bar coded sticker is simple, make
Cost of manufacture ten/low.Although bar code is only comprising a certain number of numbers and alphabetical information, by the above character structure
At various information be all widely used in many fields such as commodity circulation, taking care of books, postal management, banking system.
The identification of bar code, be most widely used now or scanning bar code, passes through the photoelectric conversion inside scanner
Device converts optical signals to electric signal (pulse digital signal), to read bar code.Also there are many by the processing to image come
The method for obtaining bar code region, including region unit, the methods of edge detection.But since above method is intended to own image
Pixel is calculated, so comparable slow in processing speed, occasion higher for requirement of real-time is simultaneously not suitable for.
What the judgement about image rotation was substantially obtained by edge detection, existing various detection methods include
Sobel edge detection, gradient direction detection, canny edge detection, converted there are also more commonly used hough etc., it is rotated in processing
Upper basic effect be it is more satisfactory, exactly there is the slower this problem of speed, especially when image is larger, deal with time-consuming
It is too long.
Summary of the invention
The purpose of the present invention is to provide a kind of bar code localization method based on characteristics of image.The present invention is mentioned by sampling
The method of feature is taken to position to the image containing bar code, to search out the information of required bar code in the picture.
The feature abstracted has the characteristics that data volume is small, clear simple, so that practical calculation amount reduces, processing speed is accelerated.
The purpose of the present invention can be achieved through the following technical solutions:
A kind of bar code localization method based on characteristics of image, specific steps include:
It obtains the image containing bar code and image is handled, obtain binary image;
Height and length to binary image divide respectively, obtain image I2;
Abstract image I2In the part containing character content and to the part carry out gradient judgement;If Sampled portions exist
Gradient then carries out deflection correction to full images;
To after correction or not needing the image of correction and point sampling such as carry out, qualified pixel number is taken out according to progress
Analysis, finds out lateral the barcode size or text field;
The judgement of black and white continuity is carried out to longitudinal the barcode size or text field, Barcode Length required for intercepting out;
According to lateral the barcode size or text field and Barcode Length, the barcode size or text field in image is determined.
Specifically, threshold process is carried out to the image of acquisition, the pixel point value of obtained binary image is 0 or 1.
Specifically, in the step of height and length to binary image divides respectively, division methods are as follows:
M equal part is carried out to the height of obtained binary image, chooses continuous m row in image treated pixel
Value, i.e. a1,a2,…,am;Wherein ai=ia, i=1,2 ..., m, a are the value of every equal part height in the partial images such as M.To selection m
Capable pixel carries out transformation judgement, the i.e. number of record black and white exchange, finds out the most a line a of number of transitionsi, then take aiIt arrives
ai+1Whole pixels in section, are denoted as image I1。
To image I1Length carry out N equal part, choose continuous n row in image treated the value of pixel, i.e. b1,
b2,…,bn;Wherein bj=jb, j=1,2 ..., n, b are the value of every equal part height in the partial images such as N.To the pixel for choosing n column
Transformation judgement is carried out, the most column b of number of transitions is found outj, then in image I1In take bjTo bj+1Whole pixels in section, are obtained
Obtain image I2。
Further, for the selection of MN, a, b generally take the 1/10 of initial binary picture altitude and length respectively;
MN can be equal.
Specifically, the abstract image I2In the part containing character content and to the part carry out gradient judgement step
In rapid, by image I2Carrying out Hough transform judges image with the presence or absence of inclination.Inclination angle is then obtained if there is inclination
It spends and full images is corrected, I is obtained after image flame detectionmn。
Specifically, it after described pair of correction or does not need the image of correction and point sampling such as carries out, take out qualified picture
In the step of vegetarian refreshments data are analyzed, and lateral the barcode size or text field is found out, lateral the barcode size or text field method is found out are as follows:
Image ImnHeight carry out P equal part, choose continuous p row in image treated the value of pixel, i.e. c1,
c2,…,cp;Wherein ck=kc, k=1,2 ..., p, c are the value of every equal part height in the partial images such as P.To pixel in p row by
0 becomes 1, or becomes 0 number from 1 and recorded, according to the choosing value of c, if having the number of transitions of continuous k row close, i.e., not
More than the 1/5 of the total number of transitions of bar code, then c is taken outpTo cp+k-1, as image Ip。
The pixel number of p row is taken out according to being analyzed, by the morphological feature of bar code, to look in word content
Bar code transverse area.
Further, the c generally takes the 1/10 of initial binary picture altitude;
The morphological feature of the bar code are as follows: because for the image containing text, no matter the upright bar code put
How much is width, and the content of expression is identical, so c is selected as initial binary image when dividing the image into contour small image
The 1/10 of height, which ensures that, can be truncated to the image that continuous multirow contains bar code, so continuous multirow can directly determine
For the barcode size or text field.
Specifically, the black and white continuity judgment method are as follows: the case where record pixel is continuously 0 or 1 is found out continuous
For the origin coordinates and end coordinate of same value, facilitates and calculate continuous length.
Specifically, described according to lateral the barcode size or text field and Barcode Length, determine the step of the barcode size or text field in image
In rapid, the method that determines the barcode size or text field in image are as follows:
From image IpThe coordinate of the middle pixel for becoming 1 or 1 change 0 by 0 for obtaining every a line, by the coordinate record of every a line
Get off, the coordinate of coordinate and every a line to acquisition compares, and removes the different part of coordinate, then can get complete item
Shape code region Ib。
Since longitudinal content of bar code is identical, so in image IpOn the basis of, if pixel has 0 to 1 or 1
The difference shifted one's position to 0 then illustrates it is not the barcode size or text field, gets rid of these regions, reservation is the barcode size or text field.
The present invention compared to the prior art, have it is below the utility model has the advantages that
1, present invention utilizes the feature that the figure of bar code is rectangle, the angle of image is corrected, has and searches
Quickly and efficiently the advantages of rate.
2, the identical feature in any situation of width of longitudinal content according to bar code of the invention, it is wide using sampling
The method of degree detection the barcode size or text field, the method principle is simple and can fast implement, and in the image containing text, is not required to
The region that fast selecting bar code is capable of in other processing is carried out to text.
Detailed description of the invention
Fig. 1 is the specific flow chart of the bar code localization method based on characteristics of image in the present invention;
Fig. 2 is that the bar code in the present invention based on characteristics of image extracts the schematic diagram containing character content part;
Fig. 3 is the schematic diagram positioned in the present invention to the bar code based on characteristics of image.
Specific embodiment
Present invention will now be described in further detail with reference to the embodiments and the accompanying drawings, but embodiments of the present invention are unlimited
In this.
Embodiment
It is as shown in Figure 1 a kind of flow chart of bar code localization method based on characteristics of image, specific steps include:
(1) it obtains the image containing bar code and image is handled, obtain binary image;
(2) height of binary image and length are divided respectively, obtains image I2;
Specifically, threshold process is carried out to the image of acquisition, the pixel point value of obtained binary image is 0 or 1.
(3) abstract image I2In the part containing character content and to the part carry out gradient judgement;If Sampled portions
There are gradients, then carry out deflection correction to full images;
Specifically, in the step of height and length to binary image divides respectively, division methods are as follows:
M equal part is carried out to the height of obtained binary image, chooses continuous m row in image treated pixel
Value, i.e. a1,a2,…,am;Wherein ai=ia, i=1,2 ..., m, a are the value of every equal part height in the partial images such as M.To selection m
Capable pixel carries out transformation judgement, the i.e. number of record black and white exchange, finds out the most a line a of number of transitionsi, then take aiIt arrives
ai+1Whole pixels in section, are denoted as image I1。
To image I1Length carry out N equal part, choose continuous n row in image treated the value of pixel, i.e. b1,
b2,…,bn;Wherein bj=jb, j=1,2 ..., n, b are the value of every equal part height in the partial images such as N.To the pixel for choosing n column
Transformation judgement is carried out, the most column b of number of transitions is found outj, then in image I1In take bjTo bj+1Whole pixels in section, are obtained
Obtain image I2, image I2As shown in Figure 2.
Further, for the selection of MN, a, b generally take the 1/10 of initial binary picture altitude and length respectively;
MN can be equal.
(4) to after correction or not needing the image of correction and point sampling such as carry out, qualified pixel number evidence is taken out
It is analyzed, finds out lateral the barcode size or text field;
Specifically, the abstract image I2In the part containing character content and to the part carry out gradient judgement step
In rapid, by image I2Carrying out Hough transform judges image with the presence or absence of inclination.Inclination angle is then obtained if there is inclination
It spends and full images is corrected, I is obtained after image flame detectionmn。
Further, small as far as possible in order to make to handle data, to guarantee image I while making M, N big as far as possible2Middle energy
Inclination angle is enough told, therefore needs to be adjusted according to different situations in the selection of M, N.
(5) judgement of black and white continuity is carried out to longitudinal the barcode size or text field, Barcode Length required for intercepting out;
Specifically, lateral the barcode size or text field method is found out are as follows:
Image ImnHeight carry out P equal part, take p row in image treated the value of pixel, i.e. c1,c2,…,cp;Its
Middle ck=kc, k=1,2 ..., p, c are the value of every equal part height in the partial images such as P.Pixel is by 0 after carrying out two-value to p row
Become 1, or become 0 number record from 1, according to the choosing value of c (, if there is the number of transitions of continuous k row close, that is, be not more than
The 1/5 of the total number of transitions of bar code, then take out cpTo cp+k-1, as image Ip。
The pixel number of p row is taken out according to being analyzed, by the morphological feature of bar code, to look in word content
Bar code transverse area.The judgement of black and white continuity is carried out to longitudinal, thus bar code length required for intercepting out.
Further, the c generally takes the 1/10 of initial binary picture altitude;
The morphological feature of the bar code are as follows: because for the image containing text, no matter the upright bar code put
How much is width, and the content of expression is identical, so c is selected as initial binary image when dividing the image into contour small image
The 1/10 of height, which ensures that, can be truncated to the image that continuous multirow contains bar code, so continuous multirow can directly determine
For the barcode size or text field.
(6) according to lateral the barcode size or text field and Barcode Length, the barcode size or text field in image is determined.
Specifically, it is determined that the barcode size or text field method in image are as follows:
From image IpThe coordinate of the middle pixel for becoming 1 or 1 change 0 by 0 for obtaining every a line, by the coordinate record of every a line
Get off, the coordinate of coordinate and every a line to acquisition compares, and removes the different part of coordinate.It then can get complete item
Shape code region Ib, the barcode size or text field I of acquisitionbAs shown in Figure 3.
Since longitudinal content of bar code is identical, so in image IpOn the basis of, if pixel has 0 to 1 or 1
The difference shifted one's position to 0 then illustrates it is not the barcode size or text field, gets rid of these regions, reservation is the barcode size or text field.
The above embodiment is a preferred embodiment of the present invention, but embodiments of the present invention are not by above-described embodiment
Limitation, other any changes, modifications, substitutions, combinations, simplifications made without departing from the spirit and principles of the present invention,
It should be equivalent substitute mode, be included within the scope of the present invention.
Claims (9)
1. a kind of bar code localization method based on characteristics of image, which is characterized in that the specific steps of the method include:
It obtains the image containing bar code and image is handled, obtain binary image;
Height and length to binary image divide respectively, obtain image I2;
Abstract image I2In the part containing character content and to the part carry out gradient judgement;If there is inclination in Sampled portions
Degree, then carry out deflection correction to full images;
To after correction or not needing the image of correction and point sampling such as carry out, qualified pixel number is taken out according to being divided
Analysis, finds out lateral the barcode size or text field;
The judgement of black and white continuity is carried out to longitudinal the barcode size or text field, Barcode Length required for intercepting out;
According to lateral the barcode size or text field and Barcode Length, the barcode size or text field in image is determined.
2. a kind of bar code localization method based on characteristics of image according to claim 1, which is characterized in that acquisition
Image carries out threshold process, and the pixel point value of obtained binary image is 0 or 1.
3. a kind of bar code localization method based on characteristics of image according to claim 1, which is characterized in that described to two
In the step of height and length of value image are divided respectively, division methods are as follows:
M equal part is carried out to the height of obtained binary image, chooses continuous m row in image treated the value of pixel, i.e.,
a1,a2,…,am;Wherein ai=ia, i=1,2 ..., m, a are the value of every equal part height in the partial images such as M;To selection m row
Pixel carries out transformation judgement, the i.e. number of record black and white exchange, finds out the most a line a of number of transitionsi, then take aiTo ai+1Area
Between whole pixels, be denoted as image I1;
To image I1Length carry out N equal part, choose continuous n row in image treated the value of pixel, i.e. b1,b2,…,bn;
Wherein bj=jb, j=1,2 ..., n, b are the value of every equal part height in the partial images such as N;The pixel for choosing n column is converted
The most column b of number of transitions is found out in judgementj, then in image I1In take bjTo bj+1Whole pixels in section obtain image
I2。
4. a kind of bar code localization method based on characteristics of image according to claim 3, which is characterized in that for MN's
It chooses, a, b generally take the 1/10 of initial binary picture altitude and length respectively;MN can be equal.
5. a kind of bar code localization method based on characteristics of image according to claim 1, which is characterized in that the extraction
Image I2In the part containing character content and to the part carry out gradient judgement the step of in, by image I2It carries out
Hough transform judges image with the presence or absence of inclination;Tilt angle is then obtained if there is inclination and full images are corrected,
I is obtained after image flame detectionmn。
6. a kind of bar code localization method based on characteristics of image according to claim 1, which is characterized in that described pair is rectified
It after just or does not need the image of correction and point sampling such as carries out, take out qualified pixel number according to being analyzed, find out cross
To the barcode size or text field the step of in, find out lateral the barcode size or text field method are as follows:
Image ImnHeight carry out P equal part, take p row in image treated the value of pixel, i.e. c1,c2,…,cp;Wherein ck
=kc, k=1,2 ..., p, c are the value of every equal part height in the partial images such as P;Pixel after p row progress two-value is become from 0
1, or become 0 number record from 1, according to the choosing value of c, if there is the number of transitions of continuous k row close, i.e. not more than bar code
The 1/5 of total number of transitions, then take out cpTo cp+k-1, as image Ip。
7. a kind of bar code localization method based on characteristics of image according to claim 6, which is characterized in that the c mono-
As take the 1/10 of initial binary picture altitude.
8. a kind of bar code localization method based on characteristics of image according to claim 1, which is characterized in that described pair vertical
In the step of carrying out the judgement of black and white continuity to the barcode size or text field, intercept out required Barcode Length, black and white continuity is sentenced
Disconnected method are as follows: the case where record pixel is continuously 0 or 1 finds out continuous origin coordinates and end coordinate for same value.
9. a kind of bar code localization method based on characteristics of image according to claim 1, which is characterized in that the basis
Lateral the barcode size or text field and Barcode Length determine bar code area in image in the step of determining the barcode size or text field in image
The method in domain are as follows:
From image IpThe coordinate of the middle pixel for becoming 1 or 1 change 0 by 0 for obtaining every a line, the coordinate record of every a line is got off,
The coordinate of coordinate and every a line to acquisition compares, and removes the different part of coordinate;It then can get complete bar code
Region Ib。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910129971.9A CN109918961B (en) | 2019-02-21 | 2019-02-21 | Barcode positioning method based on image characteristics |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910129971.9A CN109918961B (en) | 2019-02-21 | 2019-02-21 | Barcode positioning method based on image characteristics |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109918961A true CN109918961A (en) | 2019-06-21 |
CN109918961B CN109918961B (en) | 2021-03-30 |
Family
ID=66962102
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910129971.9A Active CN109918961B (en) | 2019-02-21 | 2019-02-21 | Barcode positioning method based on image characteristics |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109918961B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4219152A (en) * | 1979-02-21 | 1980-08-26 | International Business Machines Corporation | Dual threshold comparator circuit |
WO1999010866A1 (en) * | 1997-08-25 | 1999-03-04 | Imagicolor Corp | A system for distributing and controlling color reproduction at multiple sites |
US5925868A (en) * | 1993-05-07 | 1999-07-20 | Spectra-Physics Scanning Systems, Inc. | Method and apparatus for determining transitions between relatively high and low levels in an input signal |
JP2009181219A (en) * | 2008-01-29 | 2009-08-13 | Toshiba Tec Corp | Bar code reader and its method |
CN101882204A (en) * | 2010-06-01 | 2010-11-10 | 福建新大陆电脑股份有限公司 | Matrix type two-dimensional bar code searching method |
CN102279922A (en) * | 2010-06-12 | 2011-12-14 | 晨星软件研发(深圳)有限公司 | Bar code image recognition system applied to handheld device and relevant method |
CN107908996A (en) * | 2017-10-25 | 2018-04-13 | 福建联迪商用设备有限公司 | A kind of method and terminal for extracting bar code information |
CN108256375A (en) * | 2018-01-10 | 2018-07-06 | 诺为信科技有限公司 | A kind of one-dimensional bar code scan method |
CN109101854A (en) * | 2018-06-25 | 2018-12-28 | 华南理工大学 | A kind of multiple barcode localization method |
-
2019
- 2019-02-21 CN CN201910129971.9A patent/CN109918961B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4219152A (en) * | 1979-02-21 | 1980-08-26 | International Business Machines Corporation | Dual threshold comparator circuit |
US5925868A (en) * | 1993-05-07 | 1999-07-20 | Spectra-Physics Scanning Systems, Inc. | Method and apparatus for determining transitions between relatively high and low levels in an input signal |
WO1999010866A1 (en) * | 1997-08-25 | 1999-03-04 | Imagicolor Corp | A system for distributing and controlling color reproduction at multiple sites |
JP2009181219A (en) * | 2008-01-29 | 2009-08-13 | Toshiba Tec Corp | Bar code reader and its method |
CN101882204A (en) * | 2010-06-01 | 2010-11-10 | 福建新大陆电脑股份有限公司 | Matrix type two-dimensional bar code searching method |
CN102279922A (en) * | 2010-06-12 | 2011-12-14 | 晨星软件研发(深圳)有限公司 | Bar code image recognition system applied to handheld device and relevant method |
CN107908996A (en) * | 2017-10-25 | 2018-04-13 | 福建联迪商用设备有限公司 | A kind of method and terminal for extracting bar code information |
CN108256375A (en) * | 2018-01-10 | 2018-07-06 | 诺为信科技有限公司 | A kind of one-dimensional bar code scan method |
CN109101854A (en) * | 2018-06-25 | 2018-12-28 | 华南理工大学 | A kind of multiple barcode localization method |
Non-Patent Citations (1)
Title |
---|
冯国文: "基于SVM的复杂背景条码检测算法研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Also Published As
Publication number | Publication date |
---|---|
CN109918961B (en) | 2021-03-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101533474B (en) | Character and image recognition system based on video image and method thereof | |
Dave | Segmentation methods for hand written character recognition | |
CN106875546B (en) | A kind of recognition methods of VAT invoice | |
CN104298982B (en) | A kind of character recognition method and device | |
CN106570510B (en) | A kind of supermarket's commodity recognition method | |
LeBourgeois | Robust multifont OCR system from gray level images | |
CN102542268B (en) | Method for detecting and positioning text area in video | |
CN101763516B (en) | Character recognition method based on fitting functions | |
CN110287952B (en) | Method and system for recognizing characters of dimension picture | |
CN110309746A (en) | High-grade information security area list data information extracting method without communication interconnection | |
CN102193918B (en) | Video retrieval method and device | |
CN114155527A (en) | Scene text recognition method and device | |
CN110334760B (en) | Optical component damage detection method and system based on RESUnet | |
CN101365072A (en) | Subtitle region extracting device and method | |
CN102663378A (en) | Method for indentifying joined-up handwritten characters | |
US7980473B2 (en) | Camera based code reading | |
CN105868724B (en) | A kind of two-dimension bar code recognition method and system based on connected domain | |
CN103606220A (en) | Check printed number recognition system and check printed number recognition method based on white light image and infrared image | |
CN106845513A (en) | Staff detector and method based on condition random forest | |
CN112861736B (en) | Document table content identification and information extraction method based on image processing | |
JPS63182793A (en) | Character segmenting system | |
CN113643274B (en) | Method and device for screening two-dimensional code candidate areas | |
CN111414908B (en) | Method and device for recognizing caption characters in video | |
CN109918961A (en) | A kind of bar code localization method based on characteristics of image | |
Seeri et al. | A novel approach for Kannada text extraction |
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 | ||
TR01 | Transfer of patent right |
Effective date of registration: 20230625 Address after: 510000 Room 104, 105, and 106, Building 5, No. 539 Shibei Industrial Road, Dashi Street, Guangzhou, Guangdong Province Patentee after: Guangzhou Chaers Medical Technology Co.,Ltd. Address before: 510640 No. five, 381 mountain road, Guangzhou, Guangdong, Tianhe District Patentee before: SOUTH CHINA University OF TECHNOLOGY |
|
TR01 | Transfer of patent right |