CN117152151B - Motor shell quality detection method based on machine vision - Google Patents
Motor shell quality detection method based on machine vision Download PDFInfo
- Publication number
- CN117152151B CN117152151B CN202311422636.0A CN202311422636A CN117152151B CN 117152151 B CN117152151 B CN 117152151B CN 202311422636 A CN202311422636 A CN 202311422636A CN 117152151 B CN117152151 B CN 117152151B
- Authority
- CN
- China
- Prior art keywords
- end shell
- motor
- motor front
- subarea
- brightness
- 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
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 47
- 230000007547 defect Effects 0.000 claims abstract description 73
- 238000010586 diagram Methods 0.000 claims abstract description 15
- 238000004458 analytical method Methods 0.000 claims abstract description 8
- 230000002159 abnormal effect Effects 0.000 claims abstract description 7
- 238000000034 method Methods 0.000 claims description 31
- 238000009826 distribution Methods 0.000 claims description 26
- 230000011218 segmentation Effects 0.000 claims description 15
- 239000000203 mixture Substances 0.000 claims description 9
- 238000009825 accumulation Methods 0.000 claims description 6
- 238000010606 normalization Methods 0.000 claims description 5
- 238000007689 inspection Methods 0.000 claims description 4
- 238000005259 measurement Methods 0.000 claims description 4
- 238000012797 qualification Methods 0.000 claims description 4
- 230000001174 ascending effect Effects 0.000 claims description 3
- 238000005457 optimization Methods 0.000 claims description 2
- 238000000513 principal component analysis Methods 0.000 abstract description 10
- 238000012545 processing Methods 0.000 abstract description 5
- 239000011159 matrix material Substances 0.000 description 7
- 238000003708 edge detection Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 5
- 238000004364 calculation method Methods 0.000 description 4
- 230000007797 corrosion Effects 0.000 description 3
- 238000005260 corrosion Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 206010040844 Skin exfoliation Diseases 0.000 description 2
- 229910052782 aluminium Inorganic materials 0.000 description 2
- XAGFODPZIPBFFR-UHFFFAOYSA-N aluminium Chemical compound [Al] XAGFODPZIPBFFR-UHFFFAOYSA-N 0.000 description 2
- 230000002950 deficient Effects 0.000 description 2
- 238000001914 filtration Methods 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 229910000838 Al alloy Inorganic materials 0.000 description 1
- 229910001018 Cast iron Inorganic materials 0.000 description 1
- 230000005856 abnormality Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000002146 bilateral effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- JEIPFZHSYJVQDO-UHFFFAOYSA-N iron(III) oxide Inorganic materials O=[Fe]O[Fe]=O JEIPFZHSYJVQDO-UHFFFAOYSA-N 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 229910052751 metal Inorganic materials 0.000 description 1
- 239000002184 metal Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000001681 protective effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 238000007789 sealing Methods 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Geometry (AREA)
- Image Analysis (AREA)
- Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
Abstract
The invention relates to the technical field of image data processing, and provides a motor shell quality detection method based on machine vision, which comprises the following steps: acquiring a gray level diagram of a motor front end shell and a brightness diagram of the motor front end shell; acquiring the glossiness abnormal degree of each motor front end shell subarea according to the glossiness characteristics between the motor front end shell subareas on the front end shell brightness map; obtaining a structural difference value of each motor front end shell subarea according to a connected domain analysis result of the motor front end shell subarea in the front end shell brightness map; determining defect significant coefficients of the front end shell subareas of each motor based on the glossiness anomaly degree and the structure difference value of the front end shell subareas of each motor; and obtaining a quality detection result of the motor front end shell based on the significance detection result of the motor front end shell and the defect significance coefficient of the motor front end shell subregion. The invention solves the problem of false detection when the robust principal component analysis algorithm faces to the tiny defects on the motor front end shell, and improves the detection precision of the defects in the complex area of the motor front end shell.
Description
Technical Field
The invention relates to the technical field of image processing, in particular to a motor shell quality detection method based on machine vision.
Background
The motor shell is an external protective shell arranged on motor equipment, and the materials of the motor shell are cast iron, cast aluminum alloy and the like, so that the motor shell is mainly used for protecting the motor from being influenced by rainwater, corrosion, rust and other environments, and can help the motor to dissipate heat and provide certain insulating performance. The manufacturing of the motor shell needs to be subjected to multiple working procedures, and if problems such as deviation, error or improper operation occur in the processing, quality problems such as burrs, peeling and the like can occur on the surface of the motor shell. Burrs or peelings on the motor shell can damage the flatness and smoothness of the surface of the motor shell, the attractiveness and the overall quality image of the product are reduced, the sealing performance of the shell can be possibly damaged, the performance and the service life of the motor are reduced, and the possibility of stabbing operators can occur, so that the surface quality of the motor shell is required to be detected, the quality problem in the production process is timely found, and corresponding improvement measures are further adopted.
The robust principal component analysis RPCA (Robust Principal Component Analysis) algorithm is a method of decomposing a matrix into low-rank components and sparse components, and is widely used for object recognition, video compression, defect detection, and the like. The RPCA algorithm can effectively improve the phenomenon of uneven illumination in a metal surface graph, but when the robust principal component analysis RPCA algorithm performs an industrial surface defect detection task, as the separation of defects in the graph by the algorithm depends on the difference between a defect part and a normal part, when a complex surface defect detection scene is processed, the missing detection or the false detection of tiny surface defects or surface defects similar to the normal area can be caused.
Disclosure of Invention
The invention provides a motor shell quality detection method based on machine vision, which aims to solve the problem that an RPCA algorithm is easy to misdetect when facing to a small defect on a motor front end shell, and adopts the following technical scheme:
one embodiment of the invention provides a machine vision-based motor housing quality detection method, which comprises the following steps:
acquiring a gray level diagram of a motor front end shell and a brightness diagram of the motor front end shell;
obtaining motor front end shell subareas on the motor front end shell brightness map based on the motor front end shell brightness map by adopting a map segmentation algorithm, and obtaining the glossiness abnormal degree of each motor front end shell subarea according to the glossiness characteristics between the motor front end shell subareas on the front end shell brightness map;
obtaining a structural difference value of each motor front end shell subarea according to a connected domain analysis result of the motor front end shell subarea in the front end shell brightness map;
determining defect significant coefficients of the front end shell subareas of each motor based on the glossiness anomaly degree and the structure difference value of the front end shell subareas of each motor; and obtaining a quality detection result of the motor front end shell based on the significance detection result of the motor front end shell and the defect significance coefficient of the motor front end shell subregion.
Preferably, the method for obtaining the glossiness of each motor front end housing subarea according to the glossiness characteristics between the motor front end housing subareas on the front end housing brightness map comprises the following steps:
acquiring the gloss contrast of each motor front end shell subarea based on the distribution characteristics of the pixel point brightness values in each motor front end shell subarea on the front end shell brightness map;
acquiring a flattening difference coefficient of each motor front end shell subarea based on the value difference of the brightness values of the pixel points in each motor front end shell subarea on the front end shell brightness map;
the glossiness of each motor front end shell subarea consists of a glossiness contrast ratio and a flattening difference coefficient, wherein the glossiness is in direct proportion to the glossiness contrast ratio and the flattening difference coefficient.
Preferably, the method for obtaining the gloss contrast of each motor front end shell subarea based on the distribution characteristics of the brightness values of the pixel points in each motor front end shell subarea on the front end shell brightness map comprises the following steps:
taking a histogram constructed by taking each brightness level in each front-end shell subarea as a group and taking the probability of each brightness level occurring in each front-end shell subarea as a value of a corresponding group as a brightness distribution histogram of each front-end shell subarea;
obtaining a measurement distance between the brightness distribution histograms of the front end shell subregions of all the motors and the brightness distribution histograms of the other arbitrary front end shell subregions of the motors; and taking the average value of the accumulated results of the measurement distances on all the other motor front end shell subareas as the gloss contrast of each motor front end shell subarea.
Preferably, the method for obtaining the flattening difference coefficient of each motor front end shell subarea based on the value difference of the brightness value of the pixel point in each motor front end shell subarea on the front end shell brightness map comprises the following steps:
taking the product of the standard deviation of all brightness values in each motor front end shell subarea and the number of brightness levels in each motor front end shell subarea as a first product factor;
taking the difference value of the first product factor corresponding to each motor front end housing subarea and the first product factor corresponding to any one of the rest motor front end housing subareas as a first difference value; and taking the average value of the accumulated results of the squares of the first difference values on all the other motor front end shell subareas as the flattening difference coefficient of each motor front end shell subarea.
Preferably, the method for obtaining the structural difference value of each motor front end housing subarea according to the analysis result of the connected domain of the motor front end housing subarea in the front end housing brightness map comprises the following steps:
determining a structural edge change coefficient of each motor front end housing subarea based on the change degree of the gradient direction angle of the edge point on the brightness edge in each motor front end housing subarea;
obtaining the square of the difference between the structural edge change coefficient of each motor front end shell sub-region and the structural edge change coefficient of any one of the rest motor front end shell sub-regions; and taking the average value of the accumulated results of the squares of the differences on all the other motor front end shell subareas as the structure difference value of each motor front end shell subarea.
Preferably, the method for determining the structural edge change coefficient of each motor front end housing subarea based on the change degree of the gradient direction angle of the upper edge point of the brightness edge in each motor front end housing subarea comprises the following steps:
marking the edge line of any one of the communicating areas in the front end shell subareas of each motor as a brightness edge;
forming a first-order differential sequence of a sequence according to the gradient direction angles of all pixel points on each brightness edge in an ascending order as an edge angle sequence of each brightness edge;
respectively counting the occurrence probability of each gradient direction angle on each brightness edge, and taking a sequence formed by all the probabilities as an edge distribution sequence of each brightness edge;
taking the product of the standard deviation of all elements in the edge distribution sequence of each brightness edge and the standard deviation of all elements in the edge angle sequence as a first accumulation factor;
and taking the average value of the accumulated results of the first accumulation factors on all brightness edges in each motor front end shell subarea as the structural edge change coefficient of each motor front end shell subarea.
Preferably, the method for determining the defect significant coefficient of each motor front end housing subarea based on the gloss anomaly degree and the structure difference value of each motor front end housing subarea comprises the following steps:
taking the sum of the glossiness abnormal degree of each motor front end shell subarea and a first preset parameter as a first composition factor;
taking the sum of the structural difference value of each motor front end housing subarea and a second preset parameter as a second composition factor; taking the product of the first composition factor and the second composition factor as the defect significant coefficient of each motor front end shell subarea.
Preferably, the method for obtaining the quality detection result of the motor front end shell based on the significance detection result of the motor front end shell and the defect significance coefficient of the motor front end shell subregion comprises the following steps:
inputting a gray level image of a front end shell of the motor as an algorithm, and obtaining an initial saliency image of the front end shell of the motor by adopting a saliency detection algorithm;
determining an optimized salient value of each pixel point according to the salient value of each pixel point in the initial salient map and the defect salient coefficient of each motor front end shell sub-area;
and obtaining a quality detection result of the motor front end shell according to a comparison result of the optimized salient value of each pixel point in the initial salient map and a threshold value.
Preferably, the method for determining the optimized saliency value of each pixel point according to the saliency value of each pixel point in the initial saliency map and the defect saliency coefficient of each motor front end shell sub-area includes:
taking the defect significant coefficient of each motor front end shell subarea on the front end shell brightness map as the optimization coefficient of any pixel point in the motor front end shell subarea;
taking the product of the significant value of each pixel point in the initial significant map and the optimizing coefficient of the pixel point at the same position on the front end shell brightness map as the input of the normalization function, taking the product of the output of the normalization function and the maximum value of the significant value in the initial significant map as the input of the rounding function, and taking the output of the rounding function as the optimizing significant value of each pixel point.
Preferably, the method for obtaining the quality detection result of the front end shell of the motor according to the comparison result of the optimized salient value of each pixel point in the initial salient map and the threshold value comprises the following steps:
obtaining a segmentation threshold value of the optimized significant values of all the pixel points by using a threshold segmentation algorithm, and taking the pixel points with the optimized significant values larger than the segmentation threshold value as the pixel points in the defect area of the motor front end shell; taking the pixel point with the optimized significant value smaller than the segmentation threshold value as the pixel point in the normal area of the motor front end shell;
and taking the ratio of the number of the pixels in the normal area of the front end shell of the motor in the initial saliency map to the number of the pixels in the initial saliency map as the quality inspection qualification rate of the front end shell of the motor.
The beneficial effects of the invention are as follows: according to the invention, the glossiness anomaly degree is constructed according to the influence of the surface defect of the motor front end shell on the glossiness of the motor front end shell and the distribution characteristics of the defect region and the normal region on the brightness value, so that the difference between the tiny defect region and the normal region in the surface defect of the motor front end shell can be increased; and secondly, a structural difference value is constructed according to the difference between the surface defect of the motor front end shell and the structures such as the surface holes, the bosses and the like of the motor front end shell, the influence of the surface structure of the motor front end shell on the detection of the micro defect area in the surface defect of the motor front end shell is reduced, a larger weight is given to pixel points with larger defect significant coefficients based on the gloss anomaly degree and the structural difference value, the significance of the micro defect on the surface of the motor front end shell in a Robust Principal Component Analysis (RPCA) algorithm is improved, and the detection effect of the Robust Principal Component Analysis (RPCA) algorithm on the micro defect area on the surface of the motor front end shell is enhanced.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the invention, and that other drawings can be obtained according to these drawings without inventive faculty for a person skilled in the art.
Fig. 1 is a flow chart of a machine vision-based motor housing quality detection method according to an embodiment of the present invention;
fig. 2 is a schematic structural view of a front end housing of a motor according to an embodiment of the present invention;
fig. 3 is a flowchart of an implementation of a machine vision-based motor housing quality detection method 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. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, a flow chart of a machine vision-based motor housing quality detection method according to an embodiment of the invention is shown, the method includes the following steps:
and S001, acquiring a gray level diagram of a front end shell of the motor and a brightness diagram of the front end shell of the motor.
The motor housing generally includes a casing and a front end cover, and in the present invention, the front end cover in the aluminum servo motor housing is used as a quality detection object, and for convenience of the following description, the aluminum servo motor housing is described as a motor front end housing. Firstly, an industrial CCD camera is used for shooting right above a motor front end shell, an RGB image of the motor front end shell is obtained, and the RGB image is recorded as a motor front end shell image. Because noise exists in the acquired images in the shooting process of the camera and the transmission process of the images, the noise is removed from the motor housing images by adopting median filtering so as to reduce the influence of the noise on the subsequent image processing, wherein bilateral filtering is a known technology and is not repeated. And secondly, converting the denoised motor front end shell image into a gray image to obtain the motor front end shell gray image. And converting the denoised motor front end shell map into an HLS color space to obtain a brightness channel map in the HLS color space, and recording the brightness channel map as a motor front end shell brightness map.
And obtaining a gray level diagram of the motor front end shell and a brightness diagram of the motor front end shell, and analyzing the characteristics of the diagram on the motor front end shell subsequently.
And step S002, acquiring the glossiness abnormal degree of each motor front end shell subarea according to the glossiness characteristics between the motor front end shell subareas on the front end shell brightness map.
Since the color difference between the tiny defect areas such as burrs and bubbles on the surface of the front end shell of the motor and the normal area is small, and the structures such as holes and bosses on the surface of the front end shell of the motor can form convex or concave parts, as shown in fig. 2, the reflection or refraction of light rays can be caused, so that the outline edges of the bosses and the holes and the tiny defects nearby the boss and the holes cannot be clearly displayed, and further the tiny defects are missed or false detected. Therefore, the invention improves the contrast ratio of the micro defect area and the normal area through the distribution characteristic of the defect area on the surface of the motor front end shell in the surface diagram and the difference between the defect area and the areas such as holes, bosses and the like, so as to enhance the detection effect of the robust principal component analysis RPCA (Robust Principal Component Analysis) algorithm on the micro defect area on the surface of the motor front end shell.
Specifically, firstly, a Canny edge detection algorithm is used for processing a gray level diagram of a front end shell of a motor to obtain a binarized diagram, wherein the Canny edge detection algorithm is a known technology and is not repeated. And secondly, carrying out connected domain analysis on the obtained binarization map to obtain a plurality of connected domains, screening out the connected domain with the largest number of pixels, and taking the corresponding region of the connected domain in the motor front-end shell gray level map as the motor front-end shell region in the motor front-end shell gray level map.
Further, the motor front end shell region is segmented by adopting a simple linear iterative clustering SLIC (Simple Linear Iterative Cluster) algorithm, the motor front end shell region is used as input of an SLIC algorithm, the output of the SLIC algorithm is N sub-regions obtained by segmentation of the motor front end shell region, the SLIC algorithm is a known technology, the specific process is not repeated, each sub-region is used as a motor front end shell sub-region, the size of N is taken as an experimental value 128, and an operator can select a proper experimental value according to the actual size of the motor front end shell.
Because the surface of the front end shell of the motor has serious surface defects such as cracks, corrosion, scratches and the like, an oxide layer on the surface of the front end shell of the motor can be damaged, and tiny defect areas such as burrs, bubbles and the like can cause the surface of the front end shell of the motor to have the concave-convex or undulating phenomenon, so that the flatness of an oxide film on the surface and the glossiness of the surface of the oxide film are reduced. Therefore, the invention screens out the area suspected of the surface defect of the motor front end shell through the difference of the oxide film on the surface of the motor front end shell between different areas.
Specifically, for any motor front end housing subarea, taking the ith motor front end housing subarea as an example, calculating brightness values of all pixel points in the ith front end housing subarea, and taking each unequal brightness value as a brightness level. Secondly, counting the number of pixel points contained in each brightness level, and taking the ratio of the number of pixel points contained in each brightness level to the total number of pixel points in the ith motor front end housing subarea as the probability of each brightness level in the ith motor front end housing subarea. Taking each brightness level in the ith front-end housing subarea as a group, taking the probability of each brightness level appearing in the ith front-end housing subarea as a value of the corresponding group, taking a histogram constructed by all brightness levels and the value of each brightness level corresponding group as a brightness distribution histogram A of the ith front-end housing subarea i . Based on the above analysis, a gloss anomaly is constructed here to characterize the likelihood of defects in each front end housing subregion, and the gloss anomaly L for the ith front end housing subregion is calculated i :
Wherein S is i Is the gloss contrast of the ith front end housing subregion, N is the number of front end housing subregions, j is the jth front end housing subregion remaining except for the ith front end housing subregion, A i 、A j The luminance distribution histogram, bd (A) i ,A j ) Is a histogram A i 、A j The calculation process of the Babbitt distance between the two is a known technology, and the specific process is not repeated;
P i is the flatness difference coefficient of the i-th front end housing subregion,the standard deviation of the brightness values of the pixel points in the ith and jth front end housing subareas are respectively n i 、n j The number of brightness levels in the ith and jth front end housing sub-regions, respectively;
L i is the gloss anomaly of the i-th front end housing subregion.
Wherein when the surface of the motor front end shell has defects, the surface defects such as cracks, corrosion, scratches and the like on the surface of the motor front end shell damage the oxide film on the surface of the motor front end shell, so that the reflection and refraction degrees of light rays in the areas are lower, the brightness of the defect areas is darker, the brightness is obviously reduced, and therefore, when the defects exist in the ith motor front end shell subarea, the difference between brightness distribution histograms corresponding to the ith front end shell subarea and the jth front end shell subarea is larger, bd (A) i ,A j ) The greater the value of (2); the smaller the flatness of the i-th motor front end housing subregion is, the more uneven the brightness distribution of the i-th motor front end housing subregion is,the larger the value of (2), the first product factor +.>The greater the value of (2); i.e. L i The greater the value of (a) is, the higher the degree of abnormality of the oxide film covered on the surface of the i-th motor front end housing subregion is, the more likely it is that the oxide film is present in the i-th motor front end housing subregionIn the defect area.
The glossiness anomaly of each motor front end shell subarea is obtained so as to be used for determining defect significant coefficients of each motor front end shell subarea subsequently.
Step S003, obtaining a structural difference value of each motor front end shell subarea according to a connected domain analysis result of the motor front end shell subarea in the front end shell brightness map; and determining the defect significance coefficient of each motor front end housing subarea based on the glossiness anomaly degree and the structural difference value of each motor front end housing subarea.
On the other hand, the color difference value between the holes on the surface of the motor front end shell and the nearby area is larger, namely, the color difference value is represented as larger brightness difference, and the boss on the surface of the motor front end shell forms a convex or concave part on the surface of the boss, so that the surface unevenness condition can also occur in the area where the contour edge of the boss is located, the contour shape of the holes on the surface of the motor front end shell and the boss is generally arc-shaped, and the contour shape of the surface defect is generally unfixed, therefore, the surface defect area of the motor front end shell can be distinguished according to the contour difference between the surface defect of the motor front end shell, the holes and the boss.
Specifically, an edge detection algorithm is used to obtain an edge line in a sub-area of a front end shell of each motor, for example, a luminance map corresponding to the sub-area of the front end shell of the ith motor is processed by a canny edge detection technology to obtain a binarization map corresponding to the luminance map, further, a connected domain extraction algorithm is used to obtain all connected domains on the binarization map, each connected domain corresponds to a hole, a boss outline or a defect area on the surface of the front end shell of the motor, and the edge line of any connected domain is marked as a luminance edge, wherein the canny edge detection and the connected domain are extracted as known techniques, and specific processes are not repeated.
Further, acquiring gradient direction angles of all the upper edge points of the brightness edges in the front end shell subarea of each motor by utilizing a sobel operator, constructing an edge angle sequence and an edge distribution sequence according to the gradient direction angles of the upper edge points of each brightness edge in the front end shell subarea of each motor, and calculating gradients by utilizing the sobel operatorThe angles are known techniques, and the detailed process is not repeated. With the p-th brightness edge Y in the i-th motor front end housing sub-area ip For example, the luminance edge Y is obtained ip The gradient direction angles of all the edge points are formed into a sequence according to ascending order to be used as a first edge sequence, and the first differential sequence of the first edge sequence is used as a brightness edge Y ip Edge angle sequence B of (2) ip The method comprises the steps of carrying out a first treatment on the surface of the Secondly, calculating brightness edges Y by taking each unequal gradient direction angle as one gradient direction angle ip The probability of each gradient direction angle is presented, and the brightness edge Y is obtained ip The sequence consisting of the probability of occurrence of all gradient direction angles is taken as a brightness edge Y ip Edge distribution sequence C of (2) ip . Acquiring a structural difference value V of the ith motor front end housing subarea based on edge angle sequences and edge distribution sequences of all brightness edges in the ith motor front end housing subarea i :
In U i For the structural edge change coefficient of the ith motor front end housing subarea, N 1 Is the number of brightness edges in the i-th motor front end housing sub-area, B ip 、C ip The sequence of the edge angles and the sequence of the edge distribution of the p-th brightness edge in the sub-area of the front end shell of the ith motor,the standard deviation of the elements in the edge angle sequence are respectively;
V i is the structural difference value of the i-th motor front end housing subarea, N is the number of the motor front end housing subareas, U j Is the structural edge variation coefficient of the jth front end housing subregion remaining except for the ith front end housing subregion.
Wherein, the ith motor front endThe more uniform the change between the corresponding gradient direction angles of the edge points on the p-th brightness edge in the shell area, the more stable the distribution of elements in the edge angle sequence,the smaller the value of (2); the higher the degree of regularity of the p-th brightness edge corresponding to the connected domain in the i-th motor front end shell sub-region is, the edge distribution sequence C ip The more uniform the probability of occurrence of the elements +.>The smaller the value of (2), the first accumulation factor +.>The smaller the value of (2); the greater the probability that there is a non-motor front end housing surface hole, contour edge of the boss in the i-th motor front end housing subregion, the more likely the i-th motor front end housing subregion contains the edge of the defective region, the greater the difference between the i-th motor front end housing subregion and the remaining motor front end housing subregions>The greater the value of (2); i.e. V i The larger the value of (c) is, the greater the probability of a defective region being present in the i-th motor front end housing sub-region.
According to the steps, the gloss abnormal degree and the structure difference value of all the motor front end shell subregions are respectively obtained. And determining a defect significance coefficient of each motor front end housing subregion based on the gloss anomaly and the structural difference value of each motor front end housing subregion. The calculation formula of the defect significant coefficient w (i) of the ith motor front end housing subarea is as follows:
wherein w (i) is defect significance coefficients of i motor front end housing subregions, L i 、V i The gloss anomaly and the structure difference values of the front end shell subregions of the i motors are respectively,respectively the proportionality coefficient, for preventing L i Or V i Effect on the calculation result at 0, +.>The magnitude of (2) is respectively taken as an empirical value of 1.
Wherein, the higher the probability of defects existing in the front end housing subregion of the ith motor, L i 、V i The larger the value of (a) is, the first composition factorSecond component factor->The greater the value of w (i), and correspondingly, the greater the degree of significance of the ith motor front end housing subregion in the motor front end luminance map.
So far, the defect significant coefficient of each motor front end shell subarea in the front end shell brightness map is obtained and used for calculating the subsequent quality inspection qualification rate.
And S004, obtaining a quality detection result of the motor front end shell based on the significance detection result of the motor front end shell and the defect significance coefficient of the motor front end shell subregion.
And adopting a Robust Principal Component Analysis (RPCA) algorithm to detect the significance of the gray map of the motor front end shell based on the motor front end shell. The specific process is as follows: the size of the gray scale of the motor front end shell is recorded asTaking the gray value of each pixel point on the gray map of the front end shell of the motor as one element in the matrix based on +.>The gray value gives a magnitude of +.>The gray value matrix is used as the input of a Robust Principal Component Analysis (RPCA) algorithm to obtain the gray valueSparse matrix E corresponding to the value matrix, and penalty parameters in algorithm take experience values +.>Acquiring a significant value of each pixel point in a gray level diagram of a front end shell of a motor based on a sparse matrix E, wherein the significant value h of an a pixel point is a significant value h of a pixel point a a The calculation formula of (2) is as follows:
in the formula, h a Is the salient value of the a pixel point, X (a) is the column vector of the pixel point a corresponding to the element in the sparse matrix E,is the 1 st order norm of column vector X (a).
According to the steps, the salient value of each pixel point is obtained, and an image formed by the salient values of all the pixel points according to the position sequence in the gray level image of the motor front end shell is used as an initial salient image of the motor front end shell. And secondly, determining an optimized salient value of each pixel point according to the salient value of each pixel point in the initial salient map and the defect salient coefficient of each motor front end shell sub-region, specifically, taking the defect salient coefficient of each motor front end shell sub-region on the front end shell brightness map as an optimized coefficient of any pixel point in each motor front end shell sub-region, for example, the defect salient coefficient w (i) of the ith motor front end shell sub-region is an optimized coefficient of each pixel point in the ith motor front end shell sub-region. Calculating an optimized saliency value H of the a pixel point a :
Wherein H is a Is the optimized saliency value of the a-th pixel point, round () is a rounding function, norm () is a normalization function, w a Is the defect significant coefficient of the motor front end shell subregion where the a pixel point is positioned, h a Is the salient value of the a pixel point, h max Is the maximum of the saliency values of all pixels in the initial saliency map.
According to the steps, the optimized significant value of each pixel point is calculated respectively, and the quality detection result of the front end shell of the motor is obtained based on the optimized significant value, and the implementation flow of the quality detection of the front end shell of the motor is shown in fig. 3. Secondly, obtaining a segmentation threshold value of the optimized significant value of all the pixel points by using an Ojin threshold segmentation algorithm, and taking the pixel points with the optimized significant value larger than the segmentation threshold value as the pixel points in the motor front end shell defect area; and taking the pixel points with the optimized significant value smaller than the segmentation threshold value as the pixel points in the normal area of the motor front end shell. And counting all pixel points belonging to a normal area of the motor front end shell in the initial saliency map, and taking the ratio of the number of the pixel points in the normal area of the motor front end shell in the initial saliency map to the number of the pixel points in the initial saliency map as the quality inspection qualification rate of the motor front end shell.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. The foregoing description of the preferred embodiments of the present invention is not intended to be limiting, but rather, any modifications, equivalents, improvements, etc. that fall within the principles of the present invention are intended to be included within the scope of the present invention.
Claims (7)
1. The motor shell quality detection method based on machine vision is characterized by comprising the following steps of:
acquiring a gray level diagram of a motor front end shell and a brightness diagram of the motor front end shell;
obtaining motor front end shell subareas on the motor front end shell brightness map based on the motor front end shell brightness map by adopting a map segmentation algorithm, and obtaining the glossiness abnormal degree of each motor front end shell subarea according to the glossiness characteristics between the motor front end shell subareas on the front end shell brightness map;
obtaining a structural difference value of each motor front end shell subarea according to a connected domain analysis result of the motor front end shell subarea in the front end shell brightness map;
determining defect significant coefficients of the front end shell subareas of each motor based on the glossiness anomaly degree and the structure difference value of the front end shell subareas of each motor; obtaining a quality detection result of the motor front end shell based on a significance detection result of the motor front end shell and a defect significance coefficient of a motor front end shell subregion;
the method for obtaining the structural difference value of each motor front end shell subarea according to the analysis result of the connected domain of the motor front end shell subarea in the front end shell brightness map comprises the following steps:
determining a structural edge change coefficient of each motor front end housing subarea based on the change degree of the gradient direction angle of the edge point on the brightness edge in each motor front end housing subarea;
obtaining the square of the difference between the structural edge change coefficient of each motor front end shell sub-region and the structural edge change coefficient of any one of the rest motor front end shell sub-regions; taking the average value of the accumulated results of the squares of the differences on all the other motor front end shell subareas as the structure difference value of each motor front end shell subarea;
the method for determining the structural edge change coefficient of each motor front end housing subarea based on the change degree of the gradient direction angle of the edge point on the brightness edge in each motor front end housing subarea comprises the following steps:
marking the edge line of any one of the communicating areas in the front end shell subareas of each motor as a brightness edge;
forming a first-order differential sequence of a sequence according to the gradient direction angles of all pixel points on each brightness edge in an ascending order as an edge angle sequence of each brightness edge;
respectively counting the occurrence probability of each gradient direction angle on each brightness edge, and taking a sequence formed by all the probabilities as an edge distribution sequence of each brightness edge;
taking the product of the standard deviation of all elements in the edge distribution sequence of each brightness edge and the standard deviation of all elements in the edge angle sequence as a first accumulation factor;
taking the average value of the accumulation results of the first accumulation factors on all brightness edges in each motor front end shell subarea as the structural edge change coefficient of each motor front end shell subarea;
the method for obtaining the quality detection result of the motor front end shell based on the significance detection result of the motor front end shell and the defect significance coefficient of the motor front end shell subregion comprises the following steps:
inputting a gray level image of a front end shell of the motor as an algorithm, and obtaining an initial saliency image of the front end shell of the motor by adopting a saliency detection algorithm;
determining an optimized salient value of each pixel point according to the salient value of each pixel point in the initial salient map and the defect salient coefficient of each motor front end shell sub-area;
and obtaining a quality detection result of the motor front end shell according to a comparison result of the optimized salient value of each pixel point in the initial salient map and a threshold value.
2. The machine vision based motor housing quality detection method according to claim 1, wherein the method for obtaining the gloss anomaly of each motor front end housing subarea according to the gloss characteristics between the motor front end housing subareas on the front end housing brightness map comprises the steps of:
acquiring the gloss contrast of each motor front end shell subarea based on the distribution characteristics of the pixel point brightness values in each motor front end shell subarea on the front end shell brightness map;
acquiring a flattening difference coefficient of each motor front end shell subarea based on the value difference of the brightness values of the pixel points in each motor front end shell subarea on the front end shell brightness map;
the glossiness of each motor front end shell subarea consists of a glossiness contrast ratio and a flattening difference coefficient, wherein the glossiness is in direct proportion to the glossiness contrast ratio and the flattening difference coefficient.
3. The machine vision based motor housing quality detection method according to claim 2, wherein the method for obtaining the gloss contrast of each motor front end housing subarea based on the distribution characteristics of the pixel point brightness values in each motor front end housing subarea on the front end housing brightness map is as follows:
taking a histogram constructed by taking each brightness level in each front-end shell subarea as a group and taking the probability of each brightness level occurring in each front-end shell subarea as a value of a corresponding group as a brightness distribution histogram of each front-end shell subarea;
obtaining a measurement distance between the brightness distribution histograms of the front end shell subregions of all the motors and the brightness distribution histograms of the other arbitrary front end shell subregions of the motors; and taking the average value of the accumulated results of the measurement distances on all the other motor front end shell subareas as the gloss contrast of each motor front end shell subarea.
4. The machine vision-based motor housing quality detection method according to claim 2, wherein the method for obtaining the flatness difference coefficient of each motor front end housing subarea based on the value difference of the pixel point brightness value in each motor front end housing subarea on the front end housing brightness map is as follows:
taking the product of the standard deviation of all brightness values in each motor front end shell subarea and the number of brightness levels in each motor front end shell subarea as a first product factor;
taking the difference value of the first product factor corresponding to each motor front end housing subarea and the first product factor corresponding to any one of the rest motor front end housing subareas as a first difference value; and taking the average value of the accumulated results of the squares of the first difference values on all the other motor front end shell subareas as the flattening difference coefficient of each motor front end shell subarea.
5. The machine vision-based motor housing quality detection method according to claim 1, wherein the method for determining the defect significance factor of each motor front end housing subregion based on the gloss anomaly and the structure difference value of each motor front end housing subregion is as follows:
taking the sum of the glossiness abnormal degree of each motor front end shell subarea and a first preset parameter as a first composition factor;
taking the sum of the structural difference value of each motor front end housing subarea and a second preset parameter as a second composition factor; taking the product of the first composition factor and the second composition factor as the defect significant coefficient of each motor front end shell subarea.
6. The machine vision based motor housing quality detection method according to claim 1, wherein the method for determining the optimized saliency value of each pixel point according to the saliency value of each pixel point in the initial saliency map and the defect saliency coefficient of each motor front end housing sub-area is as follows:
taking the defect significant coefficient of each motor front end shell subarea on the front end shell brightness map as the optimization coefficient of any pixel point in the motor front end shell subarea;
taking the product of the significant value of each pixel point in the initial significant map and the optimizing coefficient of the pixel point at the same position on the front end shell brightness map as the input of the normalization function, taking the product of the output of the normalization function and the maximum value of the significant value in the initial significant map as the input of the rounding function, and taking the output of the rounding function as the optimizing significant value of each pixel point.
7. The machine vision based motor housing quality detection method according to claim 1, wherein the method for obtaining the motor front end housing quality detection result according to the comparison result of the optimized saliency value of each pixel point in the initial saliency map and the threshold value is as follows:
obtaining a segmentation threshold value of the optimized significant values of all the pixel points by using a threshold segmentation algorithm, and taking the pixel points with the optimized significant values larger than the segmentation threshold value as the pixel points in the defect area of the motor front end shell; taking the pixel point with the optimized significant value smaller than the segmentation threshold value as the pixel point in the normal area of the motor front end shell;
and taking the ratio of the number of the pixels in the normal area of the front end shell of the motor in the initial saliency map to the number of the pixels in the initial saliency map as the quality inspection qualification rate of the front end shell of the motor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311422636.0A CN117152151B (en) | 2023-10-31 | 2023-10-31 | Motor shell quality detection method based on machine vision |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311422636.0A CN117152151B (en) | 2023-10-31 | 2023-10-31 | Motor shell quality detection method based on machine vision |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117152151A CN117152151A (en) | 2023-12-01 |
CN117152151B true CN117152151B (en) | 2024-02-02 |
Family
ID=88901118
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311422636.0A Active CN117152151B (en) | 2023-10-31 | 2023-10-31 | Motor shell quality detection method based on machine vision |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117152151B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114842213A (en) * | 2022-05-16 | 2022-08-02 | 北斗星通智联科技有限责任公司 | Obstacle contour detection method and device, terminal equipment and storage medium |
CN115018844A (en) * | 2022-08-09 | 2022-09-06 | 南通三信塑胶装备科技股份有限公司 | Plastic film quality evaluation method based on artificial intelligence |
CN115345821A (en) * | 2022-05-16 | 2022-11-15 | 西南石油大学 | Steel coil binding belt loosening abnormity detection and quantification method based on active visual imaging |
CN115641329A (en) * | 2022-11-15 | 2023-01-24 | 武汉惠强新能源材料科技有限公司 | Lithium battery diaphragm defect detection method and system |
CN116721106A (en) * | 2023-08-11 | 2023-09-08 | 山东明达圣昌铝业集团有限公司 | Profile flaw visual detection method based on image processing |
CN116758083A (en) * | 2023-08-21 | 2023-09-15 | 浙江莫克智造有限公司 | Quick detection method for metal wash basin defects based on computer vision |
-
2023
- 2023-10-31 CN CN202311422636.0A patent/CN117152151B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114842213A (en) * | 2022-05-16 | 2022-08-02 | 北斗星通智联科技有限责任公司 | Obstacle contour detection method and device, terminal equipment and storage medium |
CN115345821A (en) * | 2022-05-16 | 2022-11-15 | 西南石油大学 | Steel coil binding belt loosening abnormity detection and quantification method based on active visual imaging |
CN115018844A (en) * | 2022-08-09 | 2022-09-06 | 南通三信塑胶装备科技股份有限公司 | Plastic film quality evaluation method based on artificial intelligence |
CN115641329A (en) * | 2022-11-15 | 2023-01-24 | 武汉惠强新能源材料科技有限公司 | Lithium battery diaphragm defect detection method and system |
CN116721106A (en) * | 2023-08-11 | 2023-09-08 | 山东明达圣昌铝业集团有限公司 | Profile flaw visual detection method based on image processing |
CN116758083A (en) * | 2023-08-21 | 2023-09-15 | 浙江莫克智造有限公司 | Quick detection method for metal wash basin defects based on computer vision |
Also Published As
Publication number | Publication date |
---|---|
CN117152151A (en) | 2023-12-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN116721106B (en) | Profile flaw visual detection method based on image processing | |
CN111383209B (en) | Unsupervised flaw detection method based on full convolution self-encoder network | |
CN107490582B (en) | Assembly line workpiece detection system | |
CN115063430B (en) | Electric pipeline crack detection method based on image processing | |
CN115345885A (en) | Method for detecting appearance quality of metal fitness equipment | |
CN113658131B (en) | Machine vision-based tour ring spinning broken yarn detection method | |
CN113628189B (en) | Rapid strip steel scratch defect detection method based on image recognition | |
CN114972326A (en) | Defective product identification method for heat-shrinkable tube expanding process | |
CN116030060B (en) | Plastic particle quality detection method | |
CN115684176B (en) | Online visual detection system for film surface defects | |
CN117274113B (en) | Broken silicon wafer cleaning effect visual detection method based on image enhancement | |
CN115063407B (en) | Scratch and crack identification method for annular copper gasket | |
CN115063423A (en) | Mechanical casting cold and hot crack self-adaptive identification method based on computer vision | |
CN114972892B (en) | Automobile brake pad defect classification method based on computer vision | |
CN116883408B (en) | Integrating instrument shell defect detection method based on artificial intelligence | |
CN116758075A (en) | Artificial intelligence-based blower motor operation fault detection method | |
CN115272335A (en) | Metallurgical metal surface defect detection method based on significance detection | |
CN113298776A (en) | Method for detecting appearance defects of metal closed water pump impeller | |
CN115965623A (en) | Surface flaw detection method and system in transformer production | |
CN117764989A (en) | Visual-aided display screen defect detection method | |
CN117152129A (en) | Visual detection method and system for surface defects of battery cover plate | |
CN115272350A (en) | Method for detecting production quality of computer PCB mainboard | |
CN111833371A (en) | Image edge detection method based on pq-mean sparse measurement | |
CN118470015A (en) | Visual detection method and system for production quality of titanium alloy rod | |
CN118196081A (en) | Autoclave mold surface defect detection method |
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 |