CN106446750A - Bar code reading method and device - Google Patents
Bar code reading method and device Download PDFInfo
- Publication number
- CN106446750A CN106446750A CN201610857241.7A CN201610857241A CN106446750A CN 106446750 A CN106446750 A CN 106446750A CN 201610857241 A CN201610857241 A CN 201610857241A CN 106446750 A CN106446750 A CN 106446750A
- Authority
- CN
- China
- Prior art keywords
- region
- bar code
- score
- unit
- image
- 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
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/1413—1D bar codes
-
- 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/1439—Methods for optical code recognition including a method step for retrieval of the optical code
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Electromagnetism (AREA)
- General Health & Medical Sciences (AREA)
- Toxicology (AREA)
- Artificial Intelligence (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Character Discrimination (AREA)
Abstract
The present invention discloses a bar code reading method and device. The method comprising an image acquiring step, a barcode positioning step of locating a bar code from an acquired image, and a barcode recognition step of decoding each bar code region to obtain information represented by each bar code. The bar code positioning step, in particular, comprises: dividing the acquired image into a plurality of non-overlapping regions, and calculating a feature score for each region and determining whether the feature score of the region is greater than a feature score threshold Tconfidence, if yes, making the region as useful, otherwise, discarding the area, wherein when the feature score of any region is calculated, the feature score of the region is equal to the sum of the symbolic contrast percentage score, the gray scale histogram peak difference score, the edge-angle histogram peak difference score, and the edge-angle histogram peak-valley area score, and the regions that are marked as useful are combined to obtain a number of merged barcode regions.
Description
Technical field
The application relates to a kind of bar code read method and device.
Background technology
The device being read out bar code at present is mainly barcode scanner, by manual operation by laser scanner
Alignment and close bar code, carry out bar code scanning input and identification to it.But if bar code printing is off quality or
There is fracture or pollute in transportation, the correctness of bar code recognition will be had a strong impact on.In this case, based on image
The technology that bar code is read in process has more advantage.
First, laser scanner only uses beam of laser to be scanned image, if some position of bar code occurs
Stain, then be likely to occur mistake, and use image processing techniques, it is possible to use the information of whole the barcode size or text field, will not be because of
Local losses causes mistake.
Secondly, image has between each pixel very strong correlation, is not independent between each pixel, therefore base
Reading bar code in image procossing and can utilizing this correlation, above-mentioned laser scanning bar code identification technology then cannot
Use this correlation.
Again, it is identified based on image processing techniques, once can identify multiple bar code, have more intelligent, often
Laser scanning bar code, needs manually by scanner alignment with near bar code, to go singly successively to read bar code.
Therefore study hotspot is become in recent years based on the bar code automatic identification technology of image procossing.This technology with common
Based on laser gun scanning bar code identification technology different, its key difference is, based on laser gun scanning bar shaped
Code identification technology is to be found the position of bar code and placed it in laser gun front and make it have sufficiently high point by operating personnel
Resolution, is scanned input with this understanding and identifies, and the bar code automatic identification technology based on image procossing needs from again
Automatic searching and detecting extract bar code image in miscellaneous image background, is then identified to bar code, it is not necessary to manually grasp
Make.Therefore, the bar code automatic identification technology based on image procossing, how one of main technological difficulties are at complex background
In orient the barcode size or text field.
Content of the invention
For solving the problems referred to above, the application provides a kind of bar code read method and device.
According to the first aspect of the application, the application provides a kind of bar code read method, including:
Image acquisition step, obtains the image comprising bar code;
Bar code positioning step, orients bar code from the image obtaining, specifically, including:
The image of acquisition is divided into the region of some non-overlapping copies;
For each region, calculate the feature score in this region, and judge the feature score in this region whether more than a spy
Levy score threshold TconfidenceIt if being more than, then is useful by this zone marker, otherwise, then give up this region;Wherein, calculating is appointed
During the feature score in what region, it is straight that the feature score in this region is equal to the character correlation degree percentage score in this region, gray scale
Side's figure peak difference score, edge angular histogram peak difference score and edge angular histogram peak valley area score sum;
Carry out region merging technique to being respectively marked as useful region, obtain several the barcode size or text fields after merging;
Bar code recognition step, is decoded to each the barcode size or text field respectively, to obtain the information representated by each bar code.
In a preferred embodiment, in bar code recognition step, before region is decoded, first this region is carried out
Projection, is decoded according to the projection in region.
According to the second aspect of the application, the application provides a kind of apparatus for reading of bar code, including:
Image acquisition component, for obtaining the image comprising bar code;
Bar code positioning element, for orienting bar code from the image obtaining, specifically, including:
Cutting unit, for being divided into the region of some non-overlapping copies by the image of acquisition;
Feature score computing unit, for for each region, calculates the feature score in this region;Wherein, feature score
Computing unit includes:
First computation subunit, for calculating the character correlation degree percentage score in this region;
Second computation subunit, for calculating the grey level histogram peak difference score in this region;
3rd computation subunit, for calculating the edge angular histogram peak difference score in this region;
4th computation subunit, for calculating the edge angular histogram peak valley area score in this region;
Addition subelement, for by described first computing unit subelement, the second computation subunit, the 3rd computation subunit
It is added with the score that the 4th computation subunit calculates, to obtain the feature score in this region;
Feature score judging unit, whether the feature score for judging this region is more than a feature score threshold value
Tconfidence;
Indexing unit, the feature score for judging this region when feature score judging unit is more than described feature score threshold
Value TconfidenceWhen, it is useful by this zone marker;
Give up unit, for judging that the feature score in this region is not more than described feature score when feature score judging unit
Threshold value TconfidenceWhen, give up this region;
Region merging technique unit, for carrying out region merging technique to being respectively marked as useful region, obtains after several merge
The barcode size or text field;
Bar code recognition parts, for being decoded to each the barcode size or text field respectively, to obtain representated by each bar code
Information.
In one preferably embodiment, described bar code recognition parts also include projecting cell, for solving region
Before Ma, first projecting this region, bar code recognition parts are decoded further according to the projection in this region.
The application provides the benefit that:
According to bar code read method and the device of above-described embodiment, when positioning bar code, calculate any region
During feature score, it is poor that the feature score in this region is equal to the character correlation degree percentage score in this region, grey level histogram peak
Point, edge angular histogram peak difference score and edge angular histogram peak valley area score sum;Owing to introducing these four
Score evaluates whether a certain region comprises bar code, such that it is able to bar code is precisely located out in complicated background
Come, improve stability and the accuracy of bar code positioning;
According to bar code read method and the device of above-described embodiment, owing to, in bar code recognition step, region being carried out
Before decoding, first this region is projected, be decoded according to the projection in region, hence for the not good bar shaped of printing quality
Code, or defaced bar code also can be decoded, and increases the robustness of decoding.
Brief description
Fig. 1 is a schematic diagram of bar code;
Fig. 2 is the schematic flow sheet of the bar code read method of a kind of embodiment of the application;
Fig. 3 be a kind of embodiment of the application bar code read method in the schematic flow sheet of image acquisition step;
Fig. 4 be a kind of embodiment of the application bar code read method in the schematic flow sheet of bar code positioning step;
Fig. 5 be a kind of embodiment of the application bar code read method in the image of acquisition is divided into some non-overlapping copies
The schematic diagram in region;
Fig. 6 is the schematic diagram of the angular histogram of a kind of embodiment of the application;
Fig. 7 be a kind of embodiment of the application bar code read method in when carrying out region merging technique, carrying out distance of swimming mark
The schematic diagram of situation about being likely to occur after note;
Fig. 8 for entering the result schematic diagram after row equivalent merges to Fig. 7;
Fig. 9 be a kind of embodiment of the application bar code read method in carry out the schematic flow sheet of region merging technique;
Figure 10 (a) and (b) are respectively the corresponding mark diagram of the schematic diagram after segmentation in a kind of embodiment of the application
It is intended to;
Figure 11 is that the flow process of the exact position obtaining bar code in the bar code read method of a kind of embodiment of the application is shown
It is intended to;
Figure 12 be a kind of embodiment of the application bar code read method in the schematic flow sheet of bar code recognition step;
Figure 13 (a) and (b) are respectively behind the exact position obtaining bar code, determine the schematic diagram of the centre coordinate in region
Carry out postrotational schematic diagram with region;
Figure 14 is the structural representation of the apparatus for reading of bar code of a kind of embodiment of the application;
Figure 15 is the structural representation of the bar code positioning element in the apparatus for reading of bar code of a kind of embodiment of the application;
Figure 16 is the structural representation of the feature score computing unit of a kind of embodiment of the application;
Figure 17 is the structural representation of the bar code recognition parts in the apparatus for reading of bar code of a kind of embodiment of the application.
Detailed description of the invention
Commodity packaging etc. is taken pictures acquisition input picture, then the bar code in image is positioned out, finally to positioning
The bar code going out is decoded identifying.Among these, there are two critical problems:
One is how to search for orient the barcode size or text field in complex background.Bar code can mark article producing country,
The much information such as manufacturing firm, trade name, date of manufacture, book classification number, mail start-stop place, classification, date, thus
Many fields such as commodity circulation, taking care of books, postal management, banking system are widely used.So bar code is permissible
Be positioned at commodity include, on many different article such as books, mail package, even ware, its external packing is also different, and this is just
Cause the background residing for bar code complicated, simultaneously as bar code is also likely to difference in each article location, enter again
The positioning to bar code for one step is challenged.
Two is to be decoded to the bar code oriented identifying.Due to the shape of article own, to there may be some concavo-convex not
Flat, if the barcode size or text field is located exactly at this region, then in the image obtaining, bar code will distort;For another example, a lot of bar codes
There are quality problems in printing, or article to cause the bar code of printing to get dirty in transportation impaired etc.;For another example bar code is shot
There is distortion in the picture of shooting during picture, these situations above-mentioned all cause occurs that mistake even can not when being decoded bar code
Decoding.
Inventor is made that research for above-mentioned two key issue, in order to the application is better described, first does to existing
Method carries out a brief introduction.
For problem one, i.e. how in complex background, the barcode size or text field is oriented in search, positions bar code both at home and abroad
Algorithm has carried out some researchs, mainly includes following four technology:
(1) Bar code positioning based on machine learning techniques.The method is instructed mainly by the geometrical feature of bar code
Practicing, then carrying out Bar code positioning, one of the method shortcoming is to need the sample image of magnanimity.Further, since bar code species is many
Many, therefore it cannot adapt to different types of bar code and positions simultaneously.
(2) position based on the bar code of image frequency domain information.The method, in the high frequency subgraph obtaining image, utilizes line
The similitude of reason carries out bar code positioning.Because the barcode size or text field is chequered with black and white, described high-frequency characteristic is notable, this scheme
For example, based on the bar code detection of Gabor wavelet texture analysis, at the barcode size or text field, it has higher middle typical case in one direction
Wavelet coefficient, and wavelet coefficient is less in the other direction.
(3) position based on the textural characteristics and shape facility in image spatial domain.The method utilizes the Gradient Features of image
Carry out bar code detection, first by gradient direction, image is divided into 4 gradient images, then choose the bigger region of Grad and carry out
Merge, then chosen the region meeting characteristics of bar code by geometric properties.
(4) based on morphologic bar code positioning.The method obtains marginal information first with edge extracting method, then
Edge image is expanded by the dilation operation utilizing Mathematical Morphology, and as much as possible the barcode size or text field is expanded to 4 connections or
The region of person 8 connection, finally utilizes the shape facility of the barcode size or text field to determine the barcode size or text field.Owing to the method expands iteration
Number of times be difficult to determine, therefore in complex scene be difficult to meet require.
Above four class methods, are all difficult to be pin-pointed to the barcode size or text field, and the robustness positioning in complex background
It is difficult to ensure that.
It for problem two, is i.e. decoded to the bar code oriented identifying.This situation is not done and is located by prior art
Reason, therefore usually occurs that decoding makes mistakes.
To sum up, the application mainly solves two critical problems:
(1) in complex background, accurately obtain the position of bar code, improve stability and the accuracy of bar code positioning;
(2) what the surfaces such as the decoding capability of raising bar code, can carry out distortion correction automatically, solution column cannot decode asks
Topic.
Below a brief description is done to present invention design.
Reading bar code, main point of three steps, the first step is to obtain image;Second step is to carry out the bar code in image
Positioning;3rd step is to be decoded to the bar code oriented identifying.
Hardware aspect:
In obtaining image, this part of hardware mainly includes camera, and camera is taken pictures to obtain image information, real one
Execute in example, can also include taking pictures with light source, to improve the prospect contrast obtaining image.Can lead to after obtaining image information
Cross wired (such as netting twine connection, USB data line etc.) or that image is wirelessly passed to corresponding image processing system is for example electric
Brains etc. are to carry out bar code positioning and identification.Related hardware can also include input equipment such as keyboard and mouse etc., is used for using
Family arranges some parameters, to adapt to the demand of scene.Related hardware can also include output equipment such as display screen etc., in order to uses
Result is watched at family.
Algorithm aspect:
Bar code is one-dimension code, and it is that bar (black) different by width, that reflectivity is different and sky (white) are according to necessarily
The graphical identifier worked out of coding rule, be used for expressing set of number, one group of letter or set of number and letter mix
The symbolic information closed.Fig. 1 is an example of bar code.Inventor finds after the research of all kinds of bar codes, bar code
Image has following feature:
(1) geometry:The barcode size or text field reflection is rectangle or approximate rectangular in the picture;
(2) gradient magnitude information:Owing to the Grad at edge is relatively big, if bar code region, its edge is more than a certain threshold value;
(3) Gradient direction information:The principal direction of the gradient direction in bar code region is parallel to each other, and both differentials are near
180 degree;
(4) histogram feature:The barcode size or text field is made up of the higher two kinds of colors (black and white) of contrast, thus original
In image after gray processing, if a region is the barcode size or text field, then its contrast is the highest, i.e. its gray scale is straight
Side's figure should have two obvious crests, and two crests are distant.
Bar code is positioned by complex background, it may be considered that features described above.If the application first divides the image into into
Dry region, then to each region, based on the characteristic information extracting said extracted, calculate the degree of membership in this region, according to customization
Decision tree progressively judges whether this region belongs to the barcode size or text field, passes through connectivity analysis afterwards or region increases acquisition region
The regions of some satisfied 8 connections or 4 connections are carried out region merging technique, afterwards, obtain the topology information parameter in region by characteristic,
Such as area, length, width, direction etc., then carry out region screening according to threshold value, it is thus achieved that candidate region.It is above with regard to again
Location algorithm thinking to bar code in miscellaneous background.After orienting bar code, the application is again to the barcode size or text field oriented
Carry out rotating, distortion correction, afterwards again to the barcode size or text field, do upright projection, add up its gray scale and average afterwards, right
The perspective view being formed carries out gaussian filtering, removes minor fluctuations and noise, and detection edge is simultaneously added up Edge Distance and marked
For different grades, being then decoded, this can efficiently solve the situations such as bar code printing is second-rate or defaced, carries
The high robustness of decoding.
Combine accompanying drawing below by detailed description of the invention to be described in further detail the application.
Present applicant proposes a kind of bar code read method, as in figure 2 it is shown, it includes image acquisition step S100, bar shaped
Code positioning step S300 and bar code recognition step S500, illustrate separately below.
Image acquisition step S100, the image comprising bar code for acquisition.In one embodiment, as it is shown on figure 3, image
Obtaining step S100 includes step S101~S111.
Step S101, the basic parameter initializing camera.
Step S103, connection camera and corresponding control processing system, computer as escribed above etc..
Step S105, judges whether to shoot image according to trigger, if trigger is true, then carries out step S107,
Otherwise carry out step S113.
Step S107, startup camera shoot.
Step S109, the image transmitting by camera shooting give corresponding control processing system, such as illustrate in step S103
Computer etc..
Step S111, control processing system judge whether to continue shooting, if continuing shooting, then again from the beginning of step S105
Carrying out, if not continuing shooting, then terminating image acquisition process.
Bar code positioning step S300, from image acquisition step S100 obtain image orient bar code.At a tool
In body embodiment, as shown in Figure 4, bar code positioning step S300 includes S301~S331, is specifically described below.
Step S301, to image acquisition step S100 obtain image pre-process, with improve image contrast and/
Or filter noise.In one embodiment, the method pre-processing the contrast to improve image in step S301 can include but not
It is limited to the methods such as histogram equalization, linear stretch and logarithmic transformation.Further, since noise belongs to HFS in the picture,
Therefore in one embodiment, step S301 pre-processes to filter noise, can use LPF, make the high-frequency components in image
It is prevented from passing through.Step S301 is optional step.
Step S303, the region that the image of acquisition is divided into some non-overlapping copies.Certainly, if bar code code positioning walks
Rapid S300 includes step S301, then step S303 is that the image through pretreatment is divided into the region of some non-overlapping copies.Please
It with reference to Fig. 5, is the design sketch in the region dividing the image into into some non-overlapping copies.For each pixel, if be positioned at
The barcode size or text field there is no obvious characteristic, therefore cannot judge based on the Pixel Information of image, but can be according to comprising one
In the region of determined number pixel, the relation between each pixel judges whether this region is positioned at the barcode size or text field, in other words, is
Judge whether this region comprises to form the pixel of bar code.In this step, the size in each region of segmentation, can be identical,
Also can be different, the present embodiment uses and is divided into some regions that size is identical, in addition, the size in region can be according to shooting figure
In Xiang, the size of bar code is configured, and can meet requirement by each region 32*32 pixel size;In one embodiment,
Can also arrange some ranks, for example basic, normal, high rank selects for user, after user selects to split rank accordingly, and image
The region of some appropriate level sizes will be divided into.
As can be seen from Figure 5 shooting image background complicated, bar code has two in the picture, and shared ratio is less
And resolution ratio is relatively low.It should be noted that Fig. 5 be only intended to explanation shooting image for an example, be not used to limit
Determine the application, for example, in other example, background may be different, and the position of bar code, size and quantity all may not
With.In order to realize the positioning to bar code, first have to analyze the key that the region comprising bar code is different from image background regions
Feature.Inventor finds, bar code is made up of some chequered with black and white stripeds, so bar code is at a direction (such as Fig. 5
In horizontal direction) there is the sudden change of obvious gray scale, and several in the upper gray scale of another vertical direction (vertical direction in such as Fig. 5)
It is not changed in.In certain background image, some region also has similar feature, but the barcode size or text field also has very regular
Rectangular characteristic, this is that other regions typically will not have simultaneously, in addition, from Barcode Rules, bar code starting character
The right side of left side and full stop has the white space of one fixed width, and this feature also reduces around bar code to a certain extent
The interference to bar code search positioning for the image.Therefore, inventor finds and selects some features following every to assess after segmentation
One region, sees whether it is the barcode size or text field:
(1) feature is compared in the character correlation degree change in region.Owing to the barcode size or text field is chequered with black and white striped, therefore one
The gray scale in direction (for example, the horizontal direction in Fig. 5) is bright dimmed and the percentage respectively that secretly brightens is about 50 percent,
I.e. bleached by black, be about 50 percent respectively by the black shared percentage of leucismus.
(2) grey level histogram peak difference feature:The half-tone information of statistical regions, forms the grey level histogram in region, if having two
When the gray value difference of individual obvious crest and crest is bigger, then there may be bar code.
(3) edge angular histogram peak difference feature:The directional information of statistical regions inward flange, forms the angle Nogata in region
Figure, if there is two obvious crests and difference close to 180 °, then there may be bar code.
(4) edge angular histogram peak valley area features:The crest of statistics angular histogram and nearest two trough institutes
The area surrounding, if this area is more than a certain threshold value, then there may be bar code.
Use the discovery of foregoing invention people, then follow the steps below.
Step S305, each region obtaining the segmentation of step S303, obtain image border in region, scheme in zoning
As edge percentage.In one embodiment, in order to obtain the edge of image, Roberts operator or Sobel can be used
Operator calculates, and in order to reduce operand, might as well use Roberts operator, and the gradient in x, y direction is respectively:
Wherein, (x, y) coordinate in representative image is the gray value of the pixel of x, y to i.
The amplitude obtaining gradient after standardization is:
Gradient direction angle is:
Step S307, judge whether image border percentage is more than percentage threshold T in this regionacceptIf, not
Being more than, then carry out step S309, give up this region, if being more than, then carrying out step S311.Percentage threshold in step S307
TacceptCan preset, it is also possible to user is configured by correlated inputs equipment.
The purpose of step S305~step S309 is to some substantially not be positioned at the region of barcode position to rejecting
Fall, to reduce follow-up amount of calculation and total calculating time.Bar code comprises some different secret notes and informal voucher, if therefore one
Region is positioned at barcode position (i.e. this region comprises to constitute the pixel of bar code), then the percentage of the image border in this region
Must be higher, if it means that the percentage of the image border in a region is relatively low, then this region be positioned at bar shaped code bit
Put, can be rejected.
Step S311, the feature score calculating this region, when wherein calculating the feature score in any region, this region
Feature score is equal to the character correlation degree percentage score in this region, grey level histogram peak difference score, edge angular histogram peak
Difference score and edge angular histogram peak valley area score sum.In one embodiment, the feature in any region is calculated
During score, when the gray scale in a direction in this region is bright dimmed and the percentage that secretly brightens is respectively closer to 50 percent, then
The character correlation degree percentage score in this region is higher;When in the grey level histogram in this region, if there are two obvious crests
And crest gray value difference bigger when, then the grey level histogram peak difference score in this region is higher;Angle Nogata when this region
In figure, if there is two obvious crests and difference closer to 180 degree, then the edge angular histogram peak difference score in this region
Higher;When, in the angular histogram in this region, adding up the area that each crest two trough nearest with it is surrounded, if this area
More be more than a threshold value, then the edge angular histogram peak valley area score in this region is higher.When Practical Calculation, due to great majority
The hardware (such as computer) with computing function can only process discrete data, it is impossible to processes continuous data, therefore can be by 360
It is 2 degree that the angle of degree scope is divided into 180 bin, each bin, puts into corresponding angle in corresponding bin, and gained angle is divided
Cloth situation is angular histogram;For example, as shown in Figure 6, it is a schematic angular histogram, calculating peak valley area
When, can be reduced to add up the number of pixels included in peak valley.In a preferred embodiment, calculate the feature in any region
During score, by the character correlation degree percentage score in this region, grey level histogram peak difference score, edge angular histogram peak valley face
Before long-pending score edge angular histogram peak difference score and edge angular histogram peak valley area score are added, first by this region
Character correlation degree percentage score, grey level histogram peak difference score, edge angular histogram peak difference score and edge angle Nogata
Figure peak valley area score is multiplied by a corresponding weight coefficient respectively;Wherein this four weight coefficient values are all 0~1, and phase
In addition and be 1.For example, with f1、f2、f3、f4Represent character correlation degree percentage score, the grey level histogram peak in a region respectively
Difference score, edge angular histogram peak difference score, edge angular histogram peak valley area score, represent the feature in this region with c
Score, in the case of not considering weight coefficient, c=f1+f2+f3+f4;In the case of considering weight coefficient, w1、w2、w3、w4
Represent respectively the weight coefficient of the character correlation degree percentage score in a region, grey level histogram peak difference score weight coefficient,
The weight coefficient of edge angular histogram peak difference score, the weight coefficient of edge angular histogram peak valley area score, then c=
w1*f1+w2*f2+w3*f3+w4*f4, wherein w1、w2、w3、w4Value be all 0~1, and w1+w2+w3+w4=1.
Step S313, judge that whether the feature score in this region is more than feature score threshold value TconfidenceIf being not more than,
Then carry out step S315, give up this region;If being more than, then carry out step S317, be useful by this zone marker.In step S313
Feature score threshold value TconfidenceCan preset, it is also possible to user is configured by correlated inputs equipment.
Step S311~step S317 is the region that some are not belonging to barcode position by the feature score according to each region
Weed out.In one embodiment, bar code positioning step S300 can only include step S305~step S309 and rejects and do not belong to
Region in barcode position;Also can only include step S311~step S317 and reject the district being not belonging to barcode position
Territory, in this case, exactly in the region of the some non-overlapping copies being divided in step S303 in step S311, to each
Individual region all calculates its feature score;Also can include step S305~step S309 and step S311~step S317 simultaneously,
In this case, step S311 is exactly more than percentage to image border percentage in being judged region in step S307
Ratio threshold value TacceptRegion calculate feature score, the region being rejected in step S309 is not then calculated to its feature score.
Step S319, carrying out morphological operation to being marked as useful region in step S317, morphological operation includes
Expand and/or corrosion;Wherein, expanding for filling the hole being marked as in useful region, making region more regular, corrosion is used
It isolated is marked as useful region in removing.Step S319 is optional step.
Step S321, carry out region merging technique to being respectively marked as useful region, obtain several bar codes after merging
Region, for example, if carrying out above-mentioned steps process to the image in Fig. 5, it is likely that just obtain two the barcode size or text fields.Due to step
S319 is optional step, and therefore, in the presence of step S319, step S321 was to carrying out morphological operation in step S319
Useful region merges, and when step S319 does not exists, then step S321 is useful to being respectively marked as in step S317
Region directly merge.In one embodiment, carry out region merging technique and can use (1) connectivity analysis methods or (2) district
The method that territory increases is carried out.Separately below both approaches is illustrated.
(1) when step S321 uses the method for connectivity analysis to carry out region merging technique:
The method of connectivity analysis can use the examination of Run-Length Coding, and the distance of swimming (Run) is defined as:Connect and be positioned at same a line
Block, its structure includes that the distance of swimming (Run) is expert at (row), start arrange (start), end column (end) and mark.
The distance of swimming is used to carry out the connective connectedness judging only to carry out the distance of swimming of adjacent rows, the connective judgement of the distance of swimming
Rule is as follows:
Wherein X [i] .start, X [i] .end represent the distance of swimming of level row start row and end column, wherein level
It is greater than the integer of 0;X [j] .start, X [j] .end represent the distance of swimming of level-1 row start row and end column.When
During offset=0, represent 4 connections, as offset=1, represent 8 connections.If lastrow distance of swimming X [j] and this journey distance of swimming X
[i] meets above-mentioned judging rules, then judge that distance of swimming X [j] connects with distance of swimming X [i], otherwise, then judge that both do not connect.
Carry out distance of swimming mark by above-mentioned judging rules, just enter row equivalent afterwards and merge.For example, if Fig. 7 is for having carried out the distance of swimming
The situation that mark is likely to occur, in Fig. 7, the first row is labeled as the distance of swimming of 1 and the second rower is designated as the distance of swimming of 3, fourth line is labeled as
Belong to same connected region on the Run Theory of 6, be combined so they are entered row equivalent;The first row is labeled as the trip of 2
Journey is with the second rower is designated as the distance of swimming of 4, the third line is labeled as on the Run Theory of 5 belonging to same connected region, so will be by
It is involutory that they enter row equivalent, and equivalence merges as shown in Figure 8.
Specifically, step S321 uses the method for connectivity analysis to carry out region merging technique, as shown in fig. 9, it includes step
Step P101~P119:
Step P101, carry out Run-Length Coding to being respectively marked as useful region, and return each distance of swimming (Runs).
Step P103, travel through each distance of swimming.
Step P105, judge traversal whether terminate, i.e. judge whether to travel through whole distance of swimming.When judging that traversal terminates, then
Carry out step P107;When judging that traversal is not over, then carry out step P109.
Step P107, merging are of equal value right.
Step P109, judging current line distance of swimming Run [i], whether its previous row has distance of swimming Run [j] of coincidence.Judge depends on
Connective judging rules according to the above-mentioned distance of swimming.If the current line distance of swimming, its previous row has the distance of swimming of coincidence, then carries out step
P111, otherwise carries out step P115.
Step P111, judge the current line distance of swimming mark whether equal to 0, i.e. judge whether Run [i] .lebel is equal to 0.If
It is equal to, then carry out step P113, otherwise carry out step P117.
Step S113, the value by Run [j] .lebel are assigned to Run [i] .lebel.Afterwards again from the beginning of step 103, time
Go through the next line distance of swimming.
Step P115, the value of lebel is added 1, then the value of lebel is assigned to Run [i] .lebel.Afterwards, again from step
103 start, and travel through the next line distance of swimming.
Step P117, judging whether Run [j] .lebel and Run [i] .lebel is not equal to, if being not equal to, then both are not
Being of equal value right, if equal, then carrying out step P119, it is of equal value right to be labeled as i and j, then re-starts step P109.
(2) method using region to increase when step S321 carries out region merging technique:
It when the method that region merging technique uses region to increase realizes, is, by degree of membership mark flow process, rower is entered to image
Note.It is marked as the pixel in useful region before first choosing as seed, utilize region-growing method combined region.At seed
Being marked as useful search in 8 fields of point to meet the pixel of angle threshold τ and join this region, regional perspective is designated as
θregion, initial angle is the gradient direction of Seed Points.Its angle conditions is:
|θregion-θi|≤τ
In formula, θiIt is the gradient direction of pixel in 8 neighborhoods.
Often increasing a point, the angle in line segment region will update once, and its update method is:
Here subscript i, for traveling through all pixels in region, is so persistently carried out, until not having any pixel permissible
Add in line segment region.In one embodiment, angular error could be arranged to 22.5 degree, say, that for whole rectangle
The angular error of 45 degree can be tolerated in speech.Pixel in the range of this tolerable error all will be chosen in the middle of rectangle.
After obtaining region, can be with the geometrical property of zoning, such as boundary rectangle, area, center of gravity etc..The center of rectangle
For:
In formula, subscript j is for traveling through all pixels in rectangular area, and the principal direction of rectangle is that minimal eigenvalue is corresponding
The angle of characteristic vector.Therefore, Hessian matrix is:
Wherein
In addition, the area in this region is the number of pixels in region.In one embodiment, according to connectivity analysis side
Method merges, and can calculate according to the following formula:
In formula:Area (j) represents the region area being labeled as j;runjI () represents distance of swimming run (j) being labeled as j;runj
(i) .start represent be labeled as j run (j) start row;runjI () .end represents the end column of the run (j) being labeled as j.
In one embodiment, above-mentioned region in image is marked, gives up, morphological operation and region merging technique, not
It is to operate in artwork, region is marked, gives up, merges and morphological operation, be to carry out at a mark figure, wherein
Described mark figure includes the corresponding pixel of quantity with the region after segmentation, after in mark figure, each pixel correspond to segmentation
One region.For example, after the image of acquisition being divided into the big regions such as M*N in step S303, correspondingly, one is generated
Mark figure, then includes M*N pixel in this mark figure, after in mark figure, each pixel correspond to split in step S303
One region.Therefore, it is useful by a zone marker, can be the gray value by corresponding for this region pixel in mark figure
It is set to 255, a region is given up, can be, in mark figure, the gray value of corresponding for this region pixel is set to 0, as
Shown in Figure 10, figure (a) for the image that obtains divided after the schematic diagram in some regions, figure (b) is for the correspondence after being marked
Mark figure;Introduce mark figure, rather than operate in artwork, advantage of this is that:Each region is by a pixel
Replace, amount of calculation and operation time can be greatly reduced.
After step S323, several the barcode size or text fields obtaining in step S321, for each the barcode size or text field, sentence
The area in this region, the length of breaking and wide whether meet a respective threshold condition, if not meeting, then carries out step S325, gives up this
Shape code region;If meeting, then carry out step S327 or step S500.Step S323 is optional step, its purpose is to into one
Step filters out the region comprising bar code, to confirm several the barcode size or text fields that step S321 obtains, each bar code area
Territory, is all the region comprising bar code, therefore after step S323, in one embodiment, can then carry out step S323,
In another embodiment, it is also possible to directly carry out bar code recognition step S500.
Before step S327, over there long-pending, length and width meet the barcode size or text field decoding of respective threshold condition, also determine that this
The center line of the barcode size or text field, as shown in figure 11, and in two rectangular areas of downward shift certain distance at the center line, point
Take the angle point of each rectangular area indescribably, carry out fitting a straight line, to obtain the exact position of bar code.
Step S329, judge whether this barcode size or text field comprises complete bar code, if so, then carry out bar code recognition step
Rapid S500, otherwise, then carry out step S331.
It step S331, is the region comprising complete strips shape code by this barcode size or text field completion, carry out bar code knowledge afterwards again
Other step S500.In one embodiment, the length and width according to the bar code in the threshold condition arranging, according to a certain percentage at this
Shape code region up and down respectively offset certain distance, be the region comprising complete strips shape code by this barcode size or text field completion.
Step S327~step S331 is optional step, its purpose is to make to be solved in bar code recognition step S500
The barcode size or text field of code, is the region comprising complete strips shape code, so can improve the accuracy of decoding.Step S321 is carried out
After region merging technique, there are some the barcode size or text fields, it may be possible to comprise incomplete bar code, the pixel at the edge of bar code, have
May be comprised in the cut zone with the barcode size or text field phase neck, in some cases, this adjacent region may be due to only
Comprise the pixel at the edge of minimal amount of bar code, thus be rejected in bar code positioning step S300.Step S327
~step S331 is precisely in order to solve this situation.
Bar code recognition step S500, is decoded to each the barcode size or text field respectively, to obtain representated by each bar code
Information.
In a preferred embodiment, as shown in figure 12, bar code recognition step S500 includes step S501 and/or S503.
Step S501, region is decoded before, first carry out rotating and distortion correction to this region.Drawing of step S501
Enter so that the application also can be decoded for the image that there is distortion, and therefore the application has preferable robustness and environment
Adaptability.
In one embodiment, perspective transform is carried out according to the following formula:
It needs to be determined that 6 parameters in above formula, as long as therefore there being three groups of points corresponding, set up 6 equations.In order to reduce noise
Impact, can select 16 points to carry out correspondence in one embodiment, solve parameter.
In one embodiment, step S501 specifically can be carried out in two steps, and first determines pivot:Obtain the accurate of bar code
Behind position, determining the centre coordinate in region according to the position of four angle points, the intersection point of two dotted lines is required, such as Figure 13 (a)
Shown in;Determine the anglec of rotation again:The principal direction in statistical regions inward flange direction or average according to fitting a straight line gained angle,
Shown in postrotational bar code orientation such as Figure 13 (b).
The introducing of step S501 so that the application also can be decoded for the image that there is distortion, therefore the application tool
Have preferable robustness and environmental suitability.
S503, projecting this region, the projection further according to region afterwards is decoded.The introducing of step S503, makes
The application for the not good bar code of printing quality, or defaced bar code also can be decoded, and is calculated by binaryzation
The mode of the gray scale sum of projection, increases the robustness of decoding.In one embodiment, step S503 can be to postrotational
Image does upright projection, add up its gray scale and average afterwards, carries out gaussian filtering to the perspective view being formed, removes small
Fluctuation and noise, detection edge is simultaneously added up Edge Distance and is marked as different grades, being then decoded.
It is exactly more than bar code read method disclosed in the present application, correspondingly, disclosed herein as well is a kind of bar code and read
Fetching is put, and refer to Figure 14, and it includes image acquisition component the 100th, bar code positioning element 300 and bar code recognition parts 500.
Image acquisition component 100 is for obtaining the image comprising bar code.The workflow of image acquisition component 100 and knot
Structure can refer to image acquisition step S100 shown in Fig. 3, does not repeats them here.
Bar code positioning element 300 is for orienting bar code from the image obtaining.In one embodiment, refer to figure
15, the 305th, bar code positioning element 300 includes pretreatment unit the 301st, cutting unit the 303rd, image border percentage computing unit
The 307th, image border percentage judging unit gives up unit the 309th, feature score computing unit the 311st, feature score judging unit
313rd, indexing unit the 317th, morphological operation unit the 319th, region merging technique unit the 321st, region screening unit the 323rd, fine positioning unit
327 and completion unit 331, it is specifically described below.
The image that image acquisition component 100 is obtained by pretreatment unit 301 pre-processes, to improve the contrast of image
And/or filter noise.In one embodiment, pretreatment unit 301 pre-processes to improve the contrast of image, can include but
It is not limited to carry out histogram equalization, linear stretch and logarithmic transformation etc. to image.Further, since noise belongs in the picture
HFS, therefore in one embodiment, pretreatment unit 301 pre-processes to filter noise, and low pass filter can be used real
Existing, make the high-frequency components in image be prevented from passing through.Pretreatment unit 301 is optional unit.
Cutting unit 303 for being divided into the region of some non-overlapping copies by the image of acquisition.
Image border percentage computing unit 305, for each region being partitioned into for cutting unit 303, obtains region
Interior image border, image border percentage in zoning.
In one embodiment, in order to obtain the edge of image, Roberts operator or Sobel operator can be used to carry out
Calculating, in order to reduce operand, might as well using Roberts operator, the gradient in x, y direction is respectively:
Wherein, (x, y) coordinate in representative image is the gray value of the pixel of x, y to i.
The amplitude obtaining gradient after standardization is:
Gradient direction angle is:
In image border percentage judging unit 307 is used for judging region, whether image border percentage is more than 100
Proportion by subtraction threshold value Taccept;If being not more than, then give up unit 309 and this region is given up, if being more than, then feature score computing unit 311
Calculate the feature score in this region again.
The purpose of unit 305~309 be in order to some are not substantially positioned at the region of barcode position give weed out, to subtract
Few follow-up amount of calculation and total calculating time.Bar code comprises some different secret notes and informal voucher, if a therefore region position
In barcode position (i.e. this region comprises the pixel constituting bar code), then the percentage of the image border in this region must be
Higher, if it means that the percentage of the image border in a region is relatively low, then this region is not positioned at barcode position, can
To be rejected.Therefore, unit 305~309 is selectable unit, when embodiment includes unit 305~309, then feature score meter
Calculate in unit 311 is to be that image border percentage is more than percentage to image border percentage judging unit 307 judged result
Ratio threshold value TacceptRegion carry out feature score calculating, when embodiment does not include unit 305~309, then feature score calculates single
Unit 311 is each region obtaining cutting unit 303 segmentation calculates feature score.
Feature score computing unit 311 is for calculating the feature score in this region.In one embodiment, feature score
Computing unit 311, as shown in figure 16, including the first computation subunit 311a, the second computation subunit 311b, the 3rd calculating are single
Unit 311c, the 4th computation subunit 311d and addition subelement 311f, in a preferred embodiment, can also include that weight is single
Unit 311e.Specifically, the first computation subunit 311a is for calculating the character correlation degree percentage score in this region;Second calculates
Subelement 311b is for calculating the grey level histogram peak difference score in this region;3rd computation subunit 311c is used for calculating this region
Edge angular histogram peak difference score;4th computation subunit 311d is for calculating the edge angular histogram peak valley in this region
Area score;Addition subelement 311f is for by the first computation subunit 311a, the second computation subunit 311b, the 3rd calculating
The score that unit 311c, the 4th computation subunit 311d calculate is added, to obtain the feature score in this region.When feature score meter
When calculation unit 311 also includes weight subelement 311e, weight subelement 311e calculates son for addition subelement 311f by first
What unit 311a, the second computation subunit 311b, the 3rd computation subunit 311c, the 4th computation subunit 311d calculated obtains split-phase
In addition before, first by the character correlation degree percentage score in this region, grey level histogram peak difference score, edge angular histogram peak difference
Score and edge angular histogram peak valley area score are multiplied by a corresponding weight coefficient respectively;Wherein this four weight coefficients
Value is all 0~1, and sum is 1.In a preferred embodiment, the first computation subunit 311a is at the symbol of zoning
During number contrast percentage score, when the gray scale in a direction in this region is bright dimmed and secretly brighten percentage respectively closer to
50 percent, then the character correlation degree percentage score in this region is higher;Second computation subunit 311b is in zoning
During grey level histogram peak difference score, when in the grey level histogram in this region, if there is the gray scale of two obvious crests and crest
When value difference is bigger, then the grey level histogram peak difference score in this region is higher;3rd computation subunit 311c is in zoning
During edge angular histogram peak difference score, when in the angular histogram in this region, if two obvious crests of existence and difference are got over
During close to 180 degree, then the edge angular histogram peak difference score in this region is higher;4th computation subunit 311d is calculating this district
During the edge angular histogram peak valley area score in territory, when, in the angular histogram in this region, adding up each crest nearest with it
The area that two troughs are surrounded, if this area is more more than a threshold value, then the edge angular histogram peak valley area in this region obtains
Divide higher.
Whether feature score judging unit 313 is more than a feature score threshold value for the feature score judging this region
TconfidenceIf being more than, then this zone marker is useful by indexing unit 317, otherwise, then give up unit 309 and give up this region.
Morphological operation unit 319 is for carrying out morphological operation to being marked as useful region in indexing unit 317.
Morphological operation unit 319 includes expanding subelement and/or corrosion subelement (being not drawn in figure), wherein, expands subelement and uses
In the hole that filling is marked as in useful region, making region more regular, corrosion subelement is for removing isolated being labeled
For useful region.
Morphological operation unit 319 is selectable unit, and when embodiment includes unit 319, then region merging technique unit 321 is right
Carry out region merging technique through the useful region that is respectively marked as of morphological operation, obtain several bar code areas after merging
Territory;When embodiment does not includes unit 319, then region merging technique unit 321 is to being directly respectively marked as in indexing unit 317
Region carry out region merging technique, obtain several merge after the barcode size or text field.The implementation of region merging technique unit 321 can
With reference to step S321, not repeat them here.
Region screening unit 323 is for after region merging technique unit 321 merging obtains several the barcode size or text fields, for often
One the barcode size or text field, it is judged that the area in this region, length and wide whether meet a respective threshold condition, if not meeting, then gives up
Unit 309 gives up this barcode size or text field, if meeting, then this barcode size or text field is decoded by bar code recognition parts 500 again.District
Territory screening unit 323 is also selectable unit.
Fine positioning unit 327 meets the bar of respective threshold condition for bar code recognition parts 500 long-pending, length and width over there
Before shape code regional decoding, determine the center line of the barcode size or text field, and two squares of downward shift certain distance at the center line
In shape region, extract the angle point of each rectangular area respectively, carry out fitting a straight line, obtaining the exact position of bar code, and judge
Whether this barcode size or text field completely includes bar code, and if so, then this barcode size or text field is solved by bar code recognition parts 500 again
Code, otherwise, the barcode size or text field completion is the region completely including bar code, afterwards bar code recognition parts by completion unit 331
500 is that the region completely including bar code is decoded again to this completion.In one embodiment, completion unit 331 is that basis sets
The length and width of the bar code in the threshold condition put, respectively offset a spacing up and down at this barcode size or text field according to a certain percentage
From being the region comprising complete strips shape code by this barcode size or text field completion.Fine positioning unit 327 and completion unit 331 are also
Selectable unit.
Bar code recognition parts 500 are for being decoded to each the barcode size or text field respectively, to obtain representated by each bar code
Information.In a preferred embodiment, as shown in figure 17, bar code recognition parts 500 include correction unit 501 and/or projection
Unit 503.
Before region is decoded by correction unit 501 for bar code recognition parts 500, first this region is rotated
And distortion correction.In one embodiment, correct unit 501 and first determine pivot:After obtaining the exact position of bar code, according to
The position of four angle points determines the centre coordinate in region, and the intersection point of two dotted lines is required, as shown in figure 13 above (a);True again
Determine the anglec of rotation:The principal direction in statistical regions inward flange direction or average according to fitting a straight line gained angle, postrotational
Shown in bar code orientation such as figure 13 above (b).The introducing of correction unit 501 so that the application also can for the image that there is distortion
Being decoded, therefore the application has preferable robustness and environmental suitability.
Before region is decoded by projecting cell 503 for bar code recognition parts 500, first this region is thrown
Shadow, bar code recognition parts 500 are decoded further according to the projection in this region.The introducing of projecting cell 503 so that the application couple
In the not good bar code of printing quality, or defaced bar code also can be decoded, and is calculated the gray scale of projection by binaryzation
The mode of sum, increases the robustness of decoding.In one embodiment, projecting cell 503 can be to do postrotational image
Upright projection, add up its gray scale and average afterwards, gaussian filtering is carried out to the perspective view being formed, remove minor fluctuations and
Noise, detects edge and simultaneously adds up Edge Distance and be marked as different grades, and then bar code recognition parts 500 are carried out again
Decoding.
The application can obtain the multiple the barcode size or text fields in an image simultaneously, and the application do not require bar code it
Between there is fixed position deviation, it is not necessary to by template matching method positioning strip shape code, be suitable for position between bar code unfixed
Sight, such as mailbag sorting, joint strip code etc.;The application carries out bar code positioning for based on decision tree and region merging technique so that
In complex background, accurately obtain the position of bar code, improve stability and the accuracy of bar code positioning;The application is in decoding
Before carry out distortion correction to image, solve the problem that the surfaces such as column cannot decode, there is preferable robustness and environment adapts to
Property;The application is for the not good bar code of printing quality, or defaced bar code also can be decoded, and is calculated by binaryzation
The mode of the gray scale sum of projection, increases the robustness of decoding.
Above content is to combine the further description that the application is made by specific embodiment, it is impossible to assert this Shen
Being embodied as please is confined to these explanations.For the application person of an ordinary skill in the technical field, do not taking off
On the premise of the present application is conceived, some simple deduction or replace can also be made.
Claims (19)
1. a bar code read method, it is characterised in that include:
Image acquisition step, obtains the image comprising bar code;
Bar code positioning step, orients bar code from the image obtaining, specifically, including:
The image of acquisition is divided into the region of some non-overlapping copies;
For each region, calculate the feature score in this region, and judge whether the feature score in this region obtains more than a feature
Divide threshold value TconfidenceIt if being more than, then is useful by this zone marker, otherwise, then give up this region;Wherein, any one is calculated
During the feature score in region, the feature score in this region is equal to the character correlation degree percentage score in this region, grey level histogram
Peak difference score, edge angular histogram peak difference score and edge angular histogram peak valley area score sum;
Carry out region merging technique to being respectively marked as useful region, obtain several the barcode size or text fields after merging;
Bar code recognition step, is decoded to each the barcode size or text field respectively, to obtain the information representated by each bar code.
2. bar code read method as claimed in claim 1, it is characterised in that in bar code positioning step, calculate any
During the feature score in one region:
When the gray scale in a direction in this region is bright dimmed and the difference percentage that secretly brightens is closer to 50 percent, Ze Ci district
The character correlation degree percentage score in territory is higher;
When in the grey level histogram in this region, if the gray value difference that there is two obvious crests and crest is bigger, then this
The grey level histogram peak difference score in region is higher;
When in the angular histogram in this region, if there is two obvious crests and difference closer to 180 degree, then this region
Divide edge angular histogram peak difference score higher;
When, in the angular histogram in this region, adding up the area that each crest two trough nearest with it is surrounded, if this area
More be more than a threshold value, then the edge angular histogram peak valley area score in this region is higher.
3. bar code read method as claimed in claim 2, it is characterised in that in bar code positioning step, calculate any
During the feature score in one region, by the character correlation degree percentage score in this region, grey level histogram peak difference score, edge angle
Before histogram peak difference score and edge angular histogram peak valley area score are added, first by the character correlation degree percentage in this region
Than score, the poor score in grey level histogram peak, the poor score in edge angular histogram peak and edge angular histogram peak valley area score
It is multiplied by a corresponding weight coefficient respectively;Wherein this four weight coefficient values are all 0~1, and sum is 1.
4. bar code read method as claimed in claim 1, it is characterised in that described bar code positioning step also includes obtaining
After the region that the image taking is divided into some non-overlapping copies and calculate each region feature score before, for each region,
Image border percentage in image border, and zoning in acquisition region;Judge percentage shared by image border in region
Than whether more than percentage threshold TacceptIf being not more than, then giving up this region, if being more than, then calculating the feature in this region again
Score.
5. bar code read method as claimed in claim 1, it is characterised in that in bar code positioning step, marked to each
It is designated as before useful region carries out region merging technique, morphological operation, described shape will be carried out to being respectively marked as useful region
State operation includes expanding and/or corrosion;Wherein, expand for filling the hole being marked as in useful region, make region
More regular, corrosion isolated is marked as useful region for removing.
6. bar code read method as claimed in claim 5, it is characterised in that region is marked, gives up, merges and shape
State operates, and is to carry out at a mark figure, and wherein said mark figure includes the corresponding pixel of quantity with the region after segmentation, mark
A region after each pixel correspond to segmentation in note figure.
7. the bar code read method as according to any one of claim 1 to 6, it is characterised in that in bar code positioning step,
After region merging technique obtains several the barcode size or text fields, for each the barcode size or text field, it is judged that the area in this region, length and width are
No meeting a respective threshold condition, if not meeting, then giving up this barcode size or text field, if meeting, then in bar code recognition step
Again this barcode size or text field is decoded.
8. bar code read method as claimed in claim 7, it is characterised in that long-pending, long over there and width meets respective threshold
Before the barcode size or text field decoding of condition, also determine that the center line of the barcode size or text field, and downward shift one spacing at the center line
From two rectangular areas in, extract the angle point of each rectangular area respectively, carry out fitting a straight line, to obtain the accurate position of bar code
Put, and judge whether this barcode size or text field comprises complete bar code, if so, then carry out bar code recognition step, otherwise, then will
The barcode size or text field completion is the region comprising complete strips shape code, carries out bar code recognition step afterwards again.
9. the bar code read method as shown in claim 1, it is characterised in that in bar code recognition step, region is entered
Before row decoding, first carry out rotating and distortion correction to this region.
10. the bar code read method as shown in claim 1 or 9, it is characterised in that in bar code recognition step, to district
Before territory is decoded, first this region is projected, be decoded according to the projection in region.
11. 1 kinds of apparatus for reading of bar code, it is characterised in that include:
Image acquisition component, for obtaining the image comprising bar code;
Bar code positioning element, for orienting bar code from the image obtaining, specifically, including:
Cutting unit, for being divided into the region of some non-overlapping copies by the image of acquisition;
Feature score computing unit, for for each region, calculates the feature score in this region;Wherein, feature score calculates
Unit includes:
First computation subunit, for calculating the character correlation degree percentage score in this region;
Second computation subunit, for calculating the grey level histogram peak difference score in this region;
3rd computation subunit, for calculating the edge angular histogram peak difference score in this region;
4th computation subunit, for calculating the edge angular histogram peak valley area score in this region;
Addition subelement, for by described first computing unit subelement, the second computation subunit, the 3rd computation subunit and the
The score that four computation subunit calculate is added, to obtain the feature score in this region;
Feature score judging unit, whether the feature score for judging this region is more than feature score threshold value Tconfidence;
Indexing unit, the feature score for judging this region when feature score judging unit is more than described feature score threshold value
TconfidenceWhen, it is useful by this zone marker;
Give up unit, for judging that the feature score in this region is not more than described feature score threshold value when feature score judging unit
TconfidenceWhen, give up this region;
Region merging technique unit, for carrying out region merging technique to being respectively marked as useful region, obtains several bars after merging
Shape code region;
Bar code recognition parts, for being decoded to each the barcode size or text field respectively, to obtain the information representated by each bar code.
12. apparatus for reading of bar code as claimed in claim 11, it is characterised in that:
First computation subunit is when the character correlation degree percentage score of zoning, when the gray scale in a direction in this region is bright
Dimmed and secretly brighten that respectively percentage is closer to 50 percent, then the character correlation degree percentage score in this region is got over
High;
Second computation subunit is when the grey level histogram peak difference score of zoning, when in the grey level histogram in this region, if
Exist the gray value difference of two obvious crests and crest bigger when, then the grey level histogram peak difference score in this region is higher;
3rd computation subunit is when the edge angular histogram peak difference score of zoning, when the angular histogram in this region
In, if there is two obvious crests and difference closer to 180 degree, then the edge angular histogram peak difference score in this region is got over
High;
4th computation subunit is when calculating the edge angular histogram peak valley area score in this region, when the angle in this region is straight
In side's figure, add up the area that each crest two trough nearest with it is surrounded, if this area is more more than a threshold value, then this region
Edge angular histogram peak valley area score higher.
13. apparatus for reading of bar code as claimed in claim 12, it is characterised in that described feature score computing unit also includes
Weight subelement, for addition subelement by described first computing unit subelement, the second computation subunit, the 3rd calculating son list
Before the score that unit and the 4th computation subunit calculate is added, first by straight to the character correlation degree percentage score in this region, gray scale
Side's figure peak difference score, edge angular histogram peak difference score and edge angular histogram peak valley area score are multiplied by a phase respectively
The weight coefficient answered;Wherein this four weight coefficient values are all 0~1, and sum is 1.
14. apparatus for reading of bar code as claimed in claim 11, it is characterised in that described bar code positioning element also includes:
Image border percentage computing unit, for each region being partitioned into for cutting unit, obtains image limit in region
Edge, image border percentage in zoning;
Image border percentage judging unit, in being used for judging region, whether image border percentage is more than a percentage threshold
Value Taccept;If being not more than, then this region is given up by described unit of giving up, if being more than, then described feature score computing unit is counted again
Calculate the feature score in this region.
15. apparatus for reading of bar code as claimed in claim 11, it is characterised in that described bar code positioning element also includes shape
State operating unit, for region merging technique unit to being respectively marked as before useful region carries out region merging technique, will be to respectively
Being marked as useful region and carrying out morphological operation, described morphological operation unit includes expanding subelement and/or corrosion
Unit, wherein, expands subelement and is used for filling the hole being marked as in useful region, make region more regular, and corrosion is single
Unit isolated is marked as useful region for removing.
16. apparatus for reading of bar code as according to any one of claim 11 to 15, it is characterised in that described bar code positions
Parts also include region screening unit, for after region merging technique unit merges and obtains several the barcode size or text fields, for each
Individual the barcode size or text field, it is judged that the area in this region, length and wide whether meet a respective threshold condition, if not meeting, then described house
Abandoning unit and giving up this barcode size or text field, if meeting, then this barcode size or text field is decoded by bar code recognition parts again.
17. apparatus for reading of bar code as claimed in claim 16, it is characterised in that described bar code positioning element also includes essence
Positioning unit and completion unit;Fine positioning unit is for bar code recognition parts are long-pending, long over there and width meets respective threshold bar
Before the barcode size or text field decoding of part, determine the center line of the barcode size or text field, and downward shift certain distance at the center line
In two rectangular areas, extract the angle point of each rectangular area respectively, carry out fitting a straight line, to obtain the exact position of bar code,
And judge whether this barcode size or text field completely includes bar code, if so, then described bar code recognition parts to this barcode size or text field
It is decoded, otherwise, then the barcode size or text field completion is the region completely including bar code by completion unit, described afterwards bar code
Identification component is that the region completely including bar code is decoded again to this completion.
18. apparatus for reading of bar code as claimed in claim 11, it is characterised in that described bar code recognition parts include correction
Unit, before being decoded region, first carries out rotating and distortion correction to this region.
19. apparatus for reading of bar code as described in claim 11 or 18, it is characterised in that described bar code recognition parts also wrap
Including projecting cell, before being decoded region, first projecting this region, bar code recognition parts are further according to this district
The projection in territory is decoded.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610533119 | 2016-07-07 | ||
CN2016105331194 | 2016-07-07 |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106446750A true CN106446750A (en) | 2017-02-22 |
CN106446750B CN106446750B (en) | 2018-09-14 |
Family
ID=58169478
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610857241.7A Active CN106446750B (en) | 2016-07-07 | 2016-09-27 | A kind of bar code read method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106446750B (en) |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106934438A (en) * | 2017-02-28 | 2017-07-07 | 浙江华睿科技有限公司 | A kind of method and device of fast reaction QR yards of module alignment adjustment |
CN107025639A (en) * | 2017-04-05 | 2017-08-08 | 中科微至智能制造科技江苏有限公司 | A kind of Bar code positioning method under complex environment |
CN107403124A (en) * | 2017-07-31 | 2017-11-28 | 苏州经贸职业技术学院 | A kind of barcode detection recognition methods of view-based access control model image |
CN107908996A (en) * | 2017-10-25 | 2018-04-13 | 福建联迪商用设备有限公司 | A kind of method and terminal for extracting bar code information |
CN108009455A (en) * | 2017-11-07 | 2018-05-08 | 深圳市华汉伟业科技有限公司 | A kind of coding/decoding method and device of the scanning signal of bar code |
CN108176603A (en) * | 2017-12-25 | 2018-06-19 | 江苏宏宝锻造股份有限公司 | The more code name recognition methods of engine link and its automatic sorting apparatus |
CN109325380A (en) * | 2018-09-20 | 2019-02-12 | 摩尔元数(厦门)科技有限公司 | By configuring the method and system for realizing that label bar code automatically parses |
CN109886122A (en) * | 2019-01-23 | 2019-06-14 | 珠海市杰理科技股份有限公司 | Method for detecting lane lines, device, computer equipment and storage medium |
CN110348443A (en) * | 2019-08-14 | 2019-10-18 | 厦门大学 | Complex environment trees trunk multiple features separate statistical method and trunk recognition methods |
CN111476054A (en) * | 2020-05-07 | 2020-07-31 | 浙江华睿科技有限公司 | Decoding method and electronic equipment |
CN111639506A (en) * | 2020-05-29 | 2020-09-08 | 天津维创微智能科技有限公司 | Method and device for positioning bar code in image and code scanning equipment |
CN112101059A (en) * | 2020-08-18 | 2020-12-18 | 深圳市优必选科技股份有限公司 | Bar code positioning method and device, terminal equipment and storage medium |
CN112118433A (en) * | 2019-06-20 | 2020-12-22 | 青岛海信激光显示股份有限公司 | Image display method and laser projection apparatus |
CN113095102A (en) * | 2021-03-31 | 2021-07-09 | 深圳市华汉伟业科技有限公司 | Method for positioning bar code area |
EP3961477A1 (en) | 2020-08-24 | 2022-03-02 | Saint-Gobain Glass France | Method for detecting and reading a matrix code marked on a glass substrate |
CN115759148A (en) * | 2023-01-10 | 2023-03-07 | 深圳思谋信息科技有限公司 | Image processing method, image processing device, computer equipment and computer readable storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102799850A (en) * | 2012-06-30 | 2012-11-28 | 北京百度网讯科技有限公司 | Bar code recognition method and device |
CN103870790A (en) * | 2014-04-02 | 2014-06-18 | 胡建国 | Recognition method and device of two-dimensional bar code |
CN103927511A (en) * | 2014-02-25 | 2014-07-16 | 华北电力大学(保定) | Image identification method based on difference feature description |
CN104112132A (en) * | 2014-07-03 | 2014-10-22 | 中国人民解放军第二炮兵工程大学 | Automatic gun number identification method |
CN104751187A (en) * | 2015-04-14 | 2015-07-01 | 山西科达自控股份有限公司 | Automatic meter-reading image recognition method |
CN105335744A (en) * | 2015-11-10 | 2016-02-17 | 佛山科学技术学院 | One-dimensional code region location based on image backbone extraction strip distribution features |
-
2016
- 2016-09-27 CN CN201610857241.7A patent/CN106446750B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102799850A (en) * | 2012-06-30 | 2012-11-28 | 北京百度网讯科技有限公司 | Bar code recognition method and device |
CN103927511A (en) * | 2014-02-25 | 2014-07-16 | 华北电力大学(保定) | Image identification method based on difference feature description |
CN103870790A (en) * | 2014-04-02 | 2014-06-18 | 胡建国 | Recognition method and device of two-dimensional bar code |
CN104112132A (en) * | 2014-07-03 | 2014-10-22 | 中国人民解放军第二炮兵工程大学 | Automatic gun number identification method |
CN104751187A (en) * | 2015-04-14 | 2015-07-01 | 山西科达自控股份有限公司 | Automatic meter-reading image recognition method |
CN105335744A (en) * | 2015-11-10 | 2016-02-17 | 佛山科学技术学院 | One-dimensional code region location based on image backbone extraction strip distribution features |
Cited By (27)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106934438B (en) * | 2017-02-28 | 2019-11-19 | 浙江华睿科技有限公司 | A kind of method and device of fast reaction QR code module alignment adjustment |
CN106934438A (en) * | 2017-02-28 | 2017-07-07 | 浙江华睿科技有限公司 | A kind of method and device of fast reaction QR yards of module alignment adjustment |
CN107025639A (en) * | 2017-04-05 | 2017-08-08 | 中科微至智能制造科技江苏有限公司 | A kind of Bar code positioning method under complex environment |
CN107403124A (en) * | 2017-07-31 | 2017-11-28 | 苏州经贸职业技术学院 | A kind of barcode detection recognition methods of view-based access control model image |
CN107908996A (en) * | 2017-10-25 | 2018-04-13 | 福建联迪商用设备有限公司 | A kind of method and terminal for extracting bar code information |
CN107908996B (en) * | 2017-10-25 | 2020-12-15 | 福建联迪商用设备有限公司 | Method and terminal for extracting one-dimensional bar code information |
CN108009455A (en) * | 2017-11-07 | 2018-05-08 | 深圳市华汉伟业科技有限公司 | A kind of coding/decoding method and device of the scanning signal of bar code |
CN108009455B (en) * | 2017-11-07 | 2019-04-30 | 深圳市华汉伟业科技有限公司 | A kind of coding/decoding method and device of the scanning signal of bar code |
CN108176603A (en) * | 2017-12-25 | 2018-06-19 | 江苏宏宝锻造股份有限公司 | The more code name recognition methods of engine link and its automatic sorting apparatus |
CN109325380A (en) * | 2018-09-20 | 2019-02-12 | 摩尔元数(厦门)科技有限公司 | By configuring the method and system for realizing that label bar code automatically parses |
CN109325380B (en) * | 2018-09-20 | 2021-10-26 | 摩尔元数(福建)科技有限公司 | Method and system for realizing automatic analysis of label bar code through configuration |
CN109886122A (en) * | 2019-01-23 | 2019-06-14 | 珠海市杰理科技股份有限公司 | Method for detecting lane lines, device, computer equipment and storage medium |
CN112118433A (en) * | 2019-06-20 | 2020-12-22 | 青岛海信激光显示股份有限公司 | Image display method and laser projection apparatus |
CN110348443A (en) * | 2019-08-14 | 2019-10-18 | 厦门大学 | Complex environment trees trunk multiple features separate statistical method and trunk recognition methods |
CN110348443B (en) * | 2019-08-14 | 2022-04-01 | 厦门大学 | Multi-feature separation statistical method for tree trunk in complex environment and trunk identification method |
CN111476054A (en) * | 2020-05-07 | 2020-07-31 | 浙江华睿科技有限公司 | Decoding method and electronic equipment |
CN111476054B (en) * | 2020-05-07 | 2022-03-08 | 浙江华睿科技股份有限公司 | Decoding method and electronic equipment |
CN111639506A (en) * | 2020-05-29 | 2020-09-08 | 天津维创微智能科技有限公司 | Method and device for positioning bar code in image and code scanning equipment |
CN111639506B (en) * | 2020-05-29 | 2023-07-04 | 天津维创微智能科技有限公司 | Positioning method and device for bar codes in image and code scanning equipment |
CN112101059A (en) * | 2020-08-18 | 2020-12-18 | 深圳市优必选科技股份有限公司 | Bar code positioning method and device, terminal equipment and storage medium |
CN112101059B (en) * | 2020-08-18 | 2023-10-10 | 深圳市优必选科技股份有限公司 | Bar code positioning method, bar code positioning device, terminal equipment and storage medium |
EP3961477A1 (en) | 2020-08-24 | 2022-03-02 | Saint-Gobain Glass France | Method for detecting and reading a matrix code marked on a glass substrate |
WO2022042961A1 (en) | 2020-08-24 | 2022-03-03 | Saint-Gobain Glass France | Method for detecting and reading a matrix code marked on a glass substrate |
CN113095102A (en) * | 2021-03-31 | 2021-07-09 | 深圳市华汉伟业科技有限公司 | Method for positioning bar code area |
CN113095102B (en) * | 2021-03-31 | 2022-07-19 | 深圳市华汉伟业科技有限公司 | Method for positioning bar code area |
CN115759148A (en) * | 2023-01-10 | 2023-03-07 | 深圳思谋信息科技有限公司 | Image processing method, image processing device, computer equipment and computer readable storage medium |
CN115759148B (en) * | 2023-01-10 | 2023-04-28 | 深圳思谋信息科技有限公司 | Image processing method, device, computer equipment and computer readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN106446750B (en) | 2018-09-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106446750A (en) | Bar code reading method and device | |
CN107491730A (en) | A kind of laboratory test report recognition methods based on image procossing | |
CN107247950A (en) | A kind of ID Card Image text recognition method based on machine learning | |
CN105913093B (en) | A kind of template matching method for Text region processing | |
CN101142584B (en) | Method for facial features detection | |
CN108830188A (en) | Vehicle checking method based on deep learning | |
CN110348319A (en) | A kind of face method for anti-counterfeit merged based on face depth information and edge image | |
CN104951940B (en) | A kind of mobile payment verification method based on personal recognition | |
CN111401372A (en) | Method for extracting and identifying image-text information of scanned document | |
CN107230203A (en) | Casting defect recognition methods based on human eye vision attention mechanism | |
CN106610969A (en) | Multimodal information-based video content auditing system and method | |
Ruz et al. | Automated visual inspection system for wood defect classification using computational intelligence techniques | |
CN1322471C (en) | Comparing patterns | |
CN104282008B (en) | The method and apparatus that Texture Segmentation is carried out to image | |
CN110298376A (en) | A kind of bank money image classification method based on improvement B-CNN | |
CN109740572A (en) | A kind of human face in-vivo detection method based on partial color textural characteristics | |
CN105184225B (en) | A kind of multinational banknote image recognition methods and device | |
CN108268865A (en) | Licence plate recognition method and system under a kind of natural scene based on concatenated convolutional network | |
CN113313149B (en) | Dish identification method based on attention mechanism and metric learning | |
CN102930251A (en) | Two-dimensional collection data recording and discriminating device and method | |
CN100437628C (en) | Automatic digitization of garment patterns | |
CN110032654A (en) | A kind of supermarket's commodity input method and system based on artificial intelligence | |
CN113033558A (en) | Text detection method and device for natural scene and storage medium | |
CN115082776A (en) | Electric energy meter automatic detection system and method based on image recognition | |
CN105809625A (en) | Fragment reconstruction method based on local texture pattern |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |