CN103942762A - Two-dimension code preprocessing method and device - Google Patents

Two-dimension code preprocessing method and device Download PDF

Info

Publication number
CN103942762A
CN103942762A CN201410169579.4A CN201410169579A CN103942762A CN 103942762 A CN103942762 A CN 103942762A CN 201410169579 A CN201410169579 A CN 201410169579A CN 103942762 A CN103942762 A CN 103942762A
Authority
CN
China
Prior art keywords
pixel
image
pretreated
quick response
carried
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201410169579.4A
Other languages
Chinese (zh)
Inventor
胡建国
Original Assignee
胡建国
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 胡建国 filed Critical 胡建国
Priority to CN201410169579.4A priority Critical patent/CN103942762A/en
Publication of CN103942762A publication Critical patent/CN103942762A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a two-dimension code preprocessing method which comprises the following steps of luminance equalization: performing self-adaptation brightness equalization processing on the captured images to remove a too faint part and a too bright part in each image; binarization processing: performing binarization processing on the images subjected to the self-adaptation brightness equalization processing through an Otsu's method. The invention further discloses a two-dimension code preprocessing device which comprises a luminance equalization processing module for performing self-adaptation brightness equalization processing on the captured images to remove the too faint part and the too bright part in each image and a binarization processing module for performing binarization processing on the images subjected to the self-adaptation brightness equalization processing through the Otsu's method. By means of the two-dimension code preprocessing method and device, effect caused by uneven illumination in the bar code images is eliminated effectively, binarization can be performed on the bar code images with uneven illumination correctively, and the recognition rate of two-dimension codes is increased.

Description

A kind of pretreated method of Quick Response Code and device thereof
Technical field
The present invention relates to planar bar code technology field, be specifically related to a kind of pretreated method of Quick Response Code and device thereof.
Background technology
Quick Response Code (2-dimensional bar code) is the chequered with black and white figure that specific geometric figure is distributed in the plane according to certain rule, and it is a kind of information of data symbol.Quick Response Code has a lot of significant advantages, and its density of encoding is high, and information capacity is large, and coding range is wide, and error correcting capability is strong, easily make, and cost of manufacture is low.Due to more than, Quick Response Code a lot of fields in life are widely used, and as logistics, health care, traffic, produce etc.
Image-type reader conventionally can comprise to come in the time gathering two-dimensional bar code together with irrelevant to bar code and other background information, makes the information in photo very complicated.And due to shooting angle and other reasons, bar code often there will be inclination and the noise of certain angle in photo, the image of two-dimensional bar code is extracted and produced very large impact.At this moment, just need to utilize multiple image processing method to reduce to disturb, improve picture quality.Need to retain on the one hand the useful part information of image, remove on the other hand bar code garbage in addition as far as possible, only have the image pre-service of working as to obtain higher picture quality, follow-up could decoding accurately to it, image pre-service link is key one ring of bar-code identification, directly determine bar-code identification rate and recognition speed, so, the research great majority of two-dimensional bar code are all concentrated in the pre-service of two-dimensional bar code.
Fig. 1 shows the pretreated method flow diagram of existing Quick Response Code, includes the steps such as image acquisition, gray processing processing, medium filtering, illumination equilibrium, binaryzation, rim detection, transverse and longitudinal detection, preliminary extraction.When taking the mode of taking to obtain after the image of Quick Response Code, because obtained image contains too much Pixel Information, increase the time of routine processes.The effective information that two-dimensional bar code can obtain in actual extracting process from image only has two: the positional information of pixel and colouring information, equipment can be regarded as for wherein differentiation and the differentiation of black, white two kinds of colors for the leaching process of image in 2 D code, the object of gray processing reduces irrelevant information amount exactly, raises the efficiency.The effect of medium filtering is to reduce the impact of salt-pepper noise for image.
For the easier geometric properties that obtains target area in two-dimensional barcode image, need to carry out binary conversion treatment to two-dimensional bar code, become black-and-white two color.Otsu algorithm in existing binary conversion treatment has good segmentation effect to the uniform picture of illumination.But while shooting; because often can causing the image photographing, the uncertainty of light source there is the phenomenon of uneven illumination; brighter over there near light source in image; another side is darker; follow-up image binaryzation processing is produced serious influence; cause in whole preprocessing process and can not carry out correct binary conversion treatment to the bar code image of uneven illumination, reduced the discrimination of two-dimensional bar code.
Summary of the invention
For deficiency of the prior art, for can not well carrying out binary conversion treatment accurately to bar code image in binary conversion treatment, the embodiment of the present invention provides a kind of pretreated method of Quick Response Code and device thereof, a kind of adaption brightness equalization algorithm is provided, has effectively eliminated the impact that in bar code image, uneven illumination brings.
The invention provides a kind of pretreated method of Quick Response Code, comprise the steps:
In the step of illumination equilibrium, the picture collecting is carried out to adaption brightness equilibrium treatment, remove in image and cross secretly and excessively bright part;
Picture after taking Otsu algorithm to adaption brightness equilibrium treatment in the step of binary conversion treatment carries out binary conversion treatment.
Describedly the picture collecting carried out to adaption brightness equilibrium treatment comprise:
By the piecemeal of the pixel equalization of bar code image the first row, calculate the gray shade scale of every pixel;
The difference of two before and after calculating;
Between adjacent two pieces, use linear interpolation arithmetic, calculate the grey scale pixel value of each point in piece;
Grey scale pixel value based on calculating and gray shade scale self-adaptation are adjusted the gain of each pixel.
Describedly the picture collecting carried out to adaption brightness equilibrium treatment also comprise:
In the time that gray shade scale exceedes default threshold value, the pixel of this piece is not carried out to gain process.
Accordingly, the present invention also provides a kind of Quick Response Code pretreated device, and described pretreatment unit comprises:
Illumination balance processing module, for the picture collecting is carried out to adaption brightness equilibrium treatment, removes in image and crosses secretly and excessively bright part;
Binary conversion treatment module, carries out binary conversion treatment for the picture after taking Otsu algorithm to adaption brightness equilibrium treatment.
Described illumination balance processing module, for by the piecemeal of the pixel equalization of bar code image the first row, is calculated the gray shade scale of every pixel; The difference of two before and after calculating; Between adjacent two pieces, use linear interpolation arithmetic, calculate the grey scale pixel value of each point in piece; Grey scale pixel value based on calculating and gray shade scale self-adaptation are adjusted the gain of each pixel.
Described illumination balance processing module also when exceeding default threshold value when gray shade scale, is not carried out gain process to the pixel of this piece.
Adopted a kind of adaption brightness equalization algorithm in the present invention, effectively eliminated the impact that in bar code image, uneven illumination brings, can to the bar code image of uneven illumination correct carry out binaryzation, improved the discrimination of two-dimensional bar code.
Brief description of the drawings
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, to the accompanying drawing of required use in embodiment or description of the Prior Art be briefly described below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, do not paying under the prerequisite of creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is the pretreated method flow diagram of Quick Response Code of the prior art;
Fig. 2 is the pretreated method flow diagram of the Quick Response Code in the embodiment of the present invention;
Fig. 3 is the pretreated apparatus structure schematic diagram of the Quick Response Code in the embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art, not making all other embodiment that obtain under creative work prerequisite, belong to the scope of protection of the invention.
Embodiment of the present invention pin, in the pretreated process of Quick Response Code, carries out adaption brightness equilibrium treatment to the picture collecting in the step of illumination equilibrium, removes in image and crosses secretly and excessively bright part; Picture after taking Otsu algorithm to adaption brightness equilibrium treatment in the step of binary conversion treatment carries out binary conversion treatment, thereby effectively eliminate the impact that in bar code image, uneven illumination brings, can to the bar code image of uneven illumination correct carry out binaryzation, improved the discrimination of two-dimensional bar code.
The basic thought of Otsu algorithm is: set a threshold value t, it is divided into two groups a width gray level image, one group of corresponding target image of gray scale, and another organizes corresponding background image.The gray-scale value of supposing gray level image is 0~k level, t is since 0 value, until k, when t=T makes the inter-class variance maximum of these two groups of gray-scale values, class internal variance hour, the two-part difference of target image and background image has reached maximization, if the threshold value using threshold value T now as binaryzation will obtain best binaryzation effect.If a width size is the QR bar code image of M × N, establishes threshold value t image is divided into two groups of foreground and background colours, n ifor the number of pixels that is i of gray-scale value in image, the maximum gray scale that G is gray-scale map, the maximum gray scale of 8 gray-scale maps is 255.
First the picture collecting is carried out to adaption brightness equilibrium treatment, in removal image, partial content is excessively dark, the situation that another part is excessively bright, then adopt Otsu algorithm to carry out binary conversion treatment to image.Extract illumination equilibrium and the binaryzation step in flow process corresponding to code word, before traditional Otsu algorithm, add illumination equilibrium treatment, its core is by a series of derivation, determine whether in certain area, to add illumination compensation, if cross dark, reduce gray-scale value, otherwise improve gray-scale value.So that better application is with actual, improve success ratio and the accuracy rate of the extraction code word of equipment.
Fig. 2 shows the pretreated method flow diagram of Quick Response Code in the embodiment of the present invention, comprises the steps:
S201, in the step of illumination equilibrium, the picture collecting is carried out to adaption brightness equilibrium treatment, remove and in image, cross dark and excessively bright part;
(1), by the piecemeal of the pixel equalization of bar code image the first row, calculate the gray shade scale of every pixel;
By the pixel equalization of bar code image the first row be divided into N piece, suppose that each piece contains C pixel, in piece, each pixel is designated as respectively P n1p n2, P n3p nCthe total number K=N*C of the pixel of image a line.P n1and P nCbe respectively first and last pixel in this piece, the gray shade scale that calculates every is designated as S lNfor:
SL N=MAX_M(P N1~P NC)/M??????????(1-1)
Wherein, wherein H pifor the gray-scale value of M pixel maximum in this piece, utilize the method for averaging to carry out the interference of noise decrease point.
(2) difference of two before and after calculating
Before and after calculating, the interpolation of two is:
Diff N=|SL N-SL N+1|??????????(1-2)
, constantly the size of piece is carried out isotomy meanwhile, be not more than Diff until difference is less than the size of threshold value or piece n
(3) between adjacent two pieces, use linear interpolation arithmetic, calculate the grey scale pixel value of each point in piece
Between adjacent two pieces, use linear interpolation arithmetic, can calculate the grey scale pixel value of each point in piece, with being expressed as follows:
S Ni = SL N * ( C - i ) + SL N + 1 * i c , 0 < i < C - - - ( 1 - 3 )
Wherein, S nirepresent the gray-scale value of i pixel in N piece.
(4) grey scale pixel value based on calculating and gray shade scale self-adaptation are adjusted the gain of each pixel
Based on the above-mentioned illumination patterns calculating, just can adjust adaptively the gain to individual pixel.If S nivalue less, the gain of this pixel just can strengthen in right amount, otherwise reduces.So just part brightness darker background can be increased, the bright part of background remains unchanged substantially, reaches the effect that illumination compensation is expected, concrete gain formula is as follows:
AGC Ni = BC S Ni , 0 < i < C - - - ( 1 - 4 )
In formula, AGC niit is the gain of i pixel of N piece.BC is empirical value, is used for the coefficient value of control chart image brightness.After gain process, the gray-scale value of the each pixel of image is:
P &OverBar; N 1 = P Ni * AGC Ni - - - ( 1 - 5 )
Here P nifor original gray value, for the gray-scale value of the pixel in original image after adaptive gain conversion., notice meanwhile, work as SL ngray level when larger, do not needed it to carry out gain process, now we can set a threshold value T, work as SL nwhile exceeding this threshold value, this pixel is not carried out to gain process.
S202, picture after taking Otsu algorithm to adaption brightness equilibrium treatment in the step of binary conversion treatment carry out binary conversion treatment.
Image after adopting Otsu algorithm to adaption brightness equilibrium carries out binary conversion treatment.
By above processing procedure, just can well process in advance image, the discrimination of bar code and speed all promote to some extent.
Accordingly, Fig. 3 shows the pretreated device of Quick Response Code in the embodiment of the present invention, and described pretreatment unit comprises:
Illumination balance processing module, for the picture collecting is carried out to adaption brightness equilibrium treatment, removes in image and crosses secretly and excessively bright part;
Binary conversion treatment module, carries out binary conversion treatment for the picture after taking Otsu algorithm to adaption brightness equilibrium treatment.
It should be noted that, this illumination balance processing module, for by the piecemeal of the pixel equalization of bar code image the first row, is calculated the gray shade scale of every pixel; The difference of two before and after calculating; Between adjacent two pieces, use linear interpolation arithmetic, calculate the grey scale pixel value of each point in piece; Grey scale pixel value based on calculating and gray shade scale self-adaptation are adjusted the gain of each pixel.
It should be noted that, this illumination balance processing module also when exceeding default threshold value when gray shade scale, is not carried out gain process to the pixel of this piece.
It should be noted that, the pretreated device of this Quick Response Code is arranged in Quick Response Code device or Quick Response Code code translator, can be applied in different decoding scenes, is not limited to the situation in the embodiment of the present invention
To sum up, the embodiment of the present invention has adopted a kind of adaption brightness equalization algorithm, has effectively eliminated the impact that in bar code image, uneven illumination brings, can to the bar code image of uneven illumination correct carry out binaryzation, improved the discrimination of two-dimensional bar code.
One of ordinary skill in the art will appreciate that all or part of step in the whole bag of tricks of above-described embodiment is can carry out the hardware that instruction is relevant by program to complete, this program can be stored in a computer-readable recording medium, storage medium can comprise: ROM (read-only memory) (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), disk or CD etc.
The pretreated method of Quick Response Code and the device thereof that above the embodiment of the present invention are provided are described in detail, applied specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment is just for helping to understand method of the present invention and core concept thereof; , for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention meanwhile.

Claims (6)

1. the pretreated method of Quick Response Code, is characterized in that, comprises the steps:
In the step of illumination equilibrium, the picture collecting is carried out to adaption brightness equilibrium treatment, remove in image and cross secretly and excessively bright part;
Picture after taking Otsu algorithm to adaption brightness equilibrium treatment in the step of binary conversion treatment carries out binary conversion treatment.
2. the pretreated method of Quick Response Code as claimed in claim 1, is characterized in that, describedly the picture collecting is carried out to adaption brightness equilibrium treatment comprises:
By the piecemeal of the pixel equalization of bar code image the first row, calculate the gray shade scale of every pixel;
The difference of two before and after calculating;
Between adjacent two pieces, use linear interpolation arithmetic, calculate the grey scale pixel value of each point in piece;
Grey scale pixel value based on calculating and gray shade scale self-adaptation are adjusted the gain of each pixel.
3. pretreated method as claimed in claim 2, is characterized in that, describedly the picture collecting is carried out to adaption brightness equilibrium treatment also comprises:
In the time that gray shade scale exceedes default threshold value, the pixel of this piece is not carried out to gain process.
4. the pretreated device of Quick Response Code, is characterized in that, described pretreatment unit comprises:
Illumination balance processing module, for the picture collecting is carried out to adaption brightness equilibrium treatment, removes in image and crosses secretly and excessively bright part;
Binary conversion treatment module, carries out binary conversion treatment for the picture after taking Otsu algorithm to adaption brightness equilibrium treatment.
5. the pretreated device of Quick Response Code as claimed in claim 4, is characterized in that, described illumination balance processing module, for by the piecemeal of the pixel equalization of bar code image the first row, is calculated the gray shade scale of every pixel; The difference of two before and after calculating; Between adjacent two pieces, use linear interpolation arithmetic, calculate the grey scale pixel value of each point in piece; Grey scale pixel value based on calculating and gray shade scale self-adaptation are adjusted the gain of each pixel.
6. the pretreated device of Quick Response Code as claimed in claim 4, is characterized in that, described illumination balance processing module also when exceeding default threshold value when gray shade scale, is not carried out gain process to the pixel of this piece.
CN201410169579.4A 2014-04-24 2014-04-24 Two-dimension code preprocessing method and device Pending CN103942762A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410169579.4A CN103942762A (en) 2014-04-24 2014-04-24 Two-dimension code preprocessing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410169579.4A CN103942762A (en) 2014-04-24 2014-04-24 Two-dimension code preprocessing method and device

Publications (1)

Publication Number Publication Date
CN103942762A true CN103942762A (en) 2014-07-23

Family

ID=51190414

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410169579.4A Pending CN103942762A (en) 2014-04-24 2014-04-24 Two-dimension code preprocessing method and device

Country Status (1)

Country Link
CN (1) CN103942762A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104408698A (en) * 2014-10-29 2015-03-11 中山大学 Compressed-sensing-based two-dimensional code image illumination equalization method
CN105898230A (en) * 2016-05-20 2016-08-24 深圳英飞拓科技股份有限公司 Spliced image brightness balancing method and device based on multiple input channels
CN107590814A (en) * 2017-09-01 2018-01-16 上海斐讯数据通信技术有限公司 The binary processing method and system of a kind of 3-D view
CN109218637A (en) * 2018-03-19 2019-01-15 崔连臣 A kind of cloud computing system of positioning sandstorm invasion
CN109389000A (en) * 2018-10-18 2019-02-26 龙马智芯(珠海横琴)科技有限公司 A kind of barcode recognition method and the computer using this method
CN109448013A (en) * 2018-08-31 2019-03-08 广东技术师范学院 A kind of part uneven illumination QR code image binaryzation processing method
TWI684134B (en) * 2017-07-24 2020-02-01 國立臺灣師範大學 Graphic qr code manufacturing device and manufacturing method of the same

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103093225A (en) * 2013-01-05 2013-05-08 武汉矽感科技有限公司 Binaryzation method of two-dimension code image
JP2013191078A (en) * 2012-03-14 2013-09-26 Ricoh Co Ltd Image processing system, image processing method, program, and recording medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013191078A (en) * 2012-03-14 2013-09-26 Ricoh Co Ltd Image processing system, image processing method, program, and recording medium
CN103093225A (en) * 2013-01-05 2013-05-08 武汉矽感科技有限公司 Binaryzation method of two-dimension code image

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
YINGHUI ZHANG 等: "An improved binarization algorithm of QR code image", 《CONSUMER ELECTRONICS,COMMUNICATIONS AND NETWORKS(CECNET),2012 2ND INTERNATIONAL CONFERENCE ON》 *
李军: "QR码的图像恢复和识别技术研究与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104408698A (en) * 2014-10-29 2015-03-11 中山大学 Compressed-sensing-based two-dimensional code image illumination equalization method
CN104408698B (en) * 2014-10-29 2017-06-06 中山大学 A kind of image in 2 D code illumination equalization methods based on compressed sensing
CN105898230A (en) * 2016-05-20 2016-08-24 深圳英飞拓科技股份有限公司 Spliced image brightness balancing method and device based on multiple input channels
CN105898230B (en) * 2016-05-20 2019-02-05 深圳英飞拓科技股份有限公司 Stitching image luminance proportion method and device based on multiple input path
US10803260B2 (en) 2017-07-24 2020-10-13 National Taiwan Normal University QR code graphic manufacturing device and manufacturing method of the same
TWI684134B (en) * 2017-07-24 2020-02-01 國立臺灣師範大學 Graphic qr code manufacturing device and manufacturing method of the same
CN107590814A (en) * 2017-09-01 2018-01-16 上海斐讯数据通信技术有限公司 The binary processing method and system of a kind of 3-D view
CN109218637A (en) * 2018-03-19 2019-01-15 崔连臣 A kind of cloud computing system of positioning sandstorm invasion
CN109448013A (en) * 2018-08-31 2019-03-08 广东技术师范学院 A kind of part uneven illumination QR code image binaryzation processing method
CN109389000A (en) * 2018-10-18 2019-02-26 龙马智芯(珠海横琴)科技有限公司 A kind of barcode recognition method and the computer using this method

Similar Documents

Publication Publication Date Title
CN103942762A (en) Two-dimension code preprocessing method and device
CN105069394B (en) Quick Response Code weighted average gray level method coding/decoding method and system
CN104517110B (en) The binarization method and system of a kind of image in 2 D code
CN103093225B (en) The binarization method of image in 2 D code
CN104915972A (en) Image processing apparatus, image processing method and program
EP2767928B1 (en) Device and method for automatically identifying a qr code
CN104504662A (en) Homomorphic filtering based image processing method and system
CN104036244B (en) Checkerboard pattern corner point detecting method and device applicable to low-quality images
CN111753839A (en) Text detection method and device
CN104636118A (en) QR two-dimensional code self-adaptation binarization processing method and device based on light balance
Xiao et al. Single image dehazing based on learning of haze layers
CN103295205A (en) Low-light-level image quick enhancement method and device based on Retinex
CN108765439A (en) A kind of sea horizon detection method based on unmanned water surface ship
JP6890427B2 (en) Car number recognition device
CN107864337A (en) Sketch image processing method, device and equipment
JP2013025319A (en) Binarization threshold determination device, method, and program
CN108197521A (en) A kind of leggy Quick Response Code obtains identification device and method
CN101702238A (en) Motion segmentation method based on relief image
CN110334751B (en) Image processing method and device for binding nodes and terminal
CN108734250B (en) Visual two-dimensional code generation method based on Sobel operator
CN109670491A (en) Identify method, apparatus, equipment and the storage medium of facial image
KR101611267B1 (en) Method for object recognition and apparatus thereof
CN105389775A (en) Image group registration method combined with image gray feature and structured representation
CN110210467B (en) Formula positioning method of text image, image processing device and storage medium
CN107808382A (en) A kind of PCB bar code dividing methods based on color saturation information

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
COR Change of bibliographic data

Free format text: CORRECT: INVENTOR; FROM: HU JIANGUO TO: HU JIANGUO BAI XIAONAN LI SHIREN TAN YUQUAN

C53 Correction of patent for invention or patent application
CB03 Change of inventor or designer information

Inventor after: Hu Jianguo

Inventor after: Bai Xiaonan

Inventor after: Li Shiren

Inventor after: Tan Yuquan

Inventor before: Hu Jianguo

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20140723