CN117173177A - Image-based metal shell optical size detection method and system - Google Patents

Image-based metal shell optical size detection method and system Download PDF

Info

Publication number
CN117173177A
CN117173177A CN202311447142.8A CN202311447142A CN117173177A CN 117173177 A CN117173177 A CN 117173177A CN 202311447142 A CN202311447142 A CN 202311447142A CN 117173177 A CN117173177 A CN 117173177A
Authority
CN
China
Prior art keywords
metal shell
size
image
contour
fuzzy
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311447142.8A
Other languages
Chinese (zh)
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.)
Taizhou Hangyu Electrical Device Co ltd
Original Assignee
Taizhou Hangyu Electrical Device 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 Taizhou Hangyu Electrical Device Co ltd filed Critical Taizhou Hangyu Electrical Device Co ltd
Priority to CN202311447142.8A priority Critical patent/CN117173177A/en
Publication of CN117173177A publication Critical patent/CN117173177A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Image Analysis (AREA)

Abstract

The invention discloses an image-based metal shell optical size detection method and system, and relates to the technical field of metal detection, wherein the detection method comprises the following steps: the method comprises the steps of utilizing a multi-camera module to synchronously shoot a metal shell in a target area at multiple angles, obtaining a plurality of multi-angle images, and preprocessing the images; extracting features of the preprocessed image, and taking the extracted feature image as the whole outline of the metal shell; and dividing the obtained integral contour by utilizing a contour dividing method to determine a measurement target. According to the invention, the target is subjected to pretreatment such as graying, enhancement and filtering, so that the positioning accuracy of the edge points of the straight line and the circle is improved, and the method can be used for detecting whether the size parameter of the metal shell is within the tolerance range of the preset standard size, thereby being beneficial to timely finding out the problem in the production process, and improving the measurement accuracy and the efficiency.

Description

Image-based metal shell optical size detection method and system
Technical Field
The invention relates to the technical field of metal detection, in particular to an image-based metal shell optical size detection method and system.
Background
In modern industrial automation, the connector inspection is usually performed with high repeatability and intelligence by human eyes, but sometimes, such as small size, accurate and rapid measurement, shape matching, color recognition, etc., people cannot continuously and stably perform with naked eyes, and other physical sensors are difficult to be used. With the continuous miniaturization and high-density assembly trend of electronic technology, the detection requirements on products are also becoming more and more strict, and the traditional visual detection is far from reaching the requirements. With the development of advanced manufacturing technology and the development of photoelectric technology products, the development is towards high technology, high precision, high quality, high added value, miniaturization and integration, and the corresponding precision detection technology is also suitable for the development. The precision detection technology is an advanced manufacturing service and plays a role in quality technical assurance.
In the 21 st century, industry technologies such as photoelectrons, information, electromechanics, automobiles and the like are continuously innovated, various high-tech products such as digital cameras, liquid crystals, automobiles and the like rapidly permeate into each household, various high-precision parts form the key of the products, and the precision and ultra-precision machining requirements of enterprises are continuously expanded; in addition, one of the key development directions of the current die processing is single-piece high-precision processing, namely the high-grade die is in vigorous demand.
In modern production, it is often necessary to measure the dimensions of the workpiece and determine whether the product meets the production standards. And for the porous metal workpiece, if a manual measuring method is adopted, the round hole and the straight line are required to be measured respectively, so that the efficiency and the precision are low. The traditional production mainly adopts a manual measurement method, the measurement range is limited, the precision is also influenced by subjective factors, and the measurement requirements of large batch, high strength and high precision can not be met.
For the problems in the related art, no effective solution has been proposed at present.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides an image-based metal shell optical size detection method and system, and solves the problems that the prior traditional production mainly adopts a manual measurement method in the prior art, the measurement range is limited, the precision is influenced by subjective factors, and the measurement requirements of large batch, high strength and high precision cannot be met.
In order to achieve the above purpose, the invention is realized by the following technical scheme:
according to one aspect of the present invention, there is provided an image-based metal casing optical size detection method comprising the steps of:
s1, synchronously shooting a metal shell in a target area at multiple angles by utilizing a multi-camera module, acquiring a plurality of multi-angle images, and preprocessing the images;
s2, extracting features of the preprocessed image, and taking the extracted feature image as the whole outline of the metal shell;
s3, dividing the obtained overall contour by utilizing a contour dividing method to determine a measurement target;
s4, accurately detecting and positioning edge points of different areas on the segmented contour by using a caliper tool method, fitting the edge points to obtain size parameters of the metal shell, and storing the size parameters into a database;
s5, carrying out deep excavation and analysis on the obtained metal shell size parameter and a preset standard size parameter through a fuzzy isolated forest algorithm, and judging whether the obtained metal shell size parameter and the preset standard size parameter are within an allowable tolerance range;
s6, recording the detection result and generating a metal shell size detection report.
Further, the multi-camera module is used for synchronously shooting the metal shell in the target area at multiple angles, a plurality of multi-angle images are obtained, and the preprocessing of the images comprises the following steps:
s11, setting the positions and angles of the multi-camera module according to the size and shape of the metal shell to be detected, so as to ensure that the metal shell can be shot from multiple angles;
s12, starting a multi-camera module, and synchronously shooting a metal shell in a target area to acquire multi-angle image information at the same time point;
s13, denoising, filtering and smoothing the repeated data, the missing value and the abnormal value of the acquired multi-angle image information data;
s14, connecting unprocessed data rows in the acquired multi-angle image information data to generate a new data table, associating different data tables through external key values to generate a complete data table, and obtaining an accurate data set.
Further, the step of extracting the features of the preprocessed image and taking the extracted features as the whole outline of the metal shell comprises the following steps:
s21, extracting an image sequence from the preprocessed image, and carrying out graying treatment on each frame of image in the image sequence to obtain a gray image;
s22, calculating the edge gradient of each pixel point in the gray image by adopting a Sobel operator;
s23, carrying out local screening and enhancement on the edge gradient by adopting a local gradient mean value method, and setting a threshold value to filter the edge gradient to obtain a gradient image;
s24, representing the image through ordered feature vectors of the Euclidean distance calculation area;
s25, carrying out thinning and binarization processing on the gradient image, and taking pixel points with gradient values larger than a threshold value as edge points;
s26, connecting adjacent edge points into a communication domain, and obtaining a final edge image serving as the whole outline of the metal shell.
Further, the method for dividing the obtained overall contour by using the contour dividing method, and determining the measurement target comprises the following steps:
s31, setting fixed threshold parameters;
s32, circularly traversing points on the outline to obtain the total number N;
s33, selecting a reference point as a starting point, and connecting the starting point with an N/2 point as an approximation bus segment;
s35, calculating the distance between the point on the contour line and the approximation bus segment, and if the distance between the point on the contour line and the approximation bus segment is larger than a fixed threshold parameter, connecting the maximum distance point with the starting point and the end point of the approximation bus segment to form two new approximation bus segment I and approximation bus segment II instead of the approximation bus segment;
s36, continuing to iteratively calculate the distance between the contour points until all the line segment distances are smaller than a fixed threshold parameter;
s37, if the point on a certain section of contour basically meets a linear equation, dividing the point into straight lines; if the straight line segmentation is not satisfied, all adjacent approximation line segments in the contour are sequentially compared, and the approximation is performed by utilizing the circular arcs;
s38, if the maximum error of the arc approximation is smaller than the average error of the approximation line segments, replacing the adjacent approximation line segments with the arc, dividing the contour into the arc, and if the arc is a closed polygon, dividing the contour into circles;
s39, determining the size parameter of the measurement target according to the obtained parameters of the straight line, the circular arc and the circle.
Further, the method for precisely detecting and positioning the edge points of different areas on the segmented contour by using a caliper tool method, fitting the edge points to obtain the dimension parameters of the metal shell, and storing the dimension parameters into a database comprises the following steps:
s41, acquiring basic information of a target to be measured, wherein the basic information comprises the diameter and center coordinates of a circle and two end point coordinates of a straight line;
s42, equidistant and equal-sized measurement rectangles are generated on the straight line or the circular outline and are used for sequentially detecting the positions of the positioning edge points;
s43, determining the best edge point detected by each measurement rectangle;
s44, calculating and measuring gradient amplitude values and directions of pixel points in the rectangle;
s45, determining the pixel points according to the non-maximum value suppression method as the optimal edge points;
s46, fitting the optimal edge points based on a Tukey algorithm to obtain the size parameters of the metal shell.
Further, the fitting of the best edge points based on the Tukey algorithm to obtain the size parameters of the metal shell comprises the following steps:
s461, at the beginning of the iteration, all edge points are given the same weight, i.e. W 1
S462, fitting the edge points by using a least square method to obtain a standard straight line;
s463, calculating the distance from each edge point to the straight line;
s464, if the distance from an edge point to a straight line is smaller than the preset value, the weight in the next iteration is still set to W 1 If the distance is greater than the preset value, the weight is set to W 0
S465, updating the weight of each point in each iteration, and gradually eliminating outliers;
s466, repeating the steps S461-S465 until the weight values of all the points are stabilized, and obtaining the clipping factors;
s467, fitting by using a Tukey weight function according to the weight and the clipping factor to obtain final edge contour pixel coordinates;
s468, converting the pixel coordinates of the edge contour with the common coordinates through a calibration method to obtain the physical size corresponding to each pixel, obtaining the size parameters of the metal shell through conversion calculation, and storing the size parameters into a database.
Further, the step of performing depth excavation and analysis on the obtained metal shell size parameter and a preset standard size parameter through a fuzzy isolated forest algorithm comprises the following steps:
s51, extracting the size parameters of the metal shell and preset standard size parameters from a database;
s52, according to the size manufacturing requirement analysis of the production line, determining a related factor set influencing the size manufacturing requirement, and setting a corresponding evaluation level;
s53, training the extracted metal shell size parameters and preset standard size parameters by using an isolated forest algorithm, calculating abnormal scores, and judging whether the size manufacturing requirements of all the parameters are unbalanced;
s54, normalizing the abnormal score value obtained by using an isolated forest algorithm, and calculating a fuzzy set;
s55, scoring each factor on different evaluation levels through professional evaluation to form a fuzzy relation matrix;
s56, calculating the fuzzy set and the fuzzy relation matrix by using a fuzzy operator to obtain a fuzzy comprehensive evaluation result vector;
s57, according to the rank summation of the component values and the grades in the vector, obtaining the relative position of the object to be evaluated, and judging the size manufacturing requirement condition of the object to be evaluated;
s58, judging whether the metal shell is within an allowable tolerance range, if so, determining that the metal shell is qualified in size, and if not, determining that the metal shell is unqualified;
and S59, optimizing the analysis result of the manufacturing requirement of the metal shell size obtained by the fuzzy isolated forest algorithm through personnel and production requirements.
Further, the step of determining a set of relevant factors affecting the dimensional manufacturing requirements according to the dimensional manufacturing requirements analysis of the production line and setting the corresponding evaluation level comprises the following steps:
s521, collecting various influencing factors related to the size of the metal shell according to the business characteristics and management requirements of the production line;
s522, screening and classifying supply and demand related factors of the various influencing factors, removing repeated factors, and summarizing the supply and demand related factors into a measurable factor set;
s523, setting factor weights, and setting an evaluation level for each factor;
and S524, reflecting the performance of the factor in the size manufacturing requirement analysis of the production line according to the evaluation level.
Further, the calculation formula of the weight vector and the fuzzy relation matrix by using the fuzzy operator is as follows:;/>
in the method, in the process of the invention,is a fuzzy operator;
is->Fuzzy comprehensive evaluation vectors of the types of the individual evaluation results;
a membership degree matrix for centralizing evaluation factors for factors of a certain object to be evaluated on various possible evaluation results in a comment set;
a fuzzy set composed of membership degrees of all single factors;
abis a non-zero natural number;
Eis a fuzzy set;
Athe fuzzy comprehensive evaluation result vector;
values that are fuzzy sets;
d is the number of rows of the membership matrix.
According to another aspect of the present invention, there is also provided an image-based metal-case optical dimension detection system, the system comprising: the device comprises an image acquisition and preprocessing module, a feature extraction module, a data processing module, a dimension measuring module, a data analysis module and a report generating module;
the image acquisition and preprocessing module is used for synchronously shooting the metal shell in the target area at multiple angles by utilizing the multi-camera module, acquiring a plurality of multi-angle images and preprocessing the images;
the feature extraction module is used for extracting features of the preprocessed image and taking the extracted feature image as the whole outline of the metal shell;
the data processing module is used for dividing the obtained overall contour by utilizing a contour dividing method to determine a measurement target;
the dimension measuring module is used for accurately detecting and positioning edge points of different areas on the segmented contour by using a caliper tool method, fitting the edge points to obtain dimension parameters of the metal shell, and storing the dimension parameters into a database;
the data analysis module is used for carrying out depth excavation and analysis on the obtained metal shell size parameter and a preset standard size parameter through a fuzzy isolated forest algorithm, and judging whether the obtained metal shell size parameter and the preset standard size parameter are within an allowable tolerance range;
and the report generation module is used for recording the detection result and generating a metal shell size detection report.
The beneficial effects of the invention are as follows:
1. according to the invention, the target is subjected to preprocessing such as graying, enhancement and filtering, and the contour of the region is extracted, so that the positioning accuracy of the edge points of the straight line and the circle is improved, the edge point detection method based on a calliper tool is used, the straight line and the circle are measured based on a Tukey fitting algorithm, the sub-pixel precision size is obtained through calculation, and the measurement precision can be improved and the efficiency is high.
2. According to the invention, the edge points are detected through the caliper tool, so that the edge point with the largest gradient amplitude perpendicular to the rectangle is detected by generating the measurement rectangles with the same size and distance, the optimal edge points are sequentially obtained by using the set number of the measurement rectangles, and finally, the edge contour can be obtained more accurately by fitting all the detected edge points, so that the traversing time is reduced, and the detection efficiency is improved.
3. The invention can be used for detecting whether the size parameter of the metal shell is within the tolerance range of the preset standard size by the fuzzy isolated forest algorithm, thereby being beneficial to finding out the problem in the production process in time and improving the product quality, and even if the size parameter of the metal shell has some small deviation, the fuzzy isolated forest algorithm can also correctly judge whether the size parameter of the metal shell is within the allowable tolerance range, and further improving the detection accuracy.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a method for image-based optical dimension detection of a metal housing according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments.
In the description of the present invention, unless otherwise indicated, the meaning of "a plurality" is two or more. Furthermore, the terms "first," "second," "third," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
According to an embodiment of the invention, an image-based metal shell optical size detection method and system are provided.
The invention will now be further described with reference to the accompanying drawings and detailed description, as shown in fig. 1, an image-based optical dimension detection method for a metal casing according to an embodiment of the invention, the detection method comprising the steps of:
s1, synchronously shooting a metal shell in a target area at multiple angles by utilizing a multi-camera module, acquiring a plurality of multi-angle images, and preprocessing the images;
in particular, a multi-camera module is a system of multiple cameras, which are typically mounted together precisely and controlled synchronously to capture images of multiple perspectives of the same scene simultaneously.
S2, extracting features of the preprocessed image, and taking the extracted feature image as the whole outline of the metal shell;
s3, dividing the obtained overall contour by utilizing a contour dividing method to determine a measurement target;
s4, accurately detecting and positioning edge points of different areas on the segmented contour by using a caliper tool method, fitting the edge points to obtain size parameters of the metal shell, and storing the size parameters into a database;
s5, carrying out deep excavation and analysis on the obtained metal shell size parameter and a preset standard size parameter through a fuzzy isolated forest algorithm, and judging whether the obtained metal shell size parameter and the preset standard size parameter are within an allowable tolerance range;
s6, recording the detection result and generating a metal shell size detection report.
In one embodiment, the multi-camera module is used for synchronously shooting the metal shell in the target area at multiple angles, obtaining a plurality of images at multiple angles, and preprocessing the images, wherein the steps comprise:
s11, setting the positions and angles of the multi-camera module according to the size and shape of the metal shell to be detected, so as to ensure that the metal shell can be shot from multiple angles;
s12, starting a multi-camera module, and synchronously shooting a metal shell in a target area to acquire multi-angle image information at the same time point;
s13, denoising, filtering and smoothing the repeated data, the missing value and the abnormal value of the acquired multi-angle image information data;
s14, connecting unprocessed data rows in the acquired multi-angle image information data to generate a new data table, associating different data tables through external key values to generate a complete data table, and obtaining an accurate data set.
In one embodiment, the feature extraction of the preprocessed image and the feature extraction of the preprocessed image as the overall outline of the metal shell include the following steps:
s21, extracting an image sequence from the preprocessed image, and carrying out graying treatment on each frame of image in the image sequence to obtain a gray image;
s22, calculating the edge gradient of each pixel point in the gray image by adopting a Sobel operator;
specifically, the Sobel operator is a classical image edge detection algorithm that can calculate the edge gradient of each pixel in a gray scale image. The principle is that the edge position is determined by convolution operation to find the place with the greatest pixel value variation in the image.
S23, carrying out local screening and enhancement on the edge gradient by adopting a local gradient mean value method, and setting a threshold value to filter the edge gradient to obtain a gradient image;
s24, representing the image through ordered feature vectors of the Euclidean distance calculation area;
specifically, calculating the Euclidean distance is a commonly used method of calculating the distance between two vectors. In practical applications, the motion sequence is generally divided into a plurality of time windows, and feature vectors in each time window are calculated respectively. The euclidean distance from the feature vector in the corresponding time window in the other sequence of actions can then be calculated for the feature vector in each time window.
S25, carrying out thinning and binarization processing on the gradient image, and taking pixel points with gradient values larger than a threshold value as edge points;
s26, connecting adjacent edge points into a communication domain, and obtaining a final edge image serving as the whole outline of the metal shell.
In one embodiment, the method for dividing the obtained overall contour by using the contour dividing method, and determining the measurement target includes the following steps:
s31, setting fixed threshold parameters;
s32, circularly traversing points on the outline to obtain the total number N;
s33, selecting a reference point as a starting point, and connecting the starting point with an N/2 point as an approximation bus segment;
s35, calculating the distance between the point on the contour line and the approximation bus segment, and if the distance between the point on the contour line and the approximation bus segment is larger than a fixed threshold parameter, connecting the maximum distance point with the starting point and the end point of the approximation bus segment to form two new approximation bus segment I and approximation bus segment II instead of the approximation bus segment;
s36, continuing to iteratively calculate the distance between the contour points until all the line segment distances are smaller than a fixed threshold parameter;
s37, if the point on a certain section of contour basically meets a linear equation, dividing the point into straight lines; if the straight line segmentation is not satisfied, all adjacent approximation line segments in the contour are sequentially compared, and the approximation is performed by utilizing the circular arcs;
s38, if the maximum error of the arc approximation is smaller than the average error of the approximation line segments, replacing the adjacent approximation line segments with the arc, dividing the contour into the arc, and if the arc is a closed polygon, dividing the contour into circles;
s39, determining the size parameter of the measurement target according to the obtained parameters of the straight line, the circular arc and the circle.
In one embodiment, the accurately detecting and positioning the edge points of different areas on the segmented contour by using the caliper tool method, fitting the edge points to obtain the size parameters of the metal shell, and storing the size parameters into the database comprises the following steps:
s41, acquiring basic information of a target to be measured, wherein the basic information comprises the diameter and center coordinates of a circle and two end point coordinates of a straight line;
s42, equidistant and equal-sized measurement rectangles are generated on the straight line or the circular outline and are used for sequentially detecting the positions of the positioning edge points;
s43, determining the best edge point detected by each measurement rectangle;
s44, calculating and measuring gradient amplitude values and directions of pixel points in the rectangle;
s45, determining the pixel points according to the non-maximum value suppression method as the optimal edge points;
s46, fitting the optimal edge points based on a Tukey algorithm to obtain the size parameters of the metal shell.
In one embodiment, the fitting the best edge points based on Tukey algorithm to obtain the dimensional parameters of the metal shell includes the following steps:
s461, at the beginning of the iteration, all edge points are given the same weight, i.e. W 1
S462, fitting the edge points by using a least square method to obtain a standard straight line;
s463, calculating the distance from each edge point to the straight line;
s464, if the distance from an edge point to a straight line is smaller than the preset value, the weight in the next iteration is still set to W 1 If the distance is greater than the preset value, the weight is set to W 0
S465, updating the weight of each point in each iteration, and gradually eliminating outliers;
s466, repeating the steps S461-S465 until the weight values of all the points are stabilized, and obtaining the clipping factors;
s467, fitting by using a Tukey weight function according to the weight and the clipping factor to obtain final edge contour pixel coordinates;
s468, converting the pixel coordinates of the edge contour with the common coordinates through a calibration method to obtain the physical size corresponding to each pixel, obtaining the size parameters of the metal shell through conversion calculation, and storing the size parameters into a database.
In one embodiment, the depth mining and analysis of the obtained metal shell size parameter and the preset standard size parameter through the fuzzy isolated forest algorithm comprises the following steps:
s51, extracting the size parameters of the metal shell and preset standard size parameters from a database;
s52, according to the size manufacturing requirement analysis of the production line, determining a related factor set influencing the size manufacturing requirement, and setting a corresponding evaluation level;
s53, training the extracted metal shell size parameters and preset standard size parameters by using an isolated forest algorithm, calculating abnormal scores, and judging whether the size manufacturing requirements of all the parameters are unbalanced;
specifically, training the extracted metal shell size parameter and the preset standard size parameter by using an isolated forest algorithm, calculating an anomaly score, and judging whether the size manufacturing requirement unbalance exists in each parameter or not further comprises:
dividing the extracted metal shell size parameter and a preset standard size parameter into a training set and a testing set;
training an isolated forest model by randomly selecting split points in the range of the characteristics and the characteristic values by using training set data;
constructing a plurality of isolated trees to form an isolated forest model;
calculating an average path length of each data point in the test set from the root node to the leaf node by using the isolated forest model;
calculating anomaly scores for the order demand data and the shop floor resource data based on the average path lengths of the data points;
and judging whether each data point has unbalance of the size manufacturing requirement according to the anomaly score and the set threshold value.
Specifically, during the training process, the data points are divided into two subsets (one of which contains the data points smaller than or equal to the characteristic value and the other contains the data points larger than the characteristic value) according to the selected characteristic value, and a splitting operation is performed; this process is repeated recursively for each subset until a stop condition is met (e.g., subset size reaches a predetermined threshold, tree depth reaches a maximum).
S54, normalizing the abnormal score value obtained by using an isolated forest algorithm, and calculating a fuzzy set;
s55, scoring each factor on different evaluation levels through professional evaluation to form a fuzzy relation matrix;
s56, calculating the fuzzy set and the fuzzy relation matrix by using a fuzzy operator to obtain a fuzzy comprehensive evaluation result vector;
specifically, calculating the fuzzy set and the fuzzy relation matrix by using a fuzzy operator, and obtaining a fuzzy comprehensive evaluation result vector further comprises:
determining a factor set of the evaluation object according to the characteristics and the attributes of the production line, wherein the factor set comprises all the characteristics of the evaluation object;
specifically, the factor set includes various features such as dimensional accuracy of the metal housing, accuracy of the measurement device, skill level of the operator, environmental conditions, reliability of the measurement method, and the like.
S57, according to the rank summation of the component values and the grades in the vector, obtaining the relative position of the object to be evaluated, and judging the size manufacturing requirement condition of the object to be evaluated;
s58, judging whether the metal shell is within an allowable tolerance range, if so, determining that the metal shell is qualified in size, and if not, determining that the metal shell is unqualified;
in particular, the allowable tolerance ranges for metal shell dimensions are generally determined by design specifications or product requirements. This range shows the maximum and minimum values that the metal shell dimensions can deviate from the standard dimensions, for example, if the standard length of a metal shell is 100mm and the allowable tolerance is + -1 mm, then the length of the metal shell can be between 99mm and 101 mm. If the measurement result is within this range, the size of the metal shell is acceptable; if the measurement result is outside this range, the size of the metal shell is not acceptable.
And S59, optimizing the analysis result of the manufacturing requirement of the metal shell size obtained by the fuzzy isolated forest algorithm through personnel and production requirements.
In one embodiment, the determining the set of related factors affecting the dimensional manufacturing requirements according to the dimensional manufacturing requirements analysis of the production line, and setting the corresponding evaluation level includes the steps of:
s521, collecting various influencing factors related to the size of the metal shell according to the business characteristics and management requirements of the production line;
s522, screening and classifying supply and demand related factors of the various influencing factors, removing repeated factors, and summarizing the supply and demand related factors into a measurable factor set;
s523, setting factor weights, and setting an evaluation level for each factor;
and S524, reflecting the performance of the factor in the size manufacturing requirement analysis of the production line according to the evaluation level.
In one embodiment, the calculating formula of the weight vector and the fuzzy relation matrix by using the fuzzy operator is as follows:;/>
in the method, in the process of the invention,is a fuzzy operator;
is->Fuzzy comprehensive evaluation vectors of the types of the individual evaluation results;
a membership degree matrix for centralizing evaluation factors for factors of a certain object to be evaluated on various possible evaluation results in a comment set;
a fuzzy set composed of membership degrees of all single factors;
abis a non-zero natural number;
Eis a fuzzy set;
Athe fuzzy comprehensive evaluation result vector;
values that are fuzzy sets;
d is the number of rows of the membership matrix.
There is also provided, in accordance with another embodiment of the present invention, an image-based metal-case optical dimension detection system, including: the device comprises an image acquisition and preprocessing module, a feature extraction module, a data processing module, a dimension measuring module, a data analysis module and a report generating module;
the image acquisition and preprocessing module is used for synchronously shooting the metal shell in the target area at multiple angles by utilizing the multi-camera module, acquiring a plurality of multi-angle images and preprocessing the images;
the feature extraction module is used for extracting features of the preprocessed image and taking the extracted feature image as the whole outline of the metal shell;
the data processing module is used for dividing the obtained overall contour by utilizing a contour dividing method to determine a measurement target;
the dimension measuring module is used for accurately detecting and positioning edge points of different areas on the segmented contour by using a caliper tool method, fitting the edge points to obtain dimension parameters of the metal shell, and storing the dimension parameters into a database;
the data analysis module is used for carrying out depth excavation and analysis on the obtained metal shell size parameter and a preset standard size parameter through a fuzzy isolated forest algorithm, and judging whether the obtained metal shell size parameter and the preset standard size parameter are within an allowable tolerance range;
and the report generation module is used for recording the detection result and generating a metal shell size detection report.
In summary, by means of the above technical scheme of the present invention, edge points are detected by the caliper tool, so that edge points with maximum gradient amplitude perpendicular to the rectangle are detected by generating measurement rectangles with consistent size and distance, the optimal edge points are sequentially obtained by using the set number of measurement rectangles, and finally, more accurate edge contours can be obtained by fitting all the detected edge points, so that traversing time is reduced, and detection efficiency is improved. The invention can be used for detecting whether the size parameter of the metal shell is within the tolerance range of the preset standard size by the fuzzy isolated forest algorithm, thereby being beneficial to finding out the problem in the production process in time and improving the product quality, and even if the size parameter of the metal shell has some small deviation, the fuzzy isolated forest algorithm can also correctly judge whether the size parameter of the metal shell is within the allowable tolerance range, and further improving the detection accuracy.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, alternatives, and improvements that fall within the spirit and scope of the invention.

Claims (10)

1. An image-based metal shell optical size detection method is characterized by comprising the following steps:
s1, synchronously shooting a metal shell in a target area at multiple angles by utilizing a multi-camera module, acquiring a plurality of multi-angle images, and preprocessing the images;
s2, extracting features of the preprocessed image, and taking the extracted feature image as the whole outline of the metal shell;
s3, dividing the obtained overall contour by utilizing a contour dividing method to determine a measurement target;
s4, accurately detecting and positioning edge points of different areas on the segmented contour by using a caliper tool method, fitting the edge points to obtain size parameters of the metal shell, and storing the size parameters into a database;
s5, carrying out deep excavation and analysis on the obtained metal shell size parameter and a preset standard size parameter through a fuzzy isolated forest algorithm, and judging whether the obtained metal shell size parameter and the preset standard size parameter are within an allowable tolerance range;
s6, recording the detection result and generating a metal shell size detection report.
2. The method for detecting the optical size of the metal shell based on the image according to claim 1, wherein the multi-angle synchronous shooting is carried out on the metal shell in the target area by utilizing the multi-camera module, a plurality of multi-angle images are obtained, and the preprocessing is carried out on the images, and the method comprises the following steps:
s11, setting the positions and angles of the multi-camera module according to the size and shape of the metal shell to be detected, so as to ensure that the metal shell can be shot from multiple angles;
s12, starting a multi-camera module, and synchronously shooting a metal shell in a target area to acquire multi-angle image information at the same time point;
s13, denoising, filtering and smoothing the repeated data, the missing value and the abnormal value of the acquired multi-angle image information data;
s14, connecting unprocessed data rows in the acquired multi-angle image information data to generate a new data table, associating different data tables through external key values to generate a complete data table, and obtaining an accurate data set.
3. The method for detecting optical dimensions of a metal shell based on images according to claim 1, wherein the step of extracting features from the preprocessed images and using the extracted features as the overall outline of the metal shell comprises the steps of:
s21, extracting an image sequence from the preprocessed image, and carrying out graying treatment on each frame of image in the image sequence to obtain a gray image;
s22, calculating the edge gradient of each pixel point in the gray image by adopting a Sobel operator;
s23, carrying out local screening and enhancement on the edge gradient by adopting a local gradient mean value method, and setting a threshold value to filter the edge gradient to obtain a gradient image;
s24, representing the image through ordered feature vectors of the Euclidean distance calculation area;
s25, carrying out thinning and binarization processing on the gradient image, and taking pixel points with gradient values larger than a threshold value as edge points;
s26, connecting adjacent edge points into a communication domain, and obtaining a final edge image serving as the whole outline of the metal shell.
4. The image-based metal shell optical size detection method according to claim 1, wherein the step of dividing the obtained overall contour by a contour dividing method to determine a measurement target comprises the steps of:
s31, setting fixed threshold parameters;
s32, circularly traversing points on the outline to obtain the total number N;
s33, selecting a reference point as a starting point, and connecting the starting point with an N/2 point as an approximation bus segment;
s35, calculating the distance between the point on the contour line and the approximation bus segment, and if the distance between the point on the contour line and the approximation bus segment is larger than a fixed threshold parameter, connecting the maximum distance point with the starting point and the end point of the approximation bus segment to form two new approximation bus segment I and approximation bus segment II instead of the approximation bus segment;
s36, continuing to iteratively calculate the distance between the contour points until all the line segment distances are smaller than a fixed threshold parameter;
s37, if the point on a certain section of contour basically meets a linear equation, dividing the point into straight lines; if the straight line segmentation is not satisfied, all adjacent approximation line segments in the contour are sequentially compared, and the approximation is performed by utilizing the circular arcs;
s38, if the maximum error of the arc approximation is smaller than the average error of the approximation line segments, replacing the adjacent approximation line segments with the arc, dividing the contour into the arc, and if the arc is a closed polygon, dividing the contour into circles;
s39, determining the size parameter of the measurement target according to the obtained parameters of the straight line, the circular arc and the circle.
5. The method for detecting the optical size of the metal shell based on the image according to claim 1, wherein the step of precisely detecting the edge points of different areas on the contour after the segmentation by using a caliper tool method, fitting the edge points to obtain the size parameters of the metal shell, and storing the size parameters in a database comprises the following steps:
s41, acquiring basic information of a target to be measured, wherein the basic information comprises the diameter and center coordinates of a circle and two end point coordinates of a straight line;
s42, equidistant and equal-sized measurement rectangles are generated on the straight line or the circular outline and are used for sequentially detecting the positions of the positioning edge points;
s43, determining the best edge point detected by each measurement rectangle;
s44, calculating and measuring gradient amplitude values and directions of pixel points in the rectangle;
s45, determining the pixel points according to the non-maximum value suppression method as the optimal edge points;
s46, fitting the optimal edge points based on a Tukey algorithm to obtain the size parameters of the metal shell.
6. The image-based metal shell optical size detection method according to claim 5, wherein the fitting of the best edge points by Tukey-based algorithm to obtain the size parameters of the metal shell comprises the following steps:
s461, at the beginning of the iteration, all edge points are given the same weight, i.e. W 1
S462, fitting the edge points by using a least square method to obtain a standard straight line;
s463, calculating the distance from each edge point to the straight line;
s464, if the distance from an edge point to a straight line is smaller than the preset value, the weight in the next iteration is still set to W 1 If the distance is greater than the preset value, the weight is set to W 0
S465, updating the weight of each point in each iteration, and gradually eliminating outliers;
s466, repeating the steps S461-S465 until the weight values of all the points are stabilized, and obtaining the clipping factors;
s467, fitting by using a Tukey weight function according to the weight and the clipping factor to obtain final edge contour pixel coordinates;
s468, converting the pixel coordinates of the edge contour with the common coordinates through a calibration method to obtain the physical size corresponding to each pixel, obtaining the size parameters of the metal shell through conversion calculation, and storing the size parameters into a database.
7. The image-based metal shell optical size detection method according to claim 1, wherein the step of performing depth mining and analysis on the obtained metal shell size parameter and a preset standard size parameter through a fuzzy isolated forest algorithm comprises the following steps:
s51, extracting the size parameters of the metal shell and preset standard size parameters from a database;
s52, according to the size manufacturing requirement analysis of the production line, determining a related factor set influencing the size manufacturing requirement, and setting a corresponding evaluation level;
s53, training the extracted metal shell size parameters and preset standard size parameters by using an isolated forest algorithm, calculating abnormal scores, and judging whether the size manufacturing requirements of all the parameters are unbalanced;
s54, normalizing the abnormal score value obtained by using an isolated forest algorithm, and calculating a fuzzy set;
s55, scoring each factor on different evaluation levels through professional evaluation to form a fuzzy relation matrix;
s56, calculating the fuzzy set and the fuzzy relation matrix by using a fuzzy operator to obtain a fuzzy comprehensive evaluation result vector;
s57, according to the rank summation of the component values and the grades in the vector, obtaining the relative position of the object to be evaluated, and judging the size manufacturing requirement condition of the object to be evaluated;
s58, judging whether the metal shell is within an allowable tolerance range, if so, determining that the metal shell is qualified in size, and if not, determining that the metal shell is unqualified;
and S59, optimizing the analysis result of the manufacturing requirement of the metal shell size obtained by the fuzzy isolated forest algorithm through personnel and production requirements.
8. The image-based metal shell optical dimension inspection method according to claim 7, wherein the steps of determining a set of related factors affecting the dimension manufacturing requirements according to the dimension manufacturing requirement analysis of the production line, and setting the corresponding evaluation level include the steps of:
s521, collecting various influencing factors related to the size of the metal shell according to the business characteristics and management requirements of the production line;
s522, screening and classifying supply and demand related factors of the various influencing factors, removing repeated factors, and summarizing the supply and demand related factors into a measurable factor set;
s523, setting factor weights, and setting an evaluation level for each factor;
and S524, reflecting the performance of the factor in the size manufacturing requirement analysis of the production line according to the evaluation level.
9. The image-based metal shell optical size detection method according to claim 8, wherein the calculation formula of the weight vector and the fuzzy relation matrix by using the fuzzy operator is:;/>
in the method, in the process of the invention,is a fuzzy operator;
is->The kind of the evaluation resultFuzzy comprehensive evaluation vectors;
a membership degree matrix for centralizing evaluation factors for factors of a certain object to be evaluated on various possible evaluation results in a comment set;
a fuzzy set composed of membership degrees of all single factors;
abis a non-zero natural number;
Eis a fuzzy set;
Athe fuzzy comprehensive evaluation result vector;
values that are fuzzy sets;
d is the number of rows of the membership matrix.
10. An image-based metal-shell optical dimension detection system for implementing the image-based metal-shell optical dimension detection method of any one of claims 1-9, the system comprising: the device comprises an image acquisition and preprocessing module, a feature extraction module, a data processing module, a dimension measuring module, a data analysis module and a report generating module;
the image acquisition and preprocessing module is used for synchronously shooting the metal shell in the target area at multiple angles by utilizing the multi-camera module, acquiring a plurality of multi-angle images and preprocessing the images;
the feature extraction module is used for extracting features of the preprocessed image and taking the extracted feature image as the whole outline of the metal shell;
the data processing module is used for dividing the obtained overall contour by utilizing a contour dividing method to determine a measurement target;
the dimension measuring module is used for accurately detecting and positioning edge points of different areas on the segmented contour by using a caliper tool method, fitting the edge points to obtain dimension parameters of the metal shell, and storing the dimension parameters into a database;
the data analysis module is used for carrying out depth excavation and analysis on the obtained metal shell size parameter and a preset standard size parameter through a fuzzy isolated forest algorithm, and judging whether the obtained metal shell size parameter and the preset standard size parameter are within an allowable tolerance range;
and the report generation module is used for recording the detection result and generating a metal shell size detection report.
CN202311447142.8A 2023-11-02 2023-11-02 Image-based metal shell optical size detection method and system Pending CN117173177A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311447142.8A CN117173177A (en) 2023-11-02 2023-11-02 Image-based metal shell optical size detection method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311447142.8A CN117173177A (en) 2023-11-02 2023-11-02 Image-based metal shell optical size detection method and system

Publications (1)

Publication Number Publication Date
CN117173177A true CN117173177A (en) 2023-12-05

Family

ID=88937912

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311447142.8A Pending CN117173177A (en) 2023-11-02 2023-11-02 Image-based metal shell optical size detection method and system

Country Status (1)

Country Link
CN (1) CN117173177A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117745730A (en) * 2024-02-21 2024-03-22 江苏嘉通能源有限公司 Polyester filament yarn detection method and system based on image processing technology

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020133046A1 (en) * 2018-12-27 2020-07-02 深圳配天智能技术研究院有限公司 Defect detection method and device
CN116881834A (en) * 2023-09-08 2023-10-13 泰州市银杏舞台机械工程有限公司 Stage load monitoring and early warning method based on stage deformation analysis

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020133046A1 (en) * 2018-12-27 2020-07-02 深圳配天智能技术研究院有限公司 Defect detection method and device
CN116881834A (en) * 2023-09-08 2023-10-13 泰州市银杏舞台机械工程有限公司 Stage load monitoring and early warning method based on stage deformation analysis

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李执 等: "基于机器视觉的金属工件尺寸测量", 《仪表技术与传感器》, no. 3, pages 92 - 97 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117745730A (en) * 2024-02-21 2024-03-22 江苏嘉通能源有限公司 Polyester filament yarn detection method and system based on image processing technology
CN117745730B (en) * 2024-02-21 2024-04-26 江苏嘉通能源有限公司 Polyester filament yarn detection method and system based on image processing technology

Similar Documents

Publication Publication Date Title
CN109141232B (en) Online detection method for disc castings based on machine vision
CN115937204B (en) Welded pipe production quality detection method
CN116309537B (en) Defect detection method for oil stain on surface of tab die
CN108428231B (en) Multi-parameter part surface roughness learning method based on random forest
CN114943739B (en) Aluminum pipe quality detection method
CN117173177A (en) Image-based metal shell optical size detection method and system
CN116563282B (en) Drilling tool detection method and system based on machine vision
CN113554649B (en) Defect detection method and device, computer equipment and storage medium
CN107633502B (en) Target center identification method for automatic centering of shaft hole assembly
CN107895362A (en) A kind of machine vision method of miniature binding post quality testing
CN116012380B (en) Insulator defect detection method, device, equipment and medium
CN115018835B (en) Automobile starter gear detection method
CN112819842B (en) Workpiece contour curve fitting method, device and medium suitable for workpiece quality inspection
CN117237449B (en) Control method and system of automatic test equipment
CN116778520B (en) Mass license data quality inspection method
US20230325413A1 (en) Error Factor Estimation Device and Error Factor Estimation Method
CN111815580B (en) Image edge recognition method and small module gear module detection method
CN111310402B (en) Method for detecting defects of bare printed circuit board based on surface-to-surface parallelism
CN110458231B (en) Ceramic product detection method, device and equipment
Yao et al. Robust locally weighted regression for profile measurement of magnesium alloy tube in hot bending process
CN113284158B (en) Image edge extraction method and system based on structural constraint clustering
CN112037158B (en) Shale gas field production equipment-based image enhancement labeling method
CN108734706A (en) A kind of rotor winding image detecting method of integration region distribution character and edge scale angle information
CN109087278B (en) Condom front and back recognition method based on improved Canny operator
CN117474910B (en) Visual detection method for motor quality

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