CN106709487A - Animal ear tag matrix encoding identification method and device - Google Patents
Animal ear tag matrix encoding identification method and device Download PDFInfo
- Publication number
- CN106709487A CN106709487A CN201611112114.0A CN201611112114A CN106709487A CN 106709487 A CN106709487 A CN 106709487A CN 201611112114 A CN201611112114 A CN 201611112114A CN 106709487 A CN106709487 A CN 106709487A
- Authority
- CN
- China
- Prior art keywords
- image
- pixel
- coding region
- encoder matrix
- value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- A—HUMAN NECESSITIES
- A01—AGRICULTURE; FORESTRY; ANIMAL HUSBANDRY; HUNTING; TRAPPING; FISHING
- A01K—ANIMAL HUSBANDRY; AVICULTURE; APICULTURE; PISCICULTURE; FISHING; REARING OR BREEDING ANIMALS, NOT OTHERWISE PROVIDED FOR; NEW BREEDS OF ANIMALS
- A01K11/00—Marking of animals
- A01K11/001—Ear-tags
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/22—Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/24—Aligning, centring, orientation detection or correction of the image
- G06V10/243—Aligning, centring, orientation detection or correction of the image by compensating for image skew or non-uniform image deformations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/44—Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/24—Aligning, centring, orientation detection or correction of the image
- G06V10/247—Aligning, centring, orientation detection or correction of the image by affine transforms, e.g. correction due to perspective effects; Quadrilaterals, e.g. trapezoids
Landscapes
- Engineering & Computer Science (AREA)
- Life Sciences & Earth Sciences (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Environmental Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Birds (AREA)
- Zoology (AREA)
- Animal Husbandry (AREA)
- Biodiversity & Conservation Biology (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
The invention discloses an animal ear tag matrix encoding identification method and device, and relates to the technical field of computers. The method comprises the following steps of: obtaining an image of an encoding region of animal tags; carrying out white-black binary processing on the image of the encoding region; determining the number of lines and number of rows of an encoding matrix in the encoding area after the binary processing by utilizing a protection segmentation algorithm; carrying out grid generation on the encoding region according to the determined number of lines and number of rows; and decoding the encoding matrix according to pixel values of pixel points in each grid, and identifying information of animals included in the encoding matrix. According to the method, the images of the encoding region of the animal tags is acquired, and the encoding matrix of the encoding region is divided and decoded by utilizing the projection segmentation method, so that the reading of animal tag matrix codes is realized; and the method is strong in university, is suitable for various devices capable of acquiring and processing images, is simple and convenient to apply, and can carry out real-time decoding to realize decoding during shooting.
Description
Technical field
The present invention relates to field of computer technology, the recognition methods of more particularly to a kind of animal ear tag square matrix code and dress
Put.
Background technology
In order to ensure the food security of the meat products such as pig, ox, sheep, from " production-epidemic prevention-quarantine-transport-slaughter
The links such as government official-distribution " strengthen supervision, are taken the lead by China Animal Disease Control And Prevention Center of the Ministry of Agriculture, have built covering entirely
" animal identification and the animal product tracing information system " of state is (hereinafter referred to as:Traceability system).Traceability system is by " counterfeit-proof type matrix
Quick Response Code " is printed on ear tag, and every livestock wears ear tag once being born, it is established that lifelong unique identity tag (ear tag
Number), the basis as whole information-based traceability system.For the even running of traceability system, Ministry of Agriculture's specification ear tag is effectively ensured
The number assignment of square matrix code, production and distribution flow, work out and issue《Livestock tag technical specification》It is etc. technical standard and fixed
Phase is spot-check to the ear tag quality of production.As shown in Figure 1, to be respectively used to the counterfeit-proof type animal identification square matrix code of pig, ox, sheep
Ear tag.
It is contemplated that the counterfeit-proof type square matrix code printed on animal ear tag, with common QRCode, Data Matrix
Morphologically it is very different Deng Quick Response Code, such as does not have the positioning figure on common Quick Response Code on animal ear tag square matrix code
Deng existing Quick Response Code machine distinguishes algorithm, can not be used to recognize counterfeit-proof type animal ear tag square matrix code.
The content of the invention
A purpose being realized of the invention is:Propose a kind of recognition methods of animal ear tag square matrix code.
According to an aspect of the present invention, there is provided a kind of animal ear tag square matrix code recognition methods, including:Obtain animal
The image of the coding region of ear tag;The image of coding region is carried out into black white binarization treatment;Using projection localization algorithm, it is determined that
The line number and columns of encoder matrix in coding region after binary conversion treatment;Line number and columns according to determining enter coding region
The division of row grid;Pixel value according to pixel in each grid is decoded to encoder matrix, and identification encoder matrix is included
Animal information.
According to another aspect of the present invention, there is provided a kind of animal ear tag square matrix code identifying device, including:Image is obtained
Modulus block, the image of the coding region for obtaining animal ear tag;Binary conversion treatment module, for the image of coding region to be entered
The treatment of row black white binarization;Encoder matrix analysis module, for utilizing projection localization algorithm, determines the coding after binary conversion treatment
The line number and columns of encoder matrix in region;Encoder matrix division module, for according to the line number and columns for determining by code area
Domain carries out the division of grid;Decoder module, for being decoded to encoder matrix according to the pixel value of pixel in each grid,
The information of the animal that identification encoder matrix is included.
The IMAQ that the present invention passes through the coding region to animal ear tag, and using projection localization method to coding region
Encoder matrix is divided and decoded, so that the recognition to animal ear tag square matrix code is realized, the method highly versatile, it is adaptable to
The various devices that can be gathered image and carry out image procossing, using simple and convenient, can realize clapping i.e. solution with real-time decoding.
By referring to the drawings to the detailed description of exemplary embodiment of the invention, further feature of the invention and its
Advantage will be made apparent from.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
The accompanying drawing to be used needed for having technology description is briefly described, it should be apparent that, drawings in the following description are only this
Some embodiments of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can be with
Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 shows the schematic diagram of animal ear tag.
Fig. 2A shows the schematic diagram of QR code Quick Response Codes in the prior art.
Fig. 2 B show the schematic diagram of pig ear tag square matrix code.
Fig. 3 shows the schematic flow sheet of the recognition methods of the animal ear tag square matrix code of one embodiment of the present of invention.
Fig. 4 A, 4B, 4C show the schematic diagram of fast zenith location algorithm of the invention.
Fig. 5 A show the schematic diagram of the image for carrying out the coding region before trapezoidal distortion correction algorithm of the invention.
Fig. 5 B show the schematic diagram of the image for carrying out the coding region after trapezoidal distortion correction algorithm of the invention.
Fig. 6 A show the perspective view of the coding region of projection localization algorithm of the invention.
Fig. 6 B show the mesh generation schematic diagram of the coding region of projection localization algorithm of the invention.
Fig. 7 shows the schematic flow sheet of the recognition methods of the animal ear tag square matrix code of an alternative embodiment of the invention.
Fig. 8 shows the structural representation of the identifying device of the animal ear tag square matrix code of one embodiment of the present of invention.
Fig. 9 shows the structural representation of the identifying device of the animal ear tag square matrix code of an alternative embodiment of the invention.
Specific 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 carried out clear, complete
Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.Below
Description only actually at least one exemplary embodiment is illustrative, and never conduct is to the present invention and its application or makes
Any limitation.Based on the embodiment in the present invention, those of ordinary skill in the art are not making creative work premise
Lower obtained every other embodiment, belongs to the scope of protection of the invention.
For animal ear tag square matrix code and the difference of common Quick Response Code, a kind of identification side of animal ear tag square matrix code is proposed
Method.
Inventor has found, false proof square matrix code on animal ear tag and Quick Response Code common in the art have it is very big not
Together, for example comprising figure or symbol, format information etc. is positioned in QR Code, Data Matrix, as shown in Figure 2 A, with QR
As a example by Code, including position sensing image graphics is easy to directly determine the position of coding region, and version information and format information are
For the auxiliary information for decoding, positioning figure is for dividing the position line that the black and white of coding region is spaced, according to this during identification
A little information can be quickly the coding region in Quick Response Code is positioned, and then black and white lattice in coding region are determined,
Finally decoded.And not comprising the information of these positioning in animal ear tag square matrix code, specifically, being with the ear tag square matrix code of pig
Example, as shown in Figure 2 B, the square matrix code on ear tag only includes the code area of frame outer quiet zone, surrounding solid border and data
Domain, and also include that physics bore area is used to wear in the middle of the ear tag square matrix code of pig, cannot using existing two-dimensional code identification method
Square matrix code on animal ear tag is identified, and the identifying schemes of the animal ear tag square matrix code in this programme are complete with prior art
It is complete different.
The recognition methods of animal ear tag square matrix code of the present invention is described with reference to Fig. 2 B and Fig. 3.
Fig. 3 is the flow chart of recognition methods one embodiment of animal ear tag square matrix code of the present invention.As shown in figure 3, the reality
The method for applying example includes:
Step S302, obtains the image of the coding region of animal ear tag.
Specifically, the image of collection animal ear tag, determines each top of the image of coding region in the image of animal ear tag
Point, the image in each summit join domain is defined as the image of coding region, the image of coding region is carried out trapezoidal abnormal
Become correction, acquisition is shaped as rectangle, the image of the coding region of shooting angle front vertical.
Wherein, the image of animal ear tag is gathered, for example, will be worn on animal ear by the device with shoot function
Ear tag be filmed the image to form animal ear tag.For example during shooting animal ear tag using smart mobile phone need to call
Intelligent mobile phone platform camera gathers image, using Autofocus Technology, ear tag square matrix code image is scanned in mobile phone screen
Shot again after clear displaying in frame.When animal ear tag remains static can be by adjusting filming apparatus only by animal ear
The image taking of target coding region gets off, and in actual application, when shooting is worn on the animal ear tag on animal ear,
Chaff interference in environment beyond coding region would generally be also shot into image, accordingly, it would be desirable to further determine that code area
The image in domain.
Being different from some common Quick Response Codes has the figure or symbol of position sensing or positioning, and animal ear tag square matrix code does not have
There are the figure or symbol for determining coding region, therefore, the present invention also provides a kind of for determining the image of coding region
Fast zenith localization method, determines each summit of the image of coding region in the image of animal ear tag, by the connection of each summit
In the range of image be defined as the image of coding region, detailed process will subsequently be described.
Further, the rotation of image is may result in due to the problem of shooting angle, the coding region that will can be extracted
One side of image rotated, base level is kept, because animal ear tag square matrix code does not position figure or symbol, therefore nothing
Method ensure the base of each determination be it is correct, can be in identification process, if cannot once be decoded after rotation, can be by
Code area image rotates to another side again carries out subsequent decoding process again as base, repeats said process, until figure
Each side all decoded as base after still None- identified, it is determined that decoding failure.
Further, the gatherer process of image may cause the deformation of the image of coding region, the figure of such as coding region
As being originally that anamorphose is trapezoidal when square shoots, it is unfavorable for follow-up decoding process, therefore the present invention also provides a kind of ladder
Shape distortion correction algorithm, for by the image flame detection of coding region be rectangle and shooting angle front vertical, subsequently will be to ladder
Shape distortion correction algorithm is specifically described.
Step S304, black white binarization treatment is carried out by the image of coding region.
Shape criteria is obtained, then to figure after the image of the coding region of shooting angle front vertical (as shown in Figure 2 B)
As carrying out binary conversion treatment, by the image procossing of coding region into the image for only including black pixel point and white pixel point.
Step S306, using projection localization algorithm, determines the line number of encoder matrix in the coding region after binary conversion treatment
And columns.
Wherein, projection localization algorithm will subsequently be described.
Step S308, encoder matrix is carried out the division of grid according to the line number and columns that determine.
Wherein, the division of grid is carried out to encoder matrix, then encoder matrix can be divided different black and white grids.
Step S310, the pixel value according to pixel in each grid is decoded to encoder matrix, recognizes encoder matrix
Comprising animal information.
Specifically, calculate the pixel value of pixel in each grid and/or pixel average, by pixel value and/or picture
Plain average value is contrasted with preset value, and if above preset value, then the grid is reduced to 1, the grid if less than preset value
0 is reduced to, the binary value of encoder matrix is determined, the binary value of encoder matrix is decoded according to default decoding rule.
The gray value of black pixel point is 255 in ear tag square matrix code, and the gray value of white pixel point is 0, ideally, division
In coding region in black lattice only have black pixel point, in white square only have white pixel point, but in image processing process by
Deviation etc. is there may be in the brightness of image of collection and the process of grid division, the entirety for obtaining image can be first processed
Intensity deviation, then uses deviant to carry out the modes such as correction threshold and causes that decoding is more accurate.Relative to common QRCode etc.
Quick Response Code, ear tag square matrix code can store more data, and the features such as modification with capacity even-odd check card and error code, it is wrong
Error detection and corrected rate are up to 15% to 25%, and coding redundancy degree is very high, therefore, can accurately to dynamic using this programme
Thing ear tag square matrix code is identified.
The IMAQ that the method for above-described embodiment passes through the coding region to animal ear tag, and utilize projection localization method pair
The encoder matrix of coding region is divided and decoded, so as to realize the recognition to animal ear tag square matrix code, the method is general
Property it is strong, it is adaptable to the various devices that can be gathered image and carry out image procossing, using simple and convenient, can be real with real-time decoding
Now clap and solve.
Application Fast Fixed-point location algorithm extracts coding in animal ear tag during this programme is mentioned in the method for above-described embodiment
The image in region, corrects using trapezoidal distortion correction algorithm to the image of coding region, determines using projection localization algorithm
Three kinds of algorithms are described by the line number and columns of encoder matrix in turn below.
With reference to the fast zenith location algorithm in Fig. 4 A, Fig. 4 B and Fig. 4 C description present invention.
Fast zenith location algorithm is comprised the following steps:
(1) apex in the image of animal ear tag makees the straight line of the image diagonal parallel to animal ear tag respectively.
So that shooting image is as rectangle as an example, as shown in Figure 4 A, by the left upper apex of the image of animal ear tag, one is drawn tiltedly
Do in the same way parallel to cornerwise straight line on the straight line of 45 ° (from upper right to lower-left), other three summits.
(2) straight line is moved to the center of the image of animal ear tag, and detects the pixel overlapped with straight line in moving process
Point.
As shown in Figure 4 A, four straight lines are moved to the center of the image of animal ear tag respectively along arrow direction, is moved
Dynamic process cathetus can overlap with the pixel in image, detect that the pixel characteristic of these pixels for overlapping is judged.
(3) if the pixel value for pixel overlapped with straight line is higher than threshold value, and meet around the coincident pixel point
The pixel value of the pixel in the range of continuous angle is higher than threshold value, and the pixel value of the pixel in addition to the continuous angular range is low
In the condition of threshold value, then the pixel is defined as the summit of the image of coding region.
As shown in Figure 4 B, the black pixel point of coincidence is detected during rectilinear movement, due to the influence of brightness of image etc., is needed
Threshold value is set, rgb value is identified as black pixel point more than the pixel of threshold value, further detect the picture around the pixel
The pixel characteristic of vegetarian refreshments, can be seen that the pixel on coding region summit has following characteristics with reference to the image in Fig. 2 B, i.e. week
Enclose that the pixel in the range of continuous 90 degree is black pixel point and the pixel in the range of 270 degree of surrounding quiet zone is white
Pixel.The feature of the black pixel point surrounding pixel point overlapped with straight line based on this feature detection, will can shoot into figure
The pixel of other chaff interferences of picture is excluded.If being not detected by stain, line segment is prolonged into the parallel propulsion of diagonal, examined again
Survey, progressively determine each summit of coding region, as shown in Figure 4 C.
(4) image in each summit join domain is defined as the image of coding region.
It should be noted that being according to each in the direction of straight line and moving process successively detection image during practical operation
Pixel.Each pixel of other modes successively in detection image can also be selected, for example by with animal ear tag image
Four straight lines that four edges overlap are moved to center parallel, and detect whether the pixel overlapped with straight line in moving process meets
Condition or whether each pixel successively in detection image meets condition in a certain order.In view of in shooting process
The various shooting angle of image, the top of coding region can be faster detected using the detection method of the pixel of this programme
Point.
Trapezoidal distortion correction algorithm of the invention is described with reference to Fig. 5 A and Fig. 5 B.
Trapezoidal distortion correction algorithm is comprised the following steps:
(1) according to correction before coding region image each summit coordinate value, it is determined that correct after coding region figure
The coordinate value on each summit of picture.
Inventor by testing repeatedly, and the perspective transform formula applied in this algorithm is as follows:
As shown in Figure 5 A, the anamorphose of coding region is trapezoidal before correcting.Set up coordinate system, it is assumed that image before correction
Four apex coordinates are (x1,y1),(x2,y2),(x3,y3),(x4,y4), it is assumed that coding region image is square this feature,
The coordinate on four summits before according to correction be would know that correction after coding region image each summit coordinate value (x '1,
y′1), (x '2,y′2), (x '3,y′3), (x '4,y′4)。
(2) coordinate value according to each summit before the correction and coordinate value on each summit determines perspective transform formula after correcting
Parameter.
The coordinate value on each summit is brought into formula (1) before correcting and after correction, can obtain following two equation groups:
And then, can be in the hope of parameter a, b, c, d and the m in perspective transform formula, n, p, q.
(3) coordinate value of each pixel of the image of coding region is mapped as rectifying before being corrected according to perspective transform formula
The coordinate value of each pixel of the image of coding region after just.
Determine parameter a, b, c, d and the m in perspective transform formula, n, p after q, can be rectified according to perspective transform formula
It is the coordinate (x ', y ') of the image after correction after any point (x, y) conversion in just preceding coding region in addition to four summits,
And then obtain such as the image in Fig. 5 B.Be there may be in image after being corrected some blank spots i.e. cannot be by correction before
The point that pixel is obtained, these points can be filled using linear interpolation method.
The method of above-described embodiment, can correct the deformation of caused image in shooting process so that decoding is more accurate.
Projection localization algorithm of the invention is described with reference to Fig. 6 A and Fig. 6 B.
Projection localization algorithm is comprised the following steps:
(1) pixel value for the pixel in the image of the coding region after binary conversion treatment per a line adds up,
And horizontal projective histogram is formed, horizontal projective histogram is made up of multiple vertical bars.
As shown in Figure 6A, if the aggregate-value of two row pixels is equal or be more or less the same, it is evident that this should be sampling same
Two row pixels (because each black and white grid is identical, gray value is accumulative certainly the same) in one row grid, if otherwise differing
It is very big, it can be determined that this row pixel is sampling at sideline.Therefore, it can be formed histogram as shown in FIG.
(2) vertical bar included according to horizontal projective histogram determines the line number of encoder matrix.
Specifically, estimating for the line number of encoder matrix is obtained divided by the width of vertical bar using the overall width of horizontal projective histogram
Evaluation, estimate is contrasted with the line number of different size encoder matrix, and the line number of the specification of estimate convergence is defined as
The line number of encoder matrix.
The width of vertical bar can be obtained according to the distance of the adjacent crest of horizontal projective histogram (or trough), be designated as h, example
Such as, if adjacent continuous 50 samplings row, its projection aggregate-value is all identical, then the width that may infer that grid should be 50 pictures
Element, i.e. h are 50.But actual application, due to the influence of various factors, the pixel value of 50 adjacent rows is always changed, no
May be every time step at whole 50 pixels, it may be possible to 48 or 49 pixels, it is also possible to 51 or 52 pixels, this is all normal
, classification polymerization, the comprehensive width value for obtaining final vertical bar can be carried out according to these values.The beam overall of horizontal projective histogram
The distance for spending the crest for two ends is designated as H, then the line number of encoder matrix is N=H/h-2, wherein, due to histogram two ends
Vertical bar represents the pixel accumulated value of frame, it is therefore desirable to subtract the line number of 2 acquisition encoder matrixs.The coding square of current animal ear tag
Battle array for 16 row 16 row and 20 rows 20 arrange, be calculated after N, using the closer specifications of N as encoder matrix line number, such as N
It is 16.5, it is determined that the line number N ' of encoder matrix is 16.Determine the line number N ' of encoder matrix afterwards, can be average by coding region
It is divided into the rows of N '+2,2 is frame number, is divided into not coding region by being determined using identical method after the columns of encoder matrix
Same grid, as shown in Figure 6B.
(3) pixel value for the pixel of each row in the image of the coding region after binary conversion treatment adds up,
And vertical projection histogram is formed, vertical projection histogram is made up of multiple vertical bars.
(4) vertical bar included according to vertical projection histogram determines the columns of encoder matrix.
Specifically, the estimation of the columns of rectangular code is obtained divided by the width of vertical bar using the histogrammic overall width of vertical projection
Value, estimate is contrasted with the columns of different size encoder matrix, and the line number of the specification of estimate convergence is defined as to compile
Code matrix column number.The columns of encoder matrix may be referred to the determination method of the line number of afore-mentioned code matrix.
If it should be noted that determine encoder matrix ranks number during count vertical bar width rule it is unobvious, very
It is probably the presence of noise spot in previous process, causes summit misjudgment or other mistakes.During real-life program, it is
Quickening speed, often just can directly judge that encoder matrix ranks number determines failure, into next round algorithm performs, without
Failure have to be decoded just to return.
The method of above-described embodiment, can effectively solve animal ear tag square matrix code due to without positioning figure or symbol
The problem of ranks number cannot be determined, be capable of the accurate decoding of solid line animal ear tag square matrix code.
The recognition methods of animal ear tag square matrix code of the invention possesses IMAQ and has certain image suitable for various
The device of disposal ability, such as smart mobile phone, panel computer etc., by the decoding software for increasing corresponding animal ear tag square matrix code
Or application, it is possible to achieve clap and solve, the information of animal ear tag is obtained in real time.
Fig. 7 is combined by taking smart mobile phone as an example below, describe the recognition methods of animal ear tag square matrix code of the present invention one should
Use-case.
Step S702, calls intelligent mobile phone platform camera to gather the image of animal ear tag, using Autofocus Technology,
The image of animal ear tag is set clearly to show in mobile phone screen scan box.
Step S704, according to the feature of animal ear tag square matrix code, analysis and locking from the image of the animal ear tag of collection
The coding region of animal ear tag, performs fast zenith location algorithm, determines summit and extracts code area.
Wherein, fast zenith location algorithm refers to previous embodiment.
Step S706, the image of the coding region to extracting carries out rotation processing, and the base of rotation to coding region is protected
Water holding is put down.
Wherein, if cannot be decoded after once rotating, code area image can be again rotated to another side as base
Subsequent decoding process is carried out again, said process is repeated, until cannot still know after each side of figure is all decoded as base
Not, it is determined that decoding failure.
Step S708, the image of the coding region to extracting carries out trapezoidal distortion correction, corrects to the figure of coding region
As being front vertical for square, shooting angle.
Step S710, the image of the coding region to correcting does black white binarization treatment.
Step S712, the line number and columns of encoder matrix are determined using projection localization algorithm, position the edge of row and column, are made
Coding region is split with sampling grid.
Step S714, the pixel value to the pixel in each net of grid lines segmentation is compared with threshold value, from coding
Reduction obtains the encoder matrix being made up of 0 and 1 in the image in region.
Step S716, according to the decoding rule of counterfeit-proof type animal identification ear tag square matrix code, decodes binary encoder matrix,
Type of animal, district id yards, serial number this three partial content of tracing to the source are extracted, after being converted into administrative area code by district id yards,
Obtain final animal ear tag number and export and show.
The present invention also provides a kind of identifying device of animal ear tag square matrix code, is described with reference to Fig. 8.
Fig. 8 is the structure chart of identifying device one embodiment of animal ear tag square matrix code of the present invention.As shown in figure 8, the dress
Putting 80 includes:
Image collection module 802, the image of the coding region for obtaining animal ear tag.
Binary conversion treatment module 804, for the image of coding region to be carried out into black white binarization treatment.
Encoder matrix analysis module 806, for utilizing projection localization algorithm, in determining the coding region after binary conversion treatment
The line number and columns of encoder matrix.
Encoder matrix division module 808, the division for coding region to be carried out grid according to the line number and columns that determine.
Decoder module 810, for being decoded to encoder matrix according to the pixel value of pixel in each grid, identification is compiled
The information of the animal that code matrix is included.
Specifically, decoder module 810, the pixel value and/or pixel average for calculating pixel in each grid,
By pixel value and/or pixel average contrasted with preset value, if above preset value, then the grid is reduced to 1, if low
In preset value, then the grid is reduced to 0, determines the binary value of encoder matrix, according to default decoding rule to the two of encoder matrix
Hex value is decoded.
Another embodiment of the identifying device of animal ear tag square matrix code of the present invention is described with reference to Fig. 9.
Fig. 9 is the structure chart of identifying device one embodiment of animal ear tag square matrix code of the present invention.As shown in figure 9,
Image collection module 802 includes:
Image acquisition units 8021, the image for gathering animal ear tag.
Coding region determining unit 8022, for each top of the image of coding region in the image for determining animal ear tag
Point, the image in each summit join domain is defined as the image of coding region.
Specifically, coding region determining unit 8022, for the image in animal ear tag apex make respectively parallel to
The straight line of the image diagonal of animal ear tag, straight line is moved to the center of the image of animal ear tag, and detects moving process
The pixel overlapped with straight line, if the pixel value for pixel overlapped with straight line is higher than threshold value, and meets the coincidence picture
The pixel value of the pixel around vegetarian refreshments in the range of continuous angle is higher than threshold value, and pixel in addition to the continuous angular range
The pixel is then defined as the summit of the image of coding region less than the condition of threshold value for pixel value, and each summit is connected into model
Image in enclosing is defined as the image of coding region.
Image flame detection unit 8023, trapezoidal distortion correction is carried out for the image to coding region, and acquisition is shaped as rectangle,
The image of the coding region of shooting angle front vertical.
Specifically, image flame detection unit 8023, for the coordinate according to each summit of the image of coding region before correction
Value, it is determined that after correction each summit of the image of coding region coordinate value, coordinate value according to each summit before correction and strong
The coordinate value on each summit determines the parameter of perspective transform formula after just, coding region before being corrected according to perspective transform formula
The coordinate value of each pixel of image be mapped as correction after coding region image each pixel coordinate value.
In one embodiment, as shown in figure 9, encoder matrix analysis module 806 includes:
Floor projection unit 8061, for the pixel in the image for the coding region after binary conversion treatment per a line
Pixel value added up, and form horizontal projective histogram, horizontal projective histogram is made up of multiple vertical bars.
Encoder matrix line number determining unit 8062, the vertical bar for being included according to horizontal projective histogram determines encoder matrix
Line number.
Specifically, encoder matrix line number determining unit, for the overall width using horizontal projective histogram divided by vertical bar
Width obtains the estimate of the line number of encoder matrix, and estimate is contrasted with the line number of different size encoder matrix, will estimate
The line number of the specification of evaluation convergence is defined as the line number of encoder matrix.
Vertical projection unit 8063, for the pixel of each row in the image for the coding region after binary conversion treatment
Pixel value added up, and form vertical projection histogram, vertical projection histogram is made up of multiple vertical bars.
Encoder matrix columns determining unit 8064, the vertical bar for being included according to vertical projection histogram determines encoder matrix
Columns.
Specifically, encoder matrix columns determining unit 8064, for utilizing the histogrammic overall width of vertical projection divided by straight
The width of bar obtains the estimate of the columns of rectangular code, and estimate is contrasted with the columns of different size encoder matrix, will
The line number of the specification of estimate convergence is defined as the columns of encoder matrix.
One of ordinary skill in the art will appreciate that realizing that all or part of step of above-described embodiment can be by hardware
To complete, it is also possible to instruct the hardware of correlation to complete by program, described program can be stored in a kind of computer-readable
In storage medium, storage medium mentioned above can be read-only storage, disk or CD etc..
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit the invention, it is all it is of the invention spirit and
Within principle, any modification, equivalent substitution and improvements made etc. should be included within the scope of the present invention.
Claims (14)
1. a kind of recognition methods of animal ear tag square matrix code, it is characterised in that including:
Obtain the image of the coding region of animal ear tag;
The image of the coding region is carried out into black white binarization treatment;
Using projection localization algorithm, the line number and columns of encoder matrix in the coding region after binary conversion treatment are determined;
The coding region is carried out the division of grid for line number and columns according to determining;
Pixel value according to pixel in each grid is decoded to the encoder matrix, recognizes what the encoder matrix was included
The information of animal.
2. method according to claim 1, it is characterised in that
The image of the coding region for obtaining animal ear tag includes:
Gather the image of animal ear tag;
Each summit of the image of coding region in the image of the animal ear tag is determined, by described each summit join domain
Image be defined as the image of coding region;
Image to the coding region carries out trapezoidal distortion correction, and acquisition is shaped as rectangle, the volume of shooting angle front vertical
The image in code region.
3. method according to claim 2, it is characterised in that
Each summit of the image of coding region in the image for determining the animal ear tag, will each summit connection model
The image that image in enclosing is defined as coding region includes:
Make the straight line of the image diagonal parallel to the animal ear tag respectively in the apex of the image of the animal ear tag;
The straight line is moved to the center of the image of the animal ear tag, and detects what is overlapped with the straight line in moving process
Pixel;
If the pixel value for pixel overlapped with the straight line is higher than threshold value, and meets continuous around the coincident pixel point
The pixel value of the pixel in angular range is higher than threshold value, and the pixel value of the pixel in addition to the continuous angular range is less than threshold
The condition of value, then the pixel is defined as the summit of the image of coding region;
Image in each summit join domain is defined as the image of coding region.
4. method according to claim 2, it is characterised in that
The image to the coding region carries out trapezoidal distortion correction, and acquisition is shaped as rectangle, shooting angle front vertical
The image of coding region include:
According to correction before coding region image each summit coordinate value, it is determined that correct after coding region image each
The coordinate value on summit;
The coordinate value on each summit determines perspective transform formula after coordinate value and correction according to each summit before the correction
Parameter;
The coordinate value of each pixel of the image of coding region is compiled after being mapped as correction before being corrected according to perspective transform formula
The coordinate value of each pixel of the image in code region.
5. method according to claim 1, it is characterised in that
The utilization projection localization algorithm, determines the line number and columns bag of encoder matrix in the coding region after binary conversion treatment
Include:
Pixel value for the pixel in the image of the coding region after binary conversion treatment per a line adds up, and forms water
Flat projection histogram, the horizontal projective histogram is made up of multiple vertical bars;
The vertical bar included according to horizontal projective histogram determines the line number of the encoder matrix;
Pixel value for the pixel of each row in the image of the coding region after binary conversion treatment adds up, and forms perpendicular
Straight projection histogram, the vertical projection histogram is made up of multiple vertical bars;
The vertical bar included according to vertical projection histogram determines the columns of the encoder matrix.
6. method according to claim 5, it is characterised in that
The vertical bar included according to horizontal projective histogram determines that the line number of the encoder matrix includes:
The estimate of the line number of the encoder matrix is obtained divided by the width of vertical bar using the overall width of horizontal projective histogram, will
The estimate is contrasted with the line number of different size encoder matrix, and the line number of the specification of the estimate convergence is defined as
The line number of the encoder matrix;
Or, the vertical bar included according to vertical projection histogram determines that the columns of the encoder matrix includes:
The estimate of the columns of the rectangular code is obtained divided by the width of vertical bar using the histogrammic overall width of vertical projection, by institute
State estimate to be contrasted with the columns of different size encoder matrix, the line number of the specification of the estimate convergence is defined as institute
State the columns of encoder matrix.
7. method according to claim 1, it is characterised in that
The pixel value according to pixel in each grid carries out decoding to the encoder matrix to be included:
Calculate the pixel value and/or pixel average of pixel in each grid;
By the pixel value and/or pixel average contrasted with preset value, if above preset value, then the grid is reduced to
1, the grid is reduced to 0 if less than preset value, determines the binary value of the encoder matrix;
The binary value of the encoder matrix is decoded according to default decoding rule.
8. a kind of identifying device of animal ear tag square matrix code, it is characterised in that including:
Image collection module, the image of the coding region for obtaining animal ear tag;
Binary conversion treatment module, for the image of the coding region to be carried out into black white binarization treatment;
Encoder matrix analysis module, for utilizing projection localization algorithm, determines to encode square in the coding region after binary conversion treatment
The line number and columns of battle array;
Encoder matrix division module, the division for the coding region to be carried out grid according to the line number and columns that determine;
Decoder module, decodes for the pixel value according to pixel in each grid to the encoder matrix, and identification is described
The information of the animal that encoder matrix is included.
9. device according to claim 8, it is characterised in that described image acquisition module includes:
Image acquisition units, the image for gathering animal ear tag;
Coding region determining unit, for each summit of the image of coding region in the image for determining the animal ear tag, will
Image in described each summit join domain is defined as the image of coding region;
Image flame detection unit, trapezoidal distortion correction is carried out for the image to the coding region, and acquisition is shaped as rectangle, shoots
The image of the coding region of angle front vertical.
10. device according to claim 9, it is characterised in that
The coding region determining unit, the apex for the image in the animal ear tag is made parallel to the animal respectively
The straight line of the image diagonal of ear tag, the straight line is moved to the center of the image of the animal ear tag, and detection is moved through
The pixel that straight line described in Cheng Zhongyu overlaps, if the pixel value for pixel overlapped with the straight line is higher than threshold value, and
The pixel value for meeting the pixel around the coincident pixel point in the range of continuous angle is higher than threshold value, and except the continuous angular range
The pixel is then defined as the summit of the image of coding region less than the condition of threshold value for the pixel value of outer pixel, will be each
Image in individual summit join domain is defined as the image of coding region.
11. devices according to claim 9, it is characterised in that
Described image correcting unit, for the coordinate value according to each summit of the image of coding region before correction, it is determined that correction
The coordinate value on each summit of the image of coding region afterwards, after the coordinate value and correction according to each summit before the correction each
The coordinate value on summit determines the parameter of perspective transform formula, and the image of coding region is each before being corrected according to perspective transform formula
The coordinate value of individual pixel be mapped as correction after coding region image each pixel coordinate value.
12. devices according to claim 8, it is characterised in that the encoder matrix analysis module includes:
Floor projection unit, for the pixel value of the pixel in the image for the coding region after binary conversion treatment per a line
Added up, and formed horizontal projective histogram, the horizontal projective histogram is made up of multiple vertical bars;
Encoder matrix line number determining unit, the vertical bar for being included according to horizontal projective histogram determines the row of the encoder matrix
Number;
Vertical projection unit, for the pixel value of the pixel of each row in the image for the coding region after binary conversion treatment
Added up, and formed vertical projection histogram, the vertical projection histogram is made up of multiple vertical bars;
Encoder matrix columns determining unit, the vertical bar for being included according to vertical projection histogram determines the row of the encoder matrix
Number.
13. devices according to claim 12, it is characterised in that
The encoder matrix line number determining unit, the width for the overall width using horizontal projective histogram divided by vertical bar is obtained
The estimate of the line number of the encoder matrix, the estimate is contrasted with the line number of different size encoder matrix, by institute
The line number for stating the specification of estimate convergence is defined as the line number of the encoder matrix;
Or, the encoder matrix columns determining unit, for utilizing the histogrammic overall width of vertical projection divided by the width of vertical bar
Degree obtains the estimate of the columns of the rectangular code, and the estimate is contrasted with the columns of different size encoder matrix,
The line number of the specification of the estimate convergence is defined as the columns of the encoder matrix.
14. devices according to claim 8, it is characterised in that
The decoder module, the pixel value and/or pixel average for calculating pixel in each grid, by the pixel
Value and/or pixel average contrasted with preset value, if above preset value, then the grid is reduced to 1, if less than default
Then the grid is reduced to 0 to value, determines the binary value of the encoder matrix, according to default decoding rule to the encoder matrix
Binary value is decoded.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611112114.0A CN106709487A (en) | 2016-12-07 | 2016-12-07 | Animal ear tag matrix encoding identification method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611112114.0A CN106709487A (en) | 2016-12-07 | 2016-12-07 | Animal ear tag matrix encoding identification method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106709487A true CN106709487A (en) | 2017-05-24 |
Family
ID=58935904
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611112114.0A Pending CN106709487A (en) | 2016-12-07 | 2016-12-07 | Animal ear tag matrix encoding identification method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106709487A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109492562A (en) * | 2018-10-30 | 2019-03-19 | 河南科技大学 | A kind of contactless domestic animal identifying system |
CN110909572A (en) * | 2018-09-17 | 2020-03-24 | 阿里巴巴集团控股有限公司 | Target object identification method and system |
CN112036206A (en) * | 2020-08-25 | 2020-12-04 | 北京小龙潜行科技有限公司 | Monitoring method, device and system based on identification code type pig ear tag |
CN112149776A (en) * | 2020-09-30 | 2020-12-29 | 北京小龙潜行科技有限公司 | Visual label and assembly thereof |
CN112541369A (en) * | 2020-12-14 | 2021-03-23 | 合肥高维数据技术有限公司 | Information code identification method and system |
CN117195934A (en) * | 2023-11-07 | 2023-12-08 | 双胞胎(集团)股份有限公司 | Ear tag tracking method and breeding data acquisition method |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1885311A (en) * | 2006-05-29 | 2006-12-27 | 深圳矽感科技有限公司 | Two-dimensional code, encoding and decoding method thereof |
CN102880850A (en) * | 2012-09-19 | 2013-01-16 | 腾讯科技(深圳)有限公司 | Batch scanning method of two-dimensional codes, and scanning equipment |
CN103235930A (en) * | 2013-03-28 | 2013-08-07 | 茂名职业技术学院 | Rapid coarse positioning method for animal ear tag code images |
CN104933429A (en) * | 2015-06-01 | 2015-09-23 | 深圳市诺比邻科技有限公司 | Method and device for extracting information from image |
-
2016
- 2016-12-07 CN CN201611112114.0A patent/CN106709487A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1885311A (en) * | 2006-05-29 | 2006-12-27 | 深圳矽感科技有限公司 | Two-dimensional code, encoding and decoding method thereof |
CN102880850A (en) * | 2012-09-19 | 2013-01-16 | 腾讯科技(深圳)有限公司 | Batch scanning method of two-dimensional codes, and scanning equipment |
CN103235930A (en) * | 2013-03-28 | 2013-08-07 | 茂名职业技术学院 | Rapid coarse positioning method for animal ear tag code images |
CN104933429A (en) * | 2015-06-01 | 2015-09-23 | 深圳市诺比邻科技有限公司 | Method and device for extracting information from image |
Non-Patent Citations (2)
Title |
---|
刘佳: "猪耳标二维条码图像识读研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
宋培华等: "基于图像投影直方图法的二维码在线检测与识别", 《华东理工大学学报》 * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110909572A (en) * | 2018-09-17 | 2020-03-24 | 阿里巴巴集团控股有限公司 | Target object identification method and system |
CN109492562A (en) * | 2018-10-30 | 2019-03-19 | 河南科技大学 | A kind of contactless domestic animal identifying system |
CN109492562B (en) * | 2018-10-30 | 2021-05-25 | 河南科技大学 | A contactless livestock identification system |
CN112036206A (en) * | 2020-08-25 | 2020-12-04 | 北京小龙潜行科技有限公司 | Monitoring method, device and system based on identification code type pig ear tag |
CN112149776A (en) * | 2020-09-30 | 2020-12-29 | 北京小龙潜行科技有限公司 | Visual label and assembly thereof |
CN112541369A (en) * | 2020-12-14 | 2021-03-23 | 合肥高维数据技术有限公司 | Information code identification method and system |
CN112541369B (en) * | 2020-12-14 | 2022-08-05 | 合肥高维数据技术有限公司 | Information code identification method and system |
CN117195934A (en) * | 2023-11-07 | 2023-12-08 | 双胞胎(集团)股份有限公司 | Ear tag tracking method and breeding data acquisition method |
CN117195934B (en) * | 2023-11-07 | 2024-02-20 | 双胞胎(集团)股份有限公司 | Ear tag tracking method and breeding data acquisition method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106709487A (en) | Animal ear tag matrix encoding identification method and device | |
CN104517089B (en) | A kind of Quick Response Code decodes system and method | |
CN111435438B (en) | Graphical fiducial marker identification for augmented reality, virtual reality, and robotics | |
CN104361353B (en) | A kind of application of localization method of area-of-interest in instrument monitoring identification | |
CN106485183B (en) | A kind of Quick Response Code localization method and system | |
CN106897648B (en) | Method and system for identifying position of two-dimensional code | |
CN104517110B (en) | The binarization method and system of a kind of image in 2 D code | |
US9177188B2 (en) | Method and system for detecting detection patterns of QR code | |
JP5905642B2 (en) | Decoding method for matrix type two-dimensional code | |
US10198661B2 (en) | System for determining alignment of a user-marked document and method thereof | |
US10586321B2 (en) | Automatic detection, counting, and measurement of lumber boards using a handheld device | |
US20110290882A1 (en) | Qr code detection | |
CN106778996A (en) | It is embedded with the generation system and method and reading system of the Quick Response Code of visual pattern | |
CN104657728B (en) | Processing in Barcode Recognizing System based on computer vision | |
CN105989317A (en) | Identification method of two-dimensional code and apparatus thereof | |
CN104700062A (en) | Method and equipment for identifying two-dimension code | |
US11216905B2 (en) | Automatic detection, counting, and measurement of lumber boards using a handheld device | |
CN103489254B (en) | Lottery recognition method and lottery recognition system | |
CN105335744B (en) | A kind of one-dimension code zone location extracting band distribution characteristics based on image backbone | |
CN104463066A (en) | Method for rapidly positioning and recognizing one-dimensional barcode of outer commodity package | |
Zamberletti et al. | Neural 1D barcode detection using the Hough transform | |
CN109101855B (en) | Lost positioning frame two-dimensional code identification method based on opencv | |
CN110502948A (en) | Restoration method, restoration device and code scanning device of a folded two-dimensional code image | |
CN112101134B (en) | Object detection method and device, electronic equipment and storage medium | |
Wietrzykowski et al. | Stereo plane R-CNN: Accurate scene geometry reconstruction using planar segments and camera-agnostic representation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170524 |