CN112598088B - Method for acquiring visual multi-target robust template of industrial component - Google Patents

Method for acquiring visual multi-target robust template of industrial component Download PDF

Info

Publication number
CN112598088B
CN112598088B CN202110238757.4A CN202110238757A CN112598088B CN 112598088 B CN112598088 B CN 112598088B CN 202110238757 A CN202110238757 A CN 202110238757A CN 112598088 B CN112598088 B CN 112598088B
Authority
CN
China
Prior art keywords
template
image
target
matching
images
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.)
Active
Application number
CN202110238757.4A
Other languages
Chinese (zh)
Other versions
CN112598088A (en
Inventor
邱增帅
王罡
潘正颐
侯大为
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Changzhou Weiyizhi Technology Co Ltd
Original Assignee
Changzhou Weiyizhi Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Changzhou Weiyizhi Technology Co Ltd filed Critical Changzhou Weiyizhi Technology Co Ltd
Priority to CN202110238757.4A priority Critical patent/CN112598088B/en
Publication of CN112598088A publication Critical patent/CN112598088A/en
Application granted granted Critical
Publication of CN112598088B publication Critical patent/CN112598088B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation 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/751Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Computation (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a method for acquiring a visual multi-target robust template of an industrial part, which comprises the following steps of: acquiring n acquired images in total, selecting an optimal reference image from the n acquired images, and selecting a region with large gradient change of pixel values from the n acquired images; selecting a multi-target robust template: searching a matching template with better robustness on the basis of the optimal reference image so as to enable the matching template to be correctly matched on all corresponding images; finding similar images: traversing the obtained matching template on the original image, calculating the Euclidean distance between the original image and the corresponding pixel point on the target image, and finding out the area similar to the template on other images. The method can realize batch detection, and a template with better robustness can be found by 100 percent; the position degree of the searched template is optimal, the target can be completely contained, and the target is located at the central position of the template; the processing process has high running speed, parallel processing and multithreading technology are adopted, the time for searching the template is saved, and the efficiency is improved.

Description

Method for acquiring visual multi-target robust template of industrial component
Technical Field
The invention relates to the technical field of image processing, in particular to a method for acquiring a visual multi-target robust template of an industrial component.
Background
Image matching is a classic technique of image processing, is an algorithm based on statistical thought, and has wide application in the aspects of computer vision, pattern recognition, industrial detection and the like. Template matching is a method for finding a target image modelImage (i.e., a template image) in a source image srcImage, and the principle is to measure Similarity between two images by some Similarity criterion. The existing image matching algorithms can be mainly classified into three categories: an image matching method based on gray information, an image matching method based on edge information, and an image matching method based on features.
In the field of machine vision industrial detection, defect detection often requires a template matching method to find a target and obtain target characteristic information so as to perform subsequent edge detection and image segmentation. Whether the target can be accurately matched or not and the position degree of the matched target is optimal are important, and even the accuracy of subsequent operation can be determined.
The gray information-based image matching method mentioned in the first document (Gaojing, Sunwilyin, Liujing, Hausdorff distance image matching method based on neighborhood gray information [ J ]. computer application, 2011, 31(03): 741. 744.) and the second document (Zhubertian. research and implementation of feature point-based image matching algorithm [ D ]. electronic technology university, 2012) has the advantages that the information of the image is fully used, and the contained information amount is large; the method has the defects of large calculated amount, high complexity, sensitivity to fine transformation of images, low noise resistance, poor matching position degree and incapability of realizing an optimal matching result.
The template matching method provided by the third document (liuli. research on template matching algorithm based on image features [ D ]. Harbin Industrial university (Shenzhen), 2005.) is based on image visual features-image edge contours, realizes template matching with Hausdorff distance as similarity measure, and adopts an 8-neighborhood method to extract edge feature point optimization algorithm performance, wherein the algorithm is mainly used for processing images which are composed of a large number of regular patterns and have complex backgrounds, is not suitable for matching irregular targets in industrial measurement, and has no universality.
The Image matching algorithm with line feature proposed in the fourth document (Li H, Manjunath B S, Mitra S K.A constant-based approach to multisensory Image registration [ J ]. IEEE Trans Image Process, 2002, 4(3): 320-334) has the following general flow: the method comprises the steps of firstly extracting edges by using an edge detection algorithm, then qualitatively and quantitatively representing the edges of an image by combining a certain designed mathematical model, and then matching the edges, wherein line segments extracted by the algorithm are broken frequently, errors are generated on a matching result, and the optimal target image cannot be matched.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the method for acquiring the visual multi-target robust template of the industrial component solves the problems of batch matching based on multiple templates and multiple targets, and inaccurate reference image and template finding in the prior art.
The technical scheme adopted by the invention for solving the technical problems is as follows: a method for acquiring a visual multi-target robust template of an industrial component comprises the following specific steps:
the first step, selecting the optimal reference image: acquiring n acquired images in total, wherein n is a positive integer larger than 1, selecting an optimal reference image from the n acquired images, and selecting a region with large gradient change of pixel values from the n acquired images, wherein the region with large gradient change of pixel values refers to the region with pixel calculation gradient, wherein 30% of pixel points exist inside the region with pixel calculation gradient, and the difference between the pixel value of the 30% of pixel points and the pixel value of the pixel points in the surrounding 8 neighborhoods exceeding 4 neighborhoods exceeds 70;
the second step, the selection of the multi-target robust template: searching a group of matching templates with better robustness on the basis of the optimal reference image acquired in the first step, and enabling the matching templates to be correctly matched on all corresponding images;
and step three, searching for similar images: traversing the matching template obtained in the second step on the original image, calculating the Euclidean distance between the matching template and the corresponding pixel point on the target image, and finding out the area similar to the template on other images.
Further specifically, in the above technical solution, in the first step, the specific steps are as follows:
1, dividing each image in all results to be matched;
step 2, respectively calculating a feature histogram for each region, calculating the variance among the features of each histogram, averaging the feature histogram variance of each region, and reserving the number of the image in the region when the histogram feature variance of the image is larger than the variance mean;
and 3, finding out images with the same number as an optimal reference image.
Further specifically, in the above technical solution, in the second step, the specific steps are as follows:
step 1, firstly, determining a template target as a minimum template area range on an optimal reference image;
step 2, expanding the width and the length of the template area range on the basis of the minimum template area range to form a maximum template area range;
and 3, selecting a template with better robustness in the range of the minimum template area and the range of the maximum template area.
Further specifically, in the above technical solution, the method for selecting the template with better robustness in the minimum template area range and the maximum template area range includes: randomly selecting n templates in the maximum and minimum template range areas, wherein the n templates are obtained by expanding a reference image serving as an original template for n times, respectively performing template matching on the n templates and the remaining m to-be-matched results, wherein m is a positive integer greater than 1, so as to obtain an image set of m matching results, the m to-be-matched results are m images which are left in all collected original images except the original image used for extracting a photo, performing binarization processing on the templates and the result image set subjected to template matching, performing image subtraction, counting the number of nonzero images, so as to obtain a result set subjected to subtraction, then solving the mean value and the variance, so as to obtain a group of variance values, and taking the size of the template corresponding to the minimum variance value as a template with better robustness, so as to finally obtain a group of multi-target templates.
Further specifically, in the above technical solution, in the third step, the specific steps are as follows:
step 1, detecting all possible targets in an original image based on template matching, and finding out a global minimum value, a global maximum value and corresponding positions;
step 2, comparing the global minimum value with a set expected value, if the global minimum value is smaller than the expected value, the matched target is the area which is most similar to the template in the comparison graph, and the target is reserved; if the global minimum value is larger than or equal to the expected value, the matched target is the target with failed matching, the target is not reserved, and the next image matching is carried out. Here, a squared error algorithm is used, and the sum of squared values of the difference between each pixel value of the template and the contrast picture is calculated. Therefore, the sum of the squares of the difference between each pixel value of the template and the contrast picture reflects the degree of similarity of the two pictures, and the smaller the sum of the squares of the difference between each pixel value of the template and the contrast picture is, the more similar the two pictures are. When the sum of the square values of the difference between each pixel value of the template and each pixel value of the comparison picture is larger than a set threshold value, the two pictures have obvious difference, and therefore the method is used for judging whether the matching is successful.
The invention has the beneficial effects that: the method for acquiring the visual multi-target robust template of the industrial part has the following advantages:
the method can realize batch detection, and can find a template with good robustness in 100 percent;
secondly, the position degree of the searched robust template is good, the target can be completely contained, and the target is located in the middle of the template;
and thirdly, the running speed of the processing process is high, the parallel processing and multithreading technology are adopted, the time for searching the template is saved, and the efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present invention, the drawings used in the description of the embodiments or prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a general flow diagram of the present invention;
FIG. 2 is a flow chart of optimal reference image selection;
FIG. 3 is a diagram of robust template selection range;
FIG. 4 is a diagram of multiple target markers to be matched;
FIG. 5-1 is a first diagram of multiple target entities to be matched;
FIG. 5-2 is a diagram of a multi-target object to be matched II;
FIG. 5-3 is a diagram of a multi-target object to be matched;
5-4 are diagrams of multiple target objects to be matched;
5-5 are diagrams of multiple target objects to be matched;
5-6 are diagrams of multiple target objects to be matched;
FIG. 6 is a first flowchart of a robust template selection algorithm module;
FIG. 7 is a block diagram of a robust template selection algorithm block II;
fig. 8 is an exemplary diagram of robust template selection.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects solved by the present invention more clearly apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, a method for acquiring a visual multi-target robust template of an industrial component specifically comprises the following steps:
the first step, selecting the optimal reference image: in order to realize one hundred percent batch detection, an optimal reference image is required to be selected as a template image, n collected images are collected together, n is a positive integer greater than 1, namely n collected images are provided, including a collected image 1 and a collected image 2 … …, the optimal reference image is selected from the n collected images, and a region with large gradient change of pixel values is selected from the n collected images; it should be noted that: the region with large gradient change of pixel values means that 30% of pixel points exist in the region with pixel calculation gradient, and the difference between the pixel value of the 30% of pixel points and the pixel value of the pixel points in the surrounding 8 neighborhoods exceeding 4 neighborhoods exceeds 70.
The second step, the selection of the multi-target robust template: searching a group of matching templates with better robustness on the basis of the optimal reference image acquired in the first step, and enabling the matching templates to be correctly matched on all corresponding images;
it should be noted that: the good robustness means that the matching template to be searched has high accuracy in n contrast pictures, and the accuracy of the matching result is kept to be more than 99% in the contrast pictures under various conditions.
And step three, searching for similar images: traversing the matching template obtained in the second step on the original image,and calculating the Euclidean distance between the target image and the corresponding pixel point on the target image, and finding out the area similar to the template on other images. Using dijRepresenting Euclidean distance, S, between corresponding pixels of template and target imageijA pixel value, C, representing a pixel at a certain position on the templateijAnd (3) representing the pixel value of the pixel at the corresponding position of the target image, the calculation formula of the Euclidean distance is as follows:
dij=Sij-Cij (1)
in the first step, the specific steps are as follows:
1, dividing each image in all results to be matched (source image set), for example, dividing one image into f × g regions, wherein f is f rows and g is g columns, namely, each image is randomly divided into f × g regions;
step 2, respectively calculating a feature histogram for each region (f × g sub-region of each image), equally dividing 0-255 pixels of the histogram into 35 dimensions, and obtaining 35 dimension values
Figure DEST_PATH_IMAGE001
Figure DEST_PATH_IMAGE002
……
Figure DEST_PATH_IMAGE003
Figure DEST_PATH_IMAGE004
To, for
Figure 658184DEST_PATH_IMAGE001
Figure 575325DEST_PATH_IMAGE002
……
Figure 417379DEST_PATH_IMAGE003
Figure 124172DEST_PATH_IMAGE004
Averaging the 35 dimension values to obtain a dimension average value
Figure DEST_PATH_IMAGE005
Simultaneously separately obtain
Figure 862DEST_PATH_IMAGE001
Figure 636373DEST_PATH_IMAGE002
……
Figure 965724DEST_PATH_IMAGE003
Figure 164624DEST_PATH_IMAGE004
And
Figure 150946DEST_PATH_IMAGE005
calculating the variance of all feature histograms
Figure DEST_PATH_IMAGE006
Figure 206627DEST_PATH_IMAGE006
The variance of gradient change in the image of the calculation region when the optimal reference image is screened. Order to
Figure DEST_PATH_IMAGE007
Equal to the mean of the variances of all feature histograms when the variance of a feature from the center feature
Figure DEST_PATH_IMAGE008
Greater than this mean of variance
Figure DEST_PATH_IMAGE009
When the area image is recorded, keeping and recording the number corresponding to the area image; and similarly, performing the same algorithm calculation on other images to determine the image number.
Step 3, finding out the images with the same number as the optimal reference image, namely finding out the same image number, wherein the corresponding image is the imageThe required optimal reference map. The optimal reference map selected by the algorithm can be realized
Figure DEST_PATH_IMAGE010
The success rate is that the template is intercepted on the optimal reference image to match other images, so that the matching accuracy can be improved. The detailed flow chart is shown in fig. 2.
It should be noted that: there are a plurality of optimal reference images obtained in the first step. The purpose of the first step is to find out all regions of the image where the gradient of pixels is large, each region corresponding to an optimal reference image, which helps to ensure 100% accuracy of matching, so there are multiple optimal reference images.
In the second step, the specific steps are as follows:
step 1, firstly, determining a template target as a minimum template area range on an optimal reference image
Figure DEST_PATH_IMAGE011
(2)
Wherein x is0Is the x coordinate, y, of the upper left corner point of the rectangle on the whole graph0The y coordinate of the upper left corner point of the rectangle on the whole graph is shown, width is the length of the rectangle, and height is the height of the rectangle.
Step 2, expanding the width and height of the template area range on the basis of the minimum template area range to form the maximum template area range:
Figure DEST_PATH_IMAGE012
(3)
wherein, Δ w represents a width value of the minimum template expansion template, Δ h represents a height value of the minimum template expansion template,
Figure DEST_PATH_IMAGE013
indicating the length of the initial truncated template,
Figure DEST_PATH_IMAGE014
indicating that the width of the template was originally truncated.
Step 3, finally, selecting a robust template in the minimum template area range and the maximum template area range
Figure DEST_PATH_IMAGE015
Wherein
Figure DEST_PATH_IMAGE016
Figure DEST_PATH_IMAGE017
Figure DEST_PATH_IMAGE018
Figure DEST_PATH_IMAGE019
. The template region range is shown in FIG. 3.
Figure DEST_PATH_IMAGE020
Refers to the size of the robust template, which is the size of the robust template match selected from the smallest and largest template regions.
The method for selecting the robust template in the minimum template area range and the maximum template area range comprises the following steps: randomly selecting N templates of different sizes in the maximum and minimum template range regions0,N1……Ni……Nn-1N templates are respectively matched with the remaining M to-be-matched results to obtain an image set { M | M ] of M matching results0,M1……Mi……Mm-1M is a positive integer greater than 1, wherein n templates are obtained after n times of expansion on a reference image serving as an original template; the m to-be-matched results are m images which are left in all the collected original images except the original image used for extracting the photos; template Ni(i =0, 1 … … N-1) and by NiThe matched result image set M is respectively subjected to binarization processing, image subtraction,Counting the number of non-zero to obtain a differencing result set { d | d0,d1……di……dm-1Then, take the mean value:
Figure DEST_PATH_IMAGE021
(4)
and variance:
Figure DEST_PATH_IMAGE022
(5)
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE023
refers to { d | d0,d1……di……dm-1The variance of the (k) is calculated,
Figure 521808DEST_PATH_IMAGE023
the robustness of using the current template is reflected, the smaller it is, the better the robustness of the current template is.
Figure 258820DEST_PATH_IMAGE023
The variance is the variance when the robust template is screened, and is the variance of the sequence with the number of the template and the corresponding pixel value difference of not 0 in the matched image. diThe total number of pixels with different pixel values in the matching result of the template and the single matching image is referred to; m refers to the number of matched results; i means that the ith matched result is matched with the current matched result;
Figure DEST_PATH_IMAGE024
the average value is an average value of the number of pixels having different pixel values in all pictures.
And obtaining a group of variance values, taking the size of the template corresponding to the minimum variance value as a robust template, and finally obtaining a group of multi-target robust templates. Specific flow charts are shown in fig. 6 and fig. 7, and an example of robust template selection is shown in fig. 8. The formula (4) represents the number of the obtained robust template and the number of the pixels with different pixel values in the binary image of the found most similar image, and then the average value of the two pixels is calculated, so that the performance of the robust template is shown.
It should be noted that: and a second step of generating a plurality of new templates by expanding the length and the width, matching the new templates with other images, and evaluating matching results. And measuring the overall similarity of the new template and all matched results by using the variance, and selecting the template image with the maximum overall similarity as the template to ensure the robustness of the template. Therefore, the template obtained in the second step is good.
In the third step, the specific steps are as follows:
step 1, firstly, detecting all possible targets in the original image based on template matching, and finding out a global minimum value (
Figure DEST_PATH_IMAGE025
) And a global maximum value: (
Figure DEST_PATH_IMAGE026
) And a corresponding location; the global minimum value referred to herein (
Figure DEST_PATH_IMAGE027
) And the specific numerical value of the global maximum () refers to the pixel value of the grayscale image, representing the degree of difference between the template and the target image in template matching, with smaller numerical values representing more similarity.
Step 2, then global minimum value (
Figure DEST_PATH_IMAGE028
) And a set expected value of (
Figure DEST_PATH_IMAGE029
) Comparing if the global minimum value (
Figure 87931DEST_PATH_IMAGE027
) Less than the expected value of (
Figure DEST_PATH_IMAGE030
) If so, then the matched destinationThe target is the target which is successfully matched, and the target is reserved; if the global minimum value (
Figure DEST_PATH_IMAGE031
) Greater than or equal to the desired value (
Figure DEST_PATH_IMAGE032
) If so, the matched target is the target which fails to be matched, the target is not reserved, and the next image is matched. Here, a squared error algorithm is used, and the sum of squared values of the difference between each pixel value of the template and the contrast picture is calculated. Therefore, the sum of the squares of the difference between each pixel value of the template and the contrast picture reflects the degree of similarity of the two pictures, and the smaller the sum of the squares of the difference between each pixel value of the template and the contrast picture is, the more similar the two pictures are. When the sum of the square values of the difference between each pixel value of the template and each pixel value of the comparison picture is larger than a set threshold value, the two pictures have obvious difference, and therefore the method is used for judging whether the matching is successful.
It should be noted that: the multi-target refers to a set of robust templates generated based on the plurality of optimal reference maps obtained in the first step. Each optimal template uses the variance to describe its overall degree of similarity to the matched regions of all other images. The number of targets is the same as the number of optimal reference images obtained in the first step, except for the variance condition.
Referring to FIG. 4, L1-L8, R1-R4, SS 1-SS 7, etc. in the figure represent multi-target objects to be matched, which are templates corresponding to the respective regions in FIG. 5-1, FIG. 5-2, FIG. 5-3, FIG. 5-4, FIG. 5-5 and FIG. 5-6.
Referring to fig. 5-1, 5-2, 5-3, 5-4, 5-5 and 5-6, SE1 to SE9, L1 to L8, R1 to R4, D1 to D8, SS1 to SS7 and S1 to S2 in the figures represent different multiple targets to be matched, such as a long edge (1 to 9) of an image starting with SE, a circular hole area (1 to 7) of an image starting with SS, L1 to L8 represent 8 portions on the left of three circles, R1 to R4 represent 4 portions on the right circle, D1 to D8 represent 8 portions on the lower circle, and S1 to S2 represent two ear-shaped areas on the right circle.
Referring to fig. 6, N templates are randomly selected, the N templates are obtained by fine-tuning the sizes of N optimal reference images, and the N templates include template N0Template N1… template Ni… template Nn-1Then, matching the n templates with M test pictures respectively to obtain M groups of matching results, wherein the M groups of matching results comprise M0、M1…Mi…Mm-1And n graphs are arranged in each group of matching results.
See FIG. 7, randomly taking template NiBy way of illustration, this template NiFor M images (M)0、M1…Mi…Mm-1) Performing template matching to obtain m matching results, subtracting the obtained matching results from the corresponding size-adjusted template picture, and describing the performance of the current template according to the number of pixels with different pixel values, namely obtaining m matching result sets { d |)0、d1…di…dm-1And counting the number of all the test pictures with the difference between the matching result of each picture and the corresponding pixel value of the template not being 0 to form a number sequence and calculating the variance of the number sequence. And selecting a plurality of groups of templates with different sizes to match the test pictures, solving the variance corresponding to each group of templates, and selecting a group of templates with the minimum corresponding variance as a robust template.
See FIG. 8, which is a process for finding an optimal template image template D8, ai(i =1, 2 … … n) represents the width value (unit: pixel) of the image; bi(i =1, 2 … … n) represents a height value (unit: pixel) of an image. Firstly, based on the previously acquired optimal reference image, then finely adjusting the size of the images for multiple times, performing template matching on the image with the adjusted size and m pictures each time, solving the variance of the matching effect of each group of pictures on all the tested pictures to represent the performance of the current group of pictures as a template, and finally selecting a group of images with the minimum variance as a robust template, namely the optimal template of D8.
The method for acquiring the visual multi-target robust template of the industrial component relates to a method for selecting an optimal reference map and a method for selecting the multi-target robust template, and is beneficial to relevant requirements of edge extraction, detection and the like of subsequent projects. Randomness is introduced: the introduction of randomness improves the generalization capability and accuracy of matching and can realize hundred percent of batch matching; the problem of the traditional template matching method is solved: the traditional template matching method has the problems of poor accuracy and incapability of finding the optimal position, namely poor position degree in matching; the method has strong independence: the technology is completely independent of data and items, is not limited by the data and the items, and has strong universality.
In addition to the idea of the invention, the idea based on partial differential equation can be considered to obtain the optimal template of the target, for example, gaussian filtering is used to smooth the original image, partial differential equation calculation is performed on the filtered image to obtain a residual error map, and then histogram statistical idea is applied.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be considered to be within the technical scope of the present invention, and the technical solutions and the inventive concepts thereof according to the present invention are equivalent to or changed within the technical scope of the present invention.

Claims (3)

1. A method for acquiring a visual multi-target robust template of an industrial component is characterized by comprising the following specific steps:
the first step, selecting the optimal reference image: the method comprises the steps that n images are collected, wherein n is a positive integer larger than 1, an optimal reference image is selected from the n images, and areas with large gradient change of pixel values are selected from the n images, wherein the areas with large gradient change of pixel values mean that the difference between the pixel values of 30% of pixel points in one area and the pixel values of the pixel points in 8 neighborhoods exceeding 4 neighborhoods around the area exceeds 70;
the second step, the selection of the multi-target robust template: searching a group of matching templates with better robustness on the basis of the optimal reference image acquired in the first step, and enabling the matching templates to be correctly matched on all corresponding images; the method comprises the following specific steps:
step 1, firstly, determining a template target as a minimum template area range on an optimal reference image;
step 2, expanding the width and the length of the template area range on the basis of the minimum template area range to form a maximum template area range;
step 3, selecting a template with better robustness in the range of the minimum template area and the range of the maximum template area;
the method for selecting the template with better robustness in the minimum template area range and the maximum template area range comprises the following steps: randomly selecting n templates in the maximum and minimum template range regions, wherein the n templates are obtained by expanding a reference image serving as an original template for n times, respectively performing template matching on the n templates and the remaining m to-be-matched results, wherein m is a positive integer greater than 1 to obtain an image set of m matching results, the m to-be-matched results are m images left after the original image used for extracting the photo is removed from all the collected original images, the template and the result image set matched by the template are respectively subjected to binarization processing, image subtraction and non-zero number statistics to obtain a subtraction result set, then, the mean value and the variance are obtained to obtain a group of variance values, the size of the template corresponding to the minimum variance value is used as a template with better robustness, each optimal reference image is operated as above, and finally a group of multi-target templates are obtained;
and step three, searching for similar images: traversing the matching template obtained in the second step on the original image, calculating the Euclidean distance between the matching template and the corresponding pixel point on the target image, and finding out the area similar to the template on other images.
2. The method for acquiring the industrial component visual multi-target robust template as claimed in claim 1, wherein: in the first step, the specific steps are as follows:
1, dividing each image in all results to be matched;
step 2, respectively calculating a feature histogram for each region, calculating the variance among the features of each histogram, averaging the feature histogram variance of each region, and reserving the number of the image in the region when the histogram feature variance of the image is larger than the variance mean;
and 3, finding out images with the same number as an optimal reference image.
3. The method for acquiring the industrial component visual multi-target robust template as claimed in claim 1, wherein: in the third step, the specific steps are as follows:
step 1, detecting all possible targets in an original image based on template matching, and finding out a global minimum value, a global maximum value and corresponding positions;
step 2, comparing the global minimum value with a set expected value, if the global minimum value is smaller than the expected value, the matched target is the area which is most similar to the template in the comparison graph, and the target is reserved; if the global minimum value is larger than or equal to the expected value, the matched target is the target with failed matching, the target is not reserved, and the next image matching is carried out.
CN202110238757.4A 2021-03-04 2021-03-04 Method for acquiring visual multi-target robust template of industrial component Active CN112598088B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110238757.4A CN112598088B (en) 2021-03-04 2021-03-04 Method for acquiring visual multi-target robust template of industrial component

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110238757.4A CN112598088B (en) 2021-03-04 2021-03-04 Method for acquiring visual multi-target robust template of industrial component

Publications (2)

Publication Number Publication Date
CN112598088A CN112598088A (en) 2021-04-02
CN112598088B true CN112598088B (en) 2021-06-01

Family

ID=75210250

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110238757.4A Active CN112598088B (en) 2021-03-04 2021-03-04 Method for acquiring visual multi-target robust template of industrial component

Country Status (1)

Country Link
CN (1) CN112598088B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106548147A (en) * 2016-11-02 2017-03-29 南京鑫和汇通电子科技有限公司 A kind of quick noise robustness image foreign matter detection method and TEDS systems
CN110675376A (en) * 2019-09-20 2020-01-10 福建工程学院 PCB defect detection method based on template matching

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102157004A (en) * 2011-04-18 2011-08-17 东华大学 Automatic image mosaicking method for high-accuracy image measuring apparatus of super-view field part
CN103996208A (en) * 2014-05-21 2014-08-20 国家电网公司 Method for conducting automatic tracking of PTZ single target in video image
US10699156B2 (en) * 2016-01-13 2020-06-30 Peking University Shenzhen Graduate School Method and a device for image matching
CN109816648B (en) * 2019-01-23 2020-11-06 浙江大学 Complex injection molding product flash defect identification method based on multi-template low-rank decomposition

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106548147A (en) * 2016-11-02 2017-03-29 南京鑫和汇通电子科技有限公司 A kind of quick noise robustness image foreign matter detection method and TEDS systems
CN110675376A (en) * 2019-09-20 2020-01-10 福建工程学院 PCB defect detection method based on template matching

Also Published As

Publication number Publication date
CN112598088A (en) 2021-04-02

Similar Documents

Publication Publication Date Title
CN115082419B (en) Blow-molded luggage production defect detection method
Pun et al. Multi-scale noise estimation for image splicing forgery detection
CN106683119B (en) Moving vehicle detection method based on aerial video image
CN103699905B (en) Method and device for positioning license plate
CN113591967B (en) Image processing method, device, equipment and computer storage medium
CN113109368B (en) Glass crack detection method, device, equipment and medium
CN115018828A (en) Defect detection method for electronic component
US20070058856A1 (en) Character recoginition in video data
CN108629286B (en) Remote sensing airport target detection method based on subjective perception significance model
CN101122953A (en) Picture words segmentation method
CN114972356B (en) Plastic product surface defect detection and identification method and system
CN108509950B (en) Railway contact net support number plate detection and identification method based on probability feature weighted fusion
CN108197644A (en) A kind of image-recognizing method and device
Chen et al. Decompose algorithm for thresholding degraded historical document images
CN111898627B (en) SVM cloud microparticle optimization classification recognition method based on PCA
CN114897806A (en) Defect detection method, electronic device and computer readable storage medium
Özgen et al. Text detection in natural and computer-generated images
CN114596551A (en) Vehicle-mounted forward-looking image crack detection method
CN115375629A (en) Method for detecting line defect and extracting defect information in LCD screen
CN113012124B (en) Shoe print hole and embedded object feature detection and description method
CN106326921B (en) Text detection method
CN111965197A (en) Defect classification method based on multi-feature fusion
CN110288040B (en) Image similarity judging method and device based on topology verification
CN106446832B (en) Video-based pedestrian real-time detection method
Gui et al. A fast caption detection method for low quality video images

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant