CN109685142A - A kind of image matching method and device - Google Patents
A kind of image matching method and device Download PDFInfo
- Publication number
- CN109685142A CN109685142A CN201811591694.5A CN201811591694A CN109685142A CN 109685142 A CN109685142 A CN 109685142A CN 201811591694 A CN201811591694 A CN 201811591694A CN 109685142 A CN109685142 A CN 109685142A
- Authority
- CN
- China
- Prior art keywords
- image
- hog feature
- target area
- area image
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/75—Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
- G06V10/757—Matching configurations of points or features
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/22—Matching criteria, e.g. proximity measures
-
- 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/50—Extraction of image or video features by performing operations within image blocks; by using histograms, e.g. histogram of oriented gradients [HoG]; by summing image-intensity values; Projection analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Data Mining & Analysis (AREA)
- Multimedia (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Biology (AREA)
- Bioinformatics & Computational Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Databases & Information Systems (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Life Sciences & Earth Sciences (AREA)
- Image Analysis (AREA)
Abstract
This application provides a kind of image matching methods, wherein this method comprises: obtaining target image to be detected, and target image is divided at least one target area image;For at least one of above-mentioned target area image, the histograms of oriented gradients HOG feature of the target area image is extracted, and the HOG feature of the target area image is matched with the HOG feature extracted from reference picture;Based on it is matched as a result, determine the target image in whether include corresponding reference picture characteristics of image.Due to having carried out partial-block to target image, and the HOG feature extracted from target area image is matched with the HOG feature from reference picture, and the HOG feature of the target area image of target image part can describe the marginal information of image, therefore, this method not only adapts to image space feature and optical change, and image shape can be determined by the marginal information of HOG feature instantiation, to realize the automatic detection in PCB to component.
Description
Technical field
This application involves technical field of data processing, in particular to a kind of image matching method and device.
Background technique
With the rise of intelligence manufacture industry, the manufacturing process of electronic equipment is also more and more intelligent, printed wiring
Plate (Printed CircuitBoard, PCB) is essential a part in electronic equipment, to the electronics member of printed wiring board
It is an important operation process during manufacturing that device, which carries out detection,.
Currently, being based primarily upon image matching algorithm when detecting to electronic component, specifically utilize electronics member
Device is successively matched referring to image with the feature of each pixel of image to be detected, to find matching from PCB
Electronic component.But the mode of this matched pixel point, the association between each pixel is not accounted for, for image
Overall space feature and optical change adaptability it is not strong, cause the accuracy rate of images match lower.
Summary of the invention
In view of this, the embodiment of the present application is designed to provide a kind of image matching method and device, it is able to solve existing
There are the space characteristics that can not adapt to image local present in technology and the not strong problem of optical change adaptability, has reached
The purpose of component is effectively detected in PCB.
In a first aspect, the embodiment of the present application provides a kind of image matching method, comprising:
Target image to be detected is obtained, and the target image is divided at least one target area image;
For at least one of described target area image, the histograms of oriented gradients of the target area image is extracted
HOG feature, and the HOG feature of the target area image is matched with the HOG feature extracted from reference picture;
Based on it is above-mentioned matched as a result, determine in the target image whether include the reference picture image it is special
Sign.
A kind of possible embodiment, there are overlapping regions between two neighboring target area image.
A kind of possible embodiment, it is described to extract the HOG feature of the target area image with from reference picture
HOG feature matched, comprising:
Calculate the HOG feature of the target area image with from the phase between the HOG feature extracted in the reference picture
Like degree;
It is described based on it is described matched as a result, determine in the target image whether include the reference picture image
Feature, comprising:
When there are the target area figures that calculated similarity is greater than preset value at least one described target area image
Picture, it is determined that include the characteristics of image of the reference picture in the target image;
When there is no the mesh that calculated similarity is greater than the preset value at least one described target area image
Mark area image, it is determined that do not include the characteristics of image of the reference picture in the target image.
A kind of possible embodiment is also wrapped before the HOG feature for extracting each target area image marked off
It includes:
Primary image processing is carried out to the target image and/or the reference picture;
Wherein, the primary image processing includes one of following processing or a variety of: image gray processing processing, image are sharp
Change processing, image enhancement processing.
A kind of possible embodiment, the HOG feature for extracting the target area image, comprising:
The gradient magnitude and gradient direction of each pixel in the target area image are calculated, and, by the target area figure
As being divided at least one block, each block is made of N1*N2 pixel, and N1, N2 are positive integer;
Based on the gradient magnitude and gradient direction of each pixel in each block, the HOG feature of each block is counted;
By the HOG feature tandem compound of at least one block, the HOG feature of the target area image is obtained.
A kind of possible embodiment, the HOG feature tandem compound by least one block, obtains the target
The HOG feature of area image, comprising:
The combination HOG feature obtained after the HOG feature tandem compound of at least one block is normalized,
Combination HOG feature after normalized is determined as to the HOG feature of the target area image.
A kind of possible embodiment, the combination obtained after the HOG feature tandem compound by least one block
After HOG feature is normalized, further includes:
Dimensionality reduction is carried out to the combination HOG feature after normalized, the combination HOG feature after dimensionality reduction is determined as the target
The HOG feature of area image.
Second aspect, the embodiment of the present application also provide a kind of image matching apparatus, comprising:
Target area image division unit is divided into for obtaining target image to be detected, and by the target image
At least one target area image;
Matching unit is extracted, for extracting the target area image at least one of described target area image
Histograms of oriented gradients HOG feature, and by the HOG feature of the target area image and the HOG that extracts from reference picture
Feature is matched;
Determination unit, for based on above-mentioned matched as a result, determining whether in the target image include the reference
The characteristics of image of image.
A kind of possible embodiment, there are overlapping regions between two neighboring target area image.
A kind of possible embodiment extracts the HOG feature of the target area image with from reference picture described
When HOG feature out is matched, the extraction matching unit is used for:
Calculate the HOG feature of the target area image with from the phase between the HOG feature extracted in the reference picture
Like degree;
The determination unit, is further used for:
When there are the target area figures that calculated similarity is greater than preset value at least one described target area image
Picture, it is determined that include the characteristics of image of the reference picture in the target image;
When there is no the mesh that calculated similarity is greater than the preset value at least one described target area image
Mark area image, it is determined that do not include the characteristics of image of the reference picture in the target image.
A kind of possible embodiment, described device further include pretreatment unit, each mesh for marking off in extraction
Before the HOG feature for marking area image, following operation is executed:
Primary image processing is carried out to the target image and/or the reference picture;
Wherein, the primary image processing includes one of following processing or a variety of: image gray processing processing, image are sharp
Change processing, image enhancement processing.
A kind of possible embodiment, in the HOG feature for extracting the target area image, the extraction matching is single
Member is used for:
The gradient magnitude and gradient direction of each pixel in the target area image are calculated, and, by the target area figure
As being divided at least one block, each block is made of N1*N2 pixel, and N1, N2 are positive integer;
Based on the gradient magnitude and gradient direction of each pixel in each block, the HOG feature of each block is counted;
By the HOG feature tandem compound of at least one block, the HOG feature of the target area image is obtained.
A kind of possible embodiment obtains the mesh in the HOG feature tandem compound by least one block
When marking the HOG feature of area image, the extraction matching unit is used for:
The combination HOG feature obtained after the HOG feature tandem compound of at least one block is normalized,
Combination HOG feature after normalized is determined as to the HOG feature of the target area image.
A kind of possible embodiment, the combination obtained after the HOG feature tandem compound by least one block
After HOG feature is normalized, the extraction matching unit is also used to:
Dimensionality reduction is carried out to the combination HOG feature after normalized, the combination HOG feature after dimensionality reduction is determined as the target
The HOG feature of area image.
The third aspect, the embodiment of the present application also provide a kind of electronic equipment, comprising: processor, memory and bus, it is described
Memory is stored with the executable machine readable instructions of the processor, when electronic equipment operation, the processor with it is described
By bus communication between memory, the machine readable instructions executed when being executed by the processor it is above-mentioned in a first aspect, or
In first aspect in any possible embodiment the step of image matching method.
Fourth aspect, the embodiment of the present application also provide a kind of computer readable storage medium, the computer-readable storage medium
Computer program is stored in matter, which executes above-mentioned in a first aspect, or in first aspect when being run by processor
In any possible embodiment the step of image matching method.
It, can be with by the way that target image to be detected is divided at least one target area image in the embodiment of the present application
By global image range shorter to topography, operand can not only be reduced, moreover, target area image is as target image
Topography can well adapt to local spatial feature and optical change.Further, at least one above-mentioned target area
Image zooming-out HOG feature, and the HOG feature extracted and the HOG feature extracted from corresponding reference picture are carried out
Match, and be based on matching result, determine in target image whether include the reference picture characteristics of image, what it is due to extraction is target
The HOG feature of image local, HOG feature can admirably describe the marginal information of local target area image, so as to reach
To the purpose of detection topography's inward flange shape, the automatic detection to PCB internal component is realized.
To enable the above objects, features, and advantages of the application to be clearer and more comprehensible, preferred embodiment is cited below particularly, and cooperate
Appended attached drawing, is described in detail below.
Detailed description of the invention
Technical solution in ord to more clearly illustrate embodiments of the present application, below will be to needed in the embodiment attached
Figure is briefly described, it should be understood that the following drawings illustrates only some embodiments of the application, therefore is not construed as pair
The restriction of range for those of ordinary skill in the art without creative efforts, can also be according to this
A little attached drawings obtain other relevant attached drawings.
Fig. 1 shows the flow chart of the first image matching method provided by the embodiment of the present application;
Fig. 2 shows the flow charts of second of image matching method provided by the embodiment of the present application;
Fig. 3 shows the gradient direction section exemplary diagram in the embodiment of the present application;
Fig. 4 shows a kind of structural schematic diagram of image matching apparatus provided by the embodiment of the present application;
Fig. 5 shows the structural schematic diagram of a kind of electronic equipment provided by the embodiment of the present application.
Specific embodiment
To keep the purposes, technical schemes and advantages of the embodiment of the present application clearer, below in conjunction with the embodiment of the present application
Middle attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is only
It is some embodiments of the present application, instead of all the embodiments.The application being usually described and illustrated herein in the accompanying drawings is real
The component for applying example can be arranged and be designed with a variety of different configurations.Therefore, below to the application's provided in the accompanying drawings
The detailed description of embodiment is not intended to limit claimed scope of the present application, but is merely representative of the selected reality of the application
Apply example.Based on embodiments herein, those skilled in the art institute obtained without making creative work
There are other embodiments, shall fall in the protection scope of this application.
For convenient for understanding the present embodiment, first to a kind of image matching method disclosed in the embodiment of the present application into
Row is discussed in detail.
Embodiment one
A kind of image matching method is present embodiments provided, as shown in Figure 1, which comprises step 100 to step
120。
Step 100: obtaining target image to be detected, and the target image of acquisition is divided at least one target area
Image.
Specifically, in the embodiment of the present application, by printed wiring board (Printed Circuit Board, PCB) image conduct
Target image to be detected, main purpose are to judge in PCB image with the presence or absence of target component (e.g., chip, electricity
Resistance, inductance etc.), alternatively, judging defect present in PCB image, (e.g., component exception, circuit abnormality and/or welding are different
Often etc., component includes: that component missing, the offset of component mistake, component damage, component and/or component are inclined extremely
Turn;Circuit abnormality includes: Miswire, route damage and/or line short;Abnormal welding include: missing solder, scolding tin it is excessive and/
Or scolding tin is very few, etc.), to judge PCB with the presence or absence of defect, to realize the automatic detection of PCB, certainly, above-mentioned applied field
Scape is only a kind of preferred scene, method provided by the embodiment of the present application, can also apply images match other
Scene.
Further, since the embodiment of the present application is utilization orientation histogram of gradients (Histogram of Oriented
Gradient, HOG) carry out PCB image component detection, be by calculate and statistical picture regional area direction gradient
Therefore histogram construction feature after obtaining target image to be detected, in order to subsequent convenient for extracting individual features, needs
The target image of acquisition is first divided into several target area images.
Step 110: at least one of the target area image of acquisition, the HOG for extracting the target area image is special
Sign, and the HOG feature of the target area image is matched with the HOG feature extracted from reference picture.
After determining several target area images, at least one target area image, executes following operation: specifically mentioning
The HOG feature of the target area image is taken, and the HOG feature extracted and the HOG extracted from corresponding reference picture is special
Sign carries out similarity mode.
Called reference image, be in PCB image to be detected component to be measured it is corresponding it is in kind refer to figure, be used to judge to
It is whether correct or whether complete to survey component, and the HOG feature of reference picture can be pre- first pass through and calculate acquisition, then deposit
Storage improves matching in specified region, to be extracted the above-mentioned matching operation of completion at any time to save calculation amount
Efficiency.
Step 120: be based on acquired matching result, determine in the target image whether include reference picture image
Feature.
Specifically, determining in target image to be detected whether include ginseng based on the matching result that abovementioned steps obtain
The characteristics of image of image is examined, and then realizes automatic detection of the target image based on reference picture.
Embodiment two
A kind of image matching method is present embodiments provided, as shown in Figure 2, which comprises step 200 to step
260。
In order to reduce the influence of environmental factor or picture quality to HOG characteristic results are extracted itself, target image is being extracted
HOG feature before, need to perform target image to be detected and/or reference picture a series of primary image processing behaviour
Make, above-mentioned primary image processing includes one of following processing or a variety of: image gray processing processing, image sharpening processing, figure
Image intensifying processing.
Why target image is subjected to image gray processing processing, is the image office because in the textural characteristics of image
The exposure contribution specific gravity in portion is larger, so this image procossing mode can be effectively reduced the shade of image local and illumination becomes
Changing influences, while can also inhibit noise signal.
Preferably, in the embodiment of the present application, using Gamma orthosis to the gray value of each pixel of target image into
Row normalized, to obtain the grayscale image of target image, specific implementation formula is as follows:
I (x, y)=I (x, y)gammaFormula one
Wherein, (x, y) indicates that the coordinate position of pixel, I indicate the gray value of pixel.For example, gamma can be 1/
2, that is, the gray value of all pixels point of original target image is made even root, to realize the gray scale normalization of target image.
Further, image sharpening processing can also be carried out to target image, to enhance edge feature, therefore the application is implemented
In example, the component profile information in target image can be highlighted by using Edge contrast.
Further, image enhancement processing can also be carried out to target image, so that its gray value integrated distribution is relatively narrow
Section in, therefore, in the embodiment of the present application, increase the contrast of part using histogram equalization, can clearer displaying
Each details of image realizes the enhancing and improvement of image quality.
Image enhancement processing is carried out to target image by histogram equalization, concrete operations are as follows:
Firstly, setting tonal gradation, and count the number of the corresponding pixel of each tonal gradation in target image;
Secondly, calculating the distribution density of each tonal gradation, wherein the distribution density of certain tonal gradation is the tonal gradation
The accounting of the number of lower pixel and the target image pixel sum;
Then, the cumulative distribution histogram relationship for establishing tonal gradation and cumulative distribution density, in cumulative distribution histogram
In, the cumulative distribution density of certain tonal gradation is usually expressed as being distributed containing all tonal gradations before the tonal gradation
The accumulated value of density.For example, tri- tonal gradations of existing A, B, C, wherein the distribution density of A is that the distribution density of 30%, B is
The distribution density of 40%, C are 30%, then, the cumulative distribution density that the cumulative distribution density of A is 30%, B is 70% (30%+
40%), the cumulative distribution density of C is 100% (30%+40%+30%).
Then, floor operation is carried out to cumulative distribution density, specifically: first determine maximum gray scale etc. in the target image
Grade, then by the tonal gradation multiplied by the corresponding cumulative distribution density of each tonal gradation, to obtain updated each gray scale etc.
Grade.
Finally, the original each tonal gradation of target image is replaced all with updated each tonal gradation.
In the embodiment of the present invention, the tonal gradation of each pixel is adjusted by distribution density, can highlight distribution density compared with
High component.
It, can also be with according to the needs of processing although the operation of above-mentioned primary image is illustrated by taking target image as an example
Reference picture is pre-processed using above-mentioned identical image processing operations.
Step 200: obtaining target image to be detected, and the target image of acquisition is divided at least one target area
Image, wherein may exist overlapping region between two neighboring target area image.
In the embodiment of the present application, the target image to be detected that can be will acquire is divided at least one according to predefined size
A target area image, there may be the regions that partly overlaps between two neighboring target area image.
Specifically, on target image to be detected, using the sliding window of fixed size (predefined) according to setting
Step-length is slided, and by step size settings within the scope of the fixed size of sliding window, and glide direction in the light of actual conditions, can be with
It is set as sliding up and down, may be set to be and horizontally slip, in this way, there is certain overlapping between two neighboring target area image
Region, so that subsequent can be reduced the omission of target area image content when matching reference picture, to improve matching precision.
For example, it is assumed that the size of target image to be detected is 128*64 pixel, and the fixed size of sliding window is set as
9*9 pixel, and a pixel size is set by step-length, in this way, on the target image of 128*64 pixel, using 9*9 pixel
The sliding window of size is slided according to the step-length of a pixel size, since step-length is only a pixel size, if depositing
In second target area image, then, first aim area image and second target area image are in one direction
It has been overlapped 8 pixels.
In the embodiment of the present application, the form of sliding window can not also be used, such as: directly according to fixed size by target
Image is divided into several target area images.
Step 210: determining a target area image, and extract the histograms of oriented gradients HOG of the target area image
Feature.
Specifically, extracting the direction ladder of the target area image at least one of the target area image obtained
Spend histogram HOG feature.
Since the application is to extract target area image based on sliding window, when implementing, first determine a mesh
Area image is marked, and executes the operation for extracting HOG feature to the target area image, wherein the HOG characteristic present of image should
The corresponding histograms of oriented gradients of image.
When it is implemented, firstly, calculating separately the gradient magnitude of each pixel and gradient side in the target area image
To, and, which is divided at least one block, each block is made of N1*N2 pixel, and N1 and
N2 is positive integer.
Preferably, solving coordinate in the target area image by following formula first is (x, y) in the embodiment of the present application
Pixel gradient magnitude and gradient direction:
Gx(x, y)=H (x+1, y)-H (x-1, y) formula two
Gy(x, y)=H (x, y+1)-H (x, y-1) formula three
Wherein, G in formulax(x,y)、Gy(x, y), H (x, y) respectively indicate pixel (x, y) in the target area image of input
Horizontal direction gradient, vertical gradient and the pixel value at place.Derive the gradient magnitude G (x, y) it is found that at pixel (x, y)
It is respectively as follows: with gradient direction α (x, y)
Then, gradient magnitude and gradient direction based on each pixel in each block, the HOG for counting each block are special
Sign, and by the HOG feature tandem compound of at least one block, obtain the HOG feature of the target area image.
For example, reasonable assumption target area image M is made of block 1 and block 2, and block 1 and block 2 are by 8*8
A pixel composition, it is illustrated by taking block 1 as an example, 180 ° of gradient direction equalizations of block 1 is divided into 9 gradient directions
(Z1:0 ° -20 ° of section;Z2:20°-40°;Z3:40°-60°;Z4:60°-80°;Z5:80°-100°;Z6:100°-120°;Z7:
120°-140°;Z8:140°-160°;Z9:160 ° -180 °), and the gradient direction section of symmetrical phase angle ownership is identical, such as
" 0 ° -20 ° " and " 180 ° -200 ° " belong to gradient direction section Z1, and " 20 ° -40 ° " and " 200 ° -220 ° " belong to gradient side
To section Z2, in order to intuitively illustrate, referring specifically to shown in Fig. 3.
By the calculating of above-mentioned formula four and formula five, it is known that the gradient magnitude of each pixel and gradient side in block 1
To then, falling into the number in each gradient direction section by each pixel in statistics block 1, then pass through each pixel
The respective gradient magnitude of point is weighted projection, to obtain the corresponding pixel distribution in above-mentioned 9 gradient direction sections
Density, specifically, if the gradient direction of some pixel is fallen into " 60 ° -80 ° " or " 240 ° -260 ° ", " 60 ° -80 ° " or
Count is incremented for pixel in " 240 ° -260 ° " corresponding gradient direction section Z3, if continuing to assume that gradient direction section Z3 is final
Pixel number be 3, then with these three pixels, respectively for the sum of gradient magnitude multiplied by " 3 ", resulting value is gradient direction area
Between Z3 pixel distribution density, other gradient direction sections can similarly obtain corresponding pixel distribution density.
From image, the HOG feature of block 1 is that " abscissa is 9 gradient direction sections, and ordinate is pixel
The gradient orientation histogram of distribution density ", from Spatial Dimension, the HOG feature of block 1 is the feature vector of one 9 dimension.
Similarly, using above-mentioned identical mode, it can be obtained the HOG feature of block 2.
So, after the respective HOG feature of block 1 and block 2 for determining target area image M, by block 1 and block 2
Respective HOG feature series connection can obtain the HOG feature of target area image M, by upper, it is known that the combination HOG of target area image M is special
Sign is the feature vector of 2*9 dimension.
However, since the illumination variation of block part is big and the contrast of local background is high, so that the mesh being composed
Mark area image gradient intensity variation range it is very big, therefore, it is necessary to illumination, shade and the edge to target area image into
Row compression, is lost with reducing, in the embodiment of the present application, after the HOG feature tandem compound of each block of target area image
Obtained combination HOG feature is normalized, and the combination HOG feature after normalized is redefined as the target
The HOG feature of area image.
For example, can take logarithm etc. to combination HOG feature, details are not described herein.
Further, since the combination HOG feature after the corresponding normalized of target area image is by each block
The series connection of HOG feature be composed, therefore, calculation amount is larger, in order to reduce operand, improves matching speed, the application is real
It applies in example, dimensionality reduction is carried out again to the combination HOG feature after normalized, and the combination HOG feature after dimensionality reduction is determined as this
The HOG feature of target area image.
Steps are as follows for specific dimensionality reduction:
Firstly, carrying out eigenmatrix centralization operation, tool to the feature vector, X of the combination HOG feature after normalized
Body are as follows: calculate the mean value of feature vector, X each column, and subtract the mean value from respective column, to obtain new feature vector Y, wherein
The corresponding block of each column in feature vector, X;
Secondly, utilizing formula sixCalculate characteristic value and the spy of covariance matrix C and covariance matrix C
Levy vector, wherein N is block number, YTFor the transposition of Y;
Then, the covariance matrix C of acquisition is decomposed, and is translated into diagonal matrix, and most from covariance matrix C
Big characteristic value starts, the corresponding feature vector composition projection matrix P of K characteristic value before successively taking, wherein K is preset
Dimension values after dimensionality reduction;
Finally, feature vector Y is mapped using projection matrix P, the feature vector Z after obtaining dimensionality reduction, preferably, this
Apply in embodiment, corresponding formula are as follows:
Z=PY formula seven
So far, the combination HOG feature after dimensionality reduction, the as final HOG feature of the target area image are finally obtained.
The above-mentioned operation for seeking the final HOG feature of target area image is equally applicable to extract from corresponding reference picture
HOG feature, the HOG feature of reference picture can be is extracted and stored in a certain position in advance, is also possible to extracting the mesh
It is extracted while marking the HOG feature of area image, in the embodiment of the present application, it's not limited to that.
Step 220: calculating the HOG feature of the target area image and between the HOG feature extracted in reference picture
Similarity.
Specifically, calculate the HOG feature of the target area image and the HOG feature extracted from corresponding reference picture it
Between similarity, similarity can be the Euclidean distance between two HOG features either Pasteur's coefficient, certainly, this Shen
It please not limit and which kind of mode the HOG feature of target area image and the HOG of corresponding reference picture spy are calculated using in embodiment
Similarity between sign.
Step 230: judge whether the similarity between the target area image and reference picture is greater than preset value, if so,
240 are thened follow the steps, otherwise, continues to execute step 250.
The embodiment that target area image is extracted for gradually dividing from target image using sliding window, can be with needle
To the target area image first obtained, HOG feature is therefrom extracted, and matched with the HOG feature extracted from reference picture,
Especially by similarity between the HOG feature of the HOG feature and reference picture that calculate the target area image, further according to similarity
Compared with preset value, to judge whether to match.
If by calculating it is found that formerly sliding the HOG feature of resulting target area image and the HOG feature of reference picture
Between similarity be greater than preset value, then can directly determine in the target image include the reference picture characteristics of image.
If formerly sliding similar between the HOG feature of resulting target area image and the HOG feature of reference picture
Degree is not more than preset value, thens follow the steps 250, specifically judges whether there is also surplus in several target area images divided in advance
Remaining target area image, if it is present sliding window continues forward slip, to extract next target area image, and
Repeating step 210 can directly sentence if remaining target area image is not present in target image to step 220
The characteristics of image of corresponding reference picture is not included in the fixed target image.
As it can be seen that not whole HOG features of target image and the HOG feature of reference picture are carried out by sliding window
Compare, but part is used to split and the thinking that gradually compares, so that once it is determined that the HOG feature of some target area image
With from the similarity between the HOG feature extracted in reference picture be greater than preset value, it is subsequent, no longer need to by sliding window after
It is continuous to extract next target area image forward, conclusion can be immediately arrived at, i.e., contains reference picture in judgement target image
Characteristics of image, the operand of feature is saved, correspondingly, improving the matching speed of image.
Step 240: including the characteristics of image of corresponding reference picture in determining corresponding target image.
Step 250: judge with the presence or absence of remaining target area image in target image, if so, 210 are thened follow the steps,
Otherwise, step 260 is executed.
Step 260: determining in corresponding target image and do not include the characteristics of image for having corresponding reference picture.
For example, target image to be detected is PCB image A, reference picture is XX power supply chip, firstly, by PCB image A
Be divided into 4 target area images (respectively A1, A2, A3 and A4) according to preset pixel size, then respectively to A1,
A2, A3 and A4 extract HOG feature, and from the HOG feature of specified extracted region XX power supply chip, by similarity mode, discovery
Similarity between the HOG feature of A3 and the HOG feature of XX power supply chip is greater than preset value 96%, then can determine that in PCB image A
There are the characteristics of image of XX power supply chip.
In intelligence manufacture industry, using the provided above scheme of the embodiment of the present application, it can automatically detect out in PCB and weld
Position component devious is connect, alternatively, the component etc. of cosmetic damage.
In the embodiment of the present application, it is possible, firstly, to which target image has been divided at least one using the concept of sliding window
Target area image can determine that target image contains in this way, once dividing resulting target area image by formerly sliding
The characteristics of image of reference picture then no longer needs to forward slip and extracts next target area image, without progress subsequent characteristics
It extracts and feature matching operation to save calculation amount improves matching speed.Further, since HOG feature can be preferably
The edge and variation characteristic of description image therefore extract HOG feature for single target area image, and with from reference
The HOG feature extracted in image is matched, by judging the matching relationship of target area image and reference picture, to sentence
Disconnected target image whether there is the characteristics of image of reference picture, and the above method can preferably adapt to the geometric form of image local
Change and optical deformation, moreover, can achieve the purpose that detection image part inward flange shape, to realize to the inside PCB member device
The automatic detection of part.
Embodiment three
Conceived based on same application, images match dress corresponding with image matching method is additionally provided in the embodiment of the present application
It sets, referring specifically to shown in Fig. 4, above-mentioned image matching apparatus 400, comprising:
Target area image division unit 401 is divided into for obtaining target image to be detected, and by the target image
At least one target area image;
Matching unit 402 is extracted, for extracting the side of the target area image at least one of target area image
To histogram of gradients HOG feature, and by the HOG feature of the target area image and the HOG feature that extracts from reference picture
It is matched;
Determination unit 403, for based on above-mentioned matched as a result, determining whether in the target image include the ginseng
Examine the characteristics of image of image.
Preferably, between two neighboring target area image, there are overlapping regions.
Preferably, the HOG feature by the target area image and the HOG feature that extracts from reference picture into
When row matching, the extraction matching unit is used for:
Calculate the HOG feature of the target area image with from the phase between the HOG feature extracted in the reference picture
Like degree;
The determination unit 403, is further used for:
When there are the target area figures that calculated similarity is greater than preset value at least one described target area image
Picture, it is determined that include the characteristics of image of the reference picture in the target image;
When there is no the mesh that calculated similarity is greater than the preset value at least one described target area image
Mark area image, it is determined that do not include the characteristics of image of the reference picture in the target image.
Preferably, described device further includes pretreatment unit 404, each target area image for being marked off in extraction
HOG feature before, execute following operation:
Primary image processing is carried out to the target image and/or the reference picture;
Wherein, the primary image processing includes one of following processing or a variety of: image gray processing processing, image are sharp
Change processing, image enhancement processing.
Preferably, the extraction matching unit 402 is used in the HOG feature for extracting the target area image:
The gradient magnitude and gradient direction of each pixel in the target area image are calculated, and, by the target area figure
As being divided at least one block, each block is made of N1*N2 pixel, and N1, N2 are positive integer;
Based on the gradient magnitude and gradient direction of each pixel in each block, the HOG feature of each block is counted;
By the HOG feature tandem compound of at least one block, the HOG feature of the target area image is obtained.
Preferably, obtaining the target area image in the HOG feature tandem compound by least one block
When HOG feature, the extraction matching unit 402 is used for:
The combination HOG feature obtained after the HOG feature tandem compound of at least one block is normalized,
Combination HOG feature after normalized is determined as to the HOG feature of the target area image.
Preferably, the combination HOG feature obtained after the HOG feature tandem compound by least one block is returned
After one change processing, the extraction matching unit 402 is also used to:
Dimensionality reduction is carried out to the combination HOG feature after normalized, the combination HOG feature after dimensionality reduction is determined as the target
The HOG feature of area image.
The principle and the above-mentioned image matching method of the embodiment of the present application solved the problems, such as due to the device in the embodiment of the present application
It is similar, therefore the implementation of device may refer to the implementation of method, overlaps will not be repeated.
Example IV
Based on the same technical idea, the embodiment of the present application also provides a kind of electronic equipment, structure referring to Figure 5
Schematic diagram, the equipment 50 include processor 51, memory 52 and bus 53, and the storage of memory 52 executes instruction, and work as institute
It when stating the operation of equipment 50, is communicated between the processor 51 and the memory 52 by bus 53, the processor 51 executes
The described of the storage of memory 52 executes instruction, so that the equipment 50 executes images match side described in above-described embodiment
The step of method.
In addition, the embodiment of the present application also provides a kind of computer readable storage medium, on the computer readable storage medium
It is stored with computer program, images match described in above method embodiment is executed when which is run by processor
The step of method.
The computer program product of route planning method provided by the embodiment of the present application, including storing program code
Computer readable storage medium, the instruction that said program code includes can be used for executing image described in above method embodiment
The step of matching process, for details, reference can be made to above method embodiments, and details are not described herein.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description
It with the specific work process of device, can refer to corresponding processes in the foregoing method embodiment, details are not described herein.In the application
In provided several embodiments, it should be understood that disclosed systems, devices and methods, it can be real by another way
It is existing.The apparatus embodiments described above are merely exemplary, for example, the division of the unit, only a kind of logic function
It can divide, there may be another division manner in actual implementation, in another example, multiple units or components can combine or can collect
At another system is arrived, or some features can be ignored or not executed.Another point, shown or discussed mutual coupling
Conjunction or direct-coupling or communication connection can be the indirect coupling or communication connection by some communication interfaces, device or unit,
It can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.
It, can be with if the function is realized in the form of SFU software functional unit and when sold or used as an independent product
It is stored in the executable non-volatile computer-readable storage medium of a processor.Based on this understanding, the application
Technical solution substantially the part of the part that contributes to existing technology or the technical solution can be with software in other words
The form of product embodies, which is stored in a storage medium, including some instructions use so that
One computer equipment (can be personal computer, server or the network equipment etc.) executes each embodiment institute of the application
State all or part of the steps of method.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (Read-Only
Memory, ROM), random access memory (Random Access Memory, RAM), magnetic or disk etc. is various to deposit
Store up the medium of program code.
The above is only the protection scopes of the specific embodiment of the application, but the application to be not limited thereto, any to be familiar with
Those skilled in the art within the technical scope of the present application, can easily think of the change or the replacement, and should all cover
Within the protection scope of the application.Therefore, the protection scope of the application should be subject to the protection scope in claims.
Claims (10)
1. a kind of image matching method characterized by comprising
Target image to be detected is obtained, and the target image is divided at least one target area image;
For at least one of described target area image, the histograms of oriented gradients HOG for extracting the target area image is special
Sign, and the HOG feature of the target area image is matched with the HOG feature extracted from reference picture;
Based on it is above-mentioned matched as a result, determine in the target image whether include the reference picture characteristics of image.
2. the method as described in claim 1, which is characterized in that there are overlapping regions between two neighboring target area image.
3. the method as described in claim 1, which is characterized in that the HOG feature by the target area image with from reference
The HOG feature extracted in image is matched, comprising:
Calculate the HOG feature of the target area image and from the similarity between the HOG feature extracted in the reference picture;
It is described based on it is described matched as a result, determine in the target image whether include the reference picture image it is special
Sign, comprising:
When the target area image at least one described target area image there are calculated similarity greater than preset value, then
Determine the characteristics of image in the target image comprising the reference picture;
When there is no the target areas that calculated similarity is greater than the preset value at least one described target area image
Area image, it is determined that do not include the characteristics of image of the reference picture in the target image.
4. the method as described in claim 1, which is characterized in that special in the HOG for extracting each target area image marked off
Before sign, further includes:
Primary image processing is carried out to the target image and/or the reference picture;
Wherein, the primary image processing includes one of following processing or a variety of: at image gray processing processing, image sharpening
Reason, image enhancement processing.
5. the method as described in claim 1-4 is any, which is characterized in that the HOG feature for extracting the target area image,
Include:
The gradient magnitude and gradient direction of each pixel in the target area image are calculated, and, which is drawn
It is divided at least one block, each block is made of N1*N2 pixel, and N1, N2 are positive integer;
Based on the gradient magnitude and gradient direction of each pixel in each block, the HOG feature of each block is counted;
By the HOG feature tandem compound of at least one block, the HOG feature of the target area image is obtained.
6. method as claimed in claim 5, which is characterized in that the HOG feature series connection group by least one block
It closes, obtains the HOG feature of the target area image, comprising:
The combination HOG feature obtained after the HOG feature tandem compound of at least one block is normalized, will be returned
One changes that treated, and combination HOG feature is determined as the HOG feature of the target area image.
7. method as claimed in claim 6, which is characterized in that by the HOG feature tandem compound of at least one block
After the combination HOG feature obtained afterwards is normalized, further includes:
Dimensionality reduction is carried out to the combination HOG feature after normalized, the combination HOG feature after dimensionality reduction is determined as the target area
The HOG feature of image.
8. a kind of image matching apparatus characterized by comprising
Target area image division unit is divided at least for obtaining target image to be detected, and by the target image
One target area image;
Matching unit is extracted, for extracting the side of the target area image at least one of described target area image
To histogram of gradients HOG feature, and by the HOG feature of the target area image and the HOG feature that extracts from reference picture
It is matched;
Determination unit, for based on above-mentioned matched as a result, determining whether in the target image include the reference picture
Characteristics of image.
9. a kind of electronic equipment characterized by comprising processor, memory and bus, the memory are stored with the place
The executable machine readable instructions of device are managed, when electronic equipment operation, pass through bus between the processor and the memory
Communication executes the images match side as described in claim 1 to 7 is any when the machine readable instructions are executed by the processor
The step of method.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer journey on the computer readable storage medium
Sequence, the step of image matching method as described in claim 1 to 7 is any is executed when which is run by processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811591694.5A CN109685142A (en) | 2018-12-25 | 2018-12-25 | A kind of image matching method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811591694.5A CN109685142A (en) | 2018-12-25 | 2018-12-25 | A kind of image matching method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109685142A true CN109685142A (en) | 2019-04-26 |
Family
ID=66189413
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811591694.5A Pending CN109685142A (en) | 2018-12-25 | 2018-12-25 | A kind of image matching method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109685142A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111161208A (en) * | 2019-11-21 | 2020-05-15 | 深圳航天智控科技有限公司 | Image detection method and device |
CN113674270A (en) * | 2021-09-06 | 2021-11-19 | 深邦智能科技(青岛)有限公司 | Tire pattern consistency detection system and method |
CN113705660A (en) * | 2021-08-25 | 2021-11-26 | 青岛睿维申信息科技有限公司 | Target identification method and related equipment |
CN113920329A (en) * | 2021-11-08 | 2022-01-11 | 北京九州安华信息安全技术有限公司 | Feature extraction method and device based on gradient histogram |
CN114049272A (en) * | 2021-11-11 | 2022-02-15 | 上海傲显科技有限公司 | Screen image processing method, screen assembly and computer storage medium |
CN115330279A (en) * | 2022-10-14 | 2022-11-11 | 北京师范大学 | Company selection method based on stock trend graph similarity detection |
CN116091498A (en) * | 2023-04-07 | 2023-05-09 | 飞杨电源技术(深圳)有限公司 | Visual defect detection method for intelligent charger of lead-acid storage battery |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102937595A (en) * | 2012-11-13 | 2013-02-20 | 浙江省电力公司电力科学研究院 | Method, device and system for detecting printed circuit board (PCB) |
CN103400393A (en) * | 2013-08-21 | 2013-11-20 | 中科创达软件股份有限公司 | Image matching method and system |
CN104680500A (en) * | 2015-02-07 | 2015-06-03 | 江西科技学院 | Image intensification algorithm based on histogram equalization |
WO2017054941A1 (en) * | 2015-09-30 | 2017-04-06 | Fotonation Limited | A method and system for tracking an object |
CN107886110A (en) * | 2017-10-23 | 2018-04-06 | 深圳云天励飞技术有限公司 | Method for detecting human face, device and electronic equipment |
CN108009554A (en) * | 2017-12-01 | 2018-05-08 | 国信优易数据有限公司 | A kind of image processing method and device |
CN108961236A (en) * | 2018-06-29 | 2018-12-07 | 国信优易数据有限公司 | Training method and device, the detection method and device of circuit board defect detection model |
-
2018
- 2018-12-25 CN CN201811591694.5A patent/CN109685142A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102937595A (en) * | 2012-11-13 | 2013-02-20 | 浙江省电力公司电力科学研究院 | Method, device and system for detecting printed circuit board (PCB) |
CN103400393A (en) * | 2013-08-21 | 2013-11-20 | 中科创达软件股份有限公司 | Image matching method and system |
CN104680500A (en) * | 2015-02-07 | 2015-06-03 | 江西科技学院 | Image intensification algorithm based on histogram equalization |
WO2017054941A1 (en) * | 2015-09-30 | 2017-04-06 | Fotonation Limited | A method and system for tracking an object |
CN107886110A (en) * | 2017-10-23 | 2018-04-06 | 深圳云天励飞技术有限公司 | Method for detecting human face, device and electronic equipment |
CN108009554A (en) * | 2017-12-01 | 2018-05-08 | 国信优易数据有限公司 | A kind of image processing method and device |
CN108961236A (en) * | 2018-06-29 | 2018-12-07 | 国信优易数据有限公司 | Training method and device, the detection method and device of circuit board defect detection model |
Non-Patent Citations (1)
Title |
---|
何东健: "《数字图像处理》", 31 December 2015 * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111161208A (en) * | 2019-11-21 | 2020-05-15 | 深圳航天智控科技有限公司 | Image detection method and device |
CN113705660A (en) * | 2021-08-25 | 2021-11-26 | 青岛睿维申信息科技有限公司 | Target identification method and related equipment |
CN113674270A (en) * | 2021-09-06 | 2021-11-19 | 深邦智能科技(青岛)有限公司 | Tire pattern consistency detection system and method |
CN113674270B (en) * | 2021-09-06 | 2023-11-14 | 深邦智能科技集团(青岛)有限公司 | Tire pattern consistency detection system and method thereof |
CN113920329A (en) * | 2021-11-08 | 2022-01-11 | 北京九州安华信息安全技术有限公司 | Feature extraction method and device based on gradient histogram |
CN114049272A (en) * | 2021-11-11 | 2022-02-15 | 上海傲显科技有限公司 | Screen image processing method, screen assembly and computer storage medium |
CN115330279A (en) * | 2022-10-14 | 2022-11-11 | 北京师范大学 | Company selection method based on stock trend graph similarity detection |
CN115330279B (en) * | 2022-10-14 | 2023-01-24 | 北京师范大学 | Company selection method based on stock trend graph similarity detection |
CN116091498A (en) * | 2023-04-07 | 2023-05-09 | 飞杨电源技术(深圳)有限公司 | Visual defect detection method for intelligent charger of lead-acid storage battery |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109685142A (en) | A kind of image matching method and device | |
CN108446694B (en) | Target detection method and device | |
CN108564085B (en) | Method for automatically reading of pointer type instrument | |
CN108416789A (en) | Method for detecting image edge and system | |
US20180114092A1 (en) | Devices, systems, and methods for anomaly detection | |
CN108416771A (en) | A kind of metal material corrosion area detection method based on monocular camera | |
CN103279957A (en) | Method for extracting remote sensing image interesting area based on multi-scale feature fusion | |
CN107808161A (en) | A kind of Underwater targets recognition based on light vision | |
CN107369176B (en) | System and method for detecting oxidation area of flexible IC substrate | |
CN106530271A (en) | Infrared image significance detection method | |
CN110910445B (en) | Object size detection method, device, detection equipment and storage medium | |
CN112991374B (en) | Canny algorithm-based edge enhancement method, canny algorithm-based edge enhancement device, canny algorithm-based edge enhancement equipment and storage medium | |
CN108182383A (en) | A kind of method and apparatus of vehicle window detection | |
CN110189341B (en) | Image segmentation model training method, image segmentation method and device | |
JP7368924B2 (en) | Hardware accelerator for computation of gradient oriented histograms | |
CN106384074A (en) | Detection apparatus of pavement defects and method thereof, and image processing equipment | |
JP2011165170A (en) | Object detection device and program | |
CN113516697B (en) | Image registration method, device, electronic equipment and computer readable storage medium | |
CN108769543A (en) | The determination method and device of time for exposure | |
CN111027551B (en) | Image processing method, apparatus and medium | |
WO2024016632A1 (en) | Bright spot location method, bright spot location apparatus, electronic device and storage medium | |
CN109741370B (en) | Target tracking method and device | |
CN113435358B (en) | Sample generation method, device, equipment and program product for training model | |
CN111242880B (en) | Multi-depth-of-field image superposition method, equipment and medium for microscope | |
CN112633183B (en) | Automatic detection method and device for image shielding area and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 100070 building 31, headquarters Plaza, 188 South 4th Ring Road West, Fengtai District, Beijing Applicant after: Guoxin Youyi Data Co., Ltd Address before: 100070 building 31, headquarters Plaza, 188 South 4th Ring Road West, Fengtai District, Beijing Applicant before: SIC YOUE DATA Co.,Ltd. |
|
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190426 |