CN113962994B - Method for detecting cleanliness of lock pin on three-connecting-rod based on image processing - Google Patents

Method for detecting cleanliness of lock pin on three-connecting-rod based on image processing Download PDF

Info

Publication number
CN113962994B
CN113962994B CN202111571681.3A CN202111571681A CN113962994B CN 113962994 B CN113962994 B CN 113962994B CN 202111571681 A CN202111571681 A CN 202111571681A CN 113962994 B CN113962994 B CN 113962994B
Authority
CN
China
Prior art keywords
image
connected domain
corrosion
pixel point
color
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111571681.3A
Other languages
Chinese (zh)
Other versions
CN113962994A (en
Inventor
张能
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Intelligent Xingyun Railway Fittings Co ltd
Original Assignee
Wuhan Intelligent Xingyun Railway Fittings 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 Wuhan Intelligent Xingyun Railway Fittings Co ltd filed Critical Wuhan Intelligent Xingyun Railway Fittings Co ltd
Priority to CN202111571681.3A priority Critical patent/CN113962994B/en
Publication of CN113962994A publication Critical patent/CN113962994A/en
Application granted granted Critical
Publication of CN113962994B publication Critical patent/CN113962994B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
  • Image Processing (AREA)

Abstract

The invention relates to the technical field of cleanliness detection, in particular to a method for detecting the cleanliness of a lock pin on a three-connecting-rod based on image processing. The method comprises the following steps: acquiring an RGB image of a target casting; classifying colors in the RGB image according to the H channel value of each pixel point to obtain a plurality of color categories; processing each target color category to obtain a rust image of each target color category; acquiring the maximum color difference value of each pixel point in each connected domain in each corrosion image, and acquiring the corrosion degree of each connected domain in each corrosion image corresponding to each connected domain according to the maximum color difference value of each pixel point in each connected domain in each corrosion image; obtaining the corrosion degree corresponding to each corrosion image according to the corrosion degree of the connected domain corresponding to each connected domain in each corrosion image; and obtaining the cleaning degree index of the target casting according to the variance between the corrosion degree of each corrosion image and the target color category of each corrosion image. The invention improves the detection efficiency of the cleanness degree of the casting.

Description

Method for detecting cleanliness of lock pin on three-connecting-rod based on image processing
Technical Field
The invention relates to the technical field of cleanliness detection, in particular to a method for detecting the cleanliness of a lock pin on a three-connecting-rod based on image processing.
Background
Before maintenance and detection are carried out on the three-connecting-rod upper lock pin assembly, the three-connecting-rod upper lock pin assembly needs to be disassembled firstly, and then shot blasting and rust removal are carried out on all castings obtained after disassembly, so that the detection capability of the castings on abnormal conditions such as sand holes, deformation and the like is improved, and the repair quality is improved. The cleaning grade after rust removal needs to meet the requirements, otherwise, the detection result of the casting is influenced. The existing method for detecting the cleanliness of the castings subjected to shot blasting rust removal is usually carried out manually, and the manual detection mode is not only easy to cause judgment errors due to subjective reasons and influence the detection of subsequent sand holes and cracks; moreover, human eyes are needed to observe manually, so that the speed is slow, and the detection efficiency is reduced.
Disclosure of Invention
In order to solve the problem that the detection efficiency of the prior art for the cleanliness of castings subjected to shot blasting rust removal is low, the invention aims to provide a method for detecting the cleanliness of a lock pin on a three-connecting-rod based on image processing, and the adopted technical scheme is as follows:
the invention provides a method for detecting the cleanliness of a lock pin on a three-connecting rod based on image processing, which comprises the following steps of:
acquiring RGB images corresponding to a target casting in a lock pin on the three-connecting rod;
classifying colors in the RGB image according to the H channel value corresponding to each pixel point in the RGB image to obtain a plurality of color categories; processing each target color category to obtain a rust image corresponding to each target color category, wherein the target color category is other color categories except the color category with the largest proportion in the color category set;
acquiring the maximum color difference value corresponding to each pixel point in each connected domain in each corrosion image, and acquiring the corrosion degree of each connected domain in each corrosion image according to the maximum color difference value corresponding to each pixel point in each connected domain in each corrosion image;
obtaining the corrosion degree corresponding to each corrosion image according to the corrosion degree of the connected domain corresponding to each connected domain in each corrosion image;
and obtaining a cleaning degree index of the target casting according to the variance between the corrosion degree corresponding to each corrosion image and the target color category corresponding to each corrosion image.
Preferably, the obtaining the maximum color difference value corresponding to each pixel point in each connected domain in each rust image, and obtaining the connected domain rust degree corresponding to each connected domain in each rust image according to the maximum color difference value corresponding to each pixel point in each connected domain in each rust image, includes:
acquiring the maximum color difference value in a neighborhood window of each pixel point 8 in each connected domain in each corrosion image;
obtaining the nearest distance value between each pixel point in each connected domain and the edge of the connected domain in which the pixel point is located in each rust image;
and obtaining the corrosion degree of the connected domain corresponding to each connected domain in each corrosion image according to the maximum color difference value corresponding to each pixel point in each connected domain in each corrosion image and the closest distance value corresponding to each pixel point.
Preferably, the obtaining the corrosion degree of the connected domain corresponding to each connected domain in each corrosion image according to the maximum color difference value corresponding to each pixel point in each connected domain in each corrosion image and the closest distance value corresponding to each pixel point includes:
for any connected domain in any tarnish image:
taking each pixel point in the connected domain as a center, and taking the nearest distance value corresponding to each pixel point as a radius to fit a corresponding circle;
acquiring intersection points of the circle corresponding to each pixel point and the edge of the connected domain where the corresponding pixel point is located, and recording as nearest edge intersection points;
constructing a corresponding straight line according to each pixel point and the corresponding nearest edge intersection point, and marking as a nearest edge straight line;
acquiring the length of a line segment between the intersection point of the nearest edge straight line corresponding to each pixel point and the other edge of the connected domain and the corresponding nearest edge intersection point, and recording the length as the nearest edge straight line length;
and obtaining the corrosion degree of the connected domain corresponding to the connected domain according to the maximum color difference value, the nearest edge straight line length and the nearest distance value corresponding to each pixel point in the connected domain.
Preferably, the calculation formula of the corrosion degree of the connected domain is as follows:
Figure 100002_DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure 100002_DEST_PATH_IMAGE004
is the connected domain corrosion degree of the jth connected domain in the ith corrosion image,
Figure 100002_DEST_PATH_IMAGE006
is the maximum color difference value of the kth pixel point in the jth communication domain in the ith corrosion image,
Figure 100002_DEST_PATH_IMAGE008
is the shortest distance value corresponding to the kth pixel point in the jth connected domain in the ith corrosion image,
Figure 100002_DEST_PATH_IMAGE010
the length of a nearest edge straight line corresponding to a kth pixel point in a jth connected domain in the ith corrosion image is obtained, and J is the number of the pixel points in the jth connected domain.
Preferably, obtaining the corresponding rust degree of the rust image comprises:
taking each connected domain in the corrosion image as a node, and constructing a complete undirected graph corresponding to the corrosion image;
obtaining the weight of each side in the completely undirected graph according to the corrosion degree of the connected domain corresponding to any connected domain in the corrosion image, the area difference of each connected domain and the distance between each connected domain and each connected domain;
constructing a corresponding minimum spanning tree according to a complete undirected graph corresponding to the corrosion image;
and calculating the sum of the weights of all edges in the minimum spanning tree, and normalizing the sum to obtain the corrosion degree corresponding to the corrosion image.
Preferably, the calculation formula of the edge weight in the undirected graph is as follows:
Figure 100002_DEST_PATH_IMAGE012
wherein the content of the first and second substances,
Figure 100002_DEST_PATH_IMAGE014
is the weight of the edge between the a-th connected domain and the b-th connected domain in the ith rust image,
Figure 100002_DEST_PATH_IMAGE016
is the distance value between the a-th connected domain and the b-th connected domain in the ith rust image,
Figure 100002_DEST_PATH_IMAGE018
is the area difference between the a-th connected domain and the b-th connected domain in the ith rust image,
Figure 100002_DEST_PATH_IMAGE020
is the corrosion degree of the connected domain corresponding to the a-th connected domain in the ith corrosion image,
Figure 100002_DEST_PATH_IMAGE022
is the corrosion degree of the connected domain corresponding to the b-th connected domain in the ith corrosion image,
Figure 100002_DEST_PATH_IMAGE024
is the maximum value.
Preferably, the calculation formula of the cleanliness index of the target casting is as follows:
Figure 100002_DEST_PATH_IMAGE026
wherein the content of the first and second substances,
Figure 100002_DEST_PATH_IMAGE028
is the index of the cleanliness of the target casting, K is the number of color categories,
Figure 100002_DEST_PATH_IMAGE030
the degree of corrosion corresponding to the k-th corrosion image,
Figure 100002_DEST_PATH_IMAGE032
for the H channel component proportion corresponding to the kth color class,
Figure 100002_DEST_PATH_IMAGE034
is the variance value of the ratio of different colors in the k-th target color category after normalization.
Preferably, the colors in the RGB image are classified according to the H channel value corresponding to each pixel point in the RGB image, so as to obtain a plurality of color categories; processing each target color category to obtain a rust image corresponding to each target color category, wherein the rust image comprises:
converting the RGB image into an HSV color space to obtain an HSV image;
classifying the H channel value of each pixel point in the HSV image according to a clustering algorithm to obtain a plurality of color categories in the HSV image;
performing color threshold segmentation on target color categories in the HSV image to obtain color distribution images corresponding to the target color categories;
and performing dot multiplication operation on each color distribution image and the RGB image to obtain a rust image corresponding to each color distribution image.
The invention has the following beneficial effects:
the method comprises the steps of classifying H channel values corresponding to all pixel points in RGB images corresponding to a target casting, analyzing all connected domains in rust images corresponding to all color classes, obtaining the rust degree of the connected domains corresponding to all the connected domains in all the rust images by utilizing the maximum color difference value corresponding to all the pixel points in all the connected domains in the rust images, obtaining the rust degree of the corresponding rust images according to the rust degree of the connected domains corresponding to all the connected domains in all the rust images, and finally obtaining the cleanliness index of the target casting according to the variance between the rust degree corresponding to all the rust images and the color classes corresponding to all the rust images. According to the invention, the cleaning degree indexes of all castings after shot blasting and rust removal of all castings of the lock pins on the three-connecting rod are calculated by utilizing an image processing technology, so that the automatic judgment on the cleaning effect is realized, and the detection efficiency of the cleaning degree of the castings after shot blasting and rust removal is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions and advantages of the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart of a method for detecting cleanliness of a lock pin on a three-link based on image processing according to the present invention;
FIG. 2 is a schematic view of a nearest edge line provided by the present invention.
Detailed Description
To further illustrate the technical means and functional effects of the present invention adopted to achieve the predetermined object, the following detailed description will be made on a method for detecting the cleanliness of a lock pin on a three-link based on image processing according to the present invention with reference to the accompanying drawings and preferred embodiments.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The following describes a specific scheme of the method for detecting the cleanliness of the lock pin on the three-link based on image processing in detail with reference to the accompanying drawings.
The embodiment of the method for detecting the cleanliness of the locking pin on the three-connecting-rod based on image processing comprises the following steps:
as shown in fig. 1, the method for detecting cleanliness of a lock pin on a three-link based on image processing of the present embodiment includes the following steps:
and step S1, acquiring an RGB image corresponding to the target casting in the lock pin on the three-link.
The three-link upper locking pin assembly comprises an upper lock handle, an upper locking pin and an upper locking pin rod, wherein the three castings are respectively connected through two rivets and can rotate mutually within a certain range. Before maintenance and detection, the three-connecting-rod upper lock pin assembly needs to be disassembled firstly, then each casting obtained after the disassembly is subjected to shot blasting rust removal, in order to analyze the cleanliness degree of each casting after shot blasting rust removal in the three-connecting-rod upper lock pin assembly (referred to as three-connecting-rod upper lock pin for short), the embodiment firstly collects the images of each casting after shot blasting rust removal, and each collected image only comprises one casting, and specifically comprises the following steps: in the embodiment, images of all castings of the lock pin on the three-connecting rod are collected through the RGB camera, wherein the image collection visual angle is set according to actual requirements; because the images of all castings in the three-connecting-rod upper lock pin assembly subjected to shot blasting and rust removal have a lot of noises, the embodiment adopts the graph cut graph cutting algorithm to process the acquired images to obtain the images only containing the castings. In the embodiment, the RGB image corresponding to a casting in the lock pin on the three-link is taken as an example for analysis, and the casting to be analyzed is marked as a target casting.
Step S2, classifying the colors in the RGB image according to the H channel value corresponding to each pixel point in the RGB image to obtain a plurality of color categories; and processing each target color category to obtain a rust image corresponding to each target color category, wherein the target color category is the other color category except the color category with the largest proportion in the color category set.
After the shot blasting rust removal is performed on the target casting, most rust on the target casting is removed, but considering that some rust areas which are not cleaned up may still exist on the target casting, so that some areas in the acquired RGB image corresponding to the target casting have rust, the embodiment analyzes the areas in the RGB image corresponding to the target casting, which have rust, so as to obtain the cleaning degree of the target casting.
Because the color with corrosion is different from the color without corrosion, the embodiment obtains the area image with corrosion still existing in the RGB image corresponding to the target casting by the color feature of corrosion in the RGB image, specifically:
firstly, converting an RGB image corresponding to a target casting into an HSV color space, recording the converted image as an HSV image, then obtaining a corresponding H channel histogram, and obtaining color components with values in the H channel (namely color components not being 0 in the histogram); in the embodiment, the H channel values of the pixel points in the HSV images are classified by using a DBSCAN clustering algorithm, that is, the pixels with similar colors are grouped into one type, so that a plurality of different color categories are obtained, each category is a set of pixel points with similar colors in the HSV images, and the color values in the RGB images corresponding to the target casting are classified into one type because the H channel has color gradual change. The DBSCAN clustering algorithm will automatically number the clustering result, and this embodiment uses the numbers of all the categories as the classification numbers of each color category.
In the embodiment, when the cleaning degree of the target casting is calculated, the color class with the largest proportion is not analyzed, because the obtained RGB image corresponding to the target casting is subjected to shot blasting and rust removal, most of rust is removed, and therefore the overall color is approximately the same, the color class with the largest proportion in the color classes corresponding to the target casting is the color of the target casting. The present embodiment marks the color class with the largest non-occupation ratio as the target color class.
Then, according to the classification number of each target color class, the color threshold segmentation is performed on the HSV image to obtain a color distribution image corresponding to each target color class, where the color distribution image is a binary image, and a color distribution map corresponding to a certain target color class has a plurality of connected domains belonging to the target color class. In the implementation, each color distribution image is used as a mask, and the mask and the RGB image corresponding to the target casting are subjected to dot product operation to obtain the rust image corresponding to each color distribution image, that is, the rust image corresponding to each target color category, wherein the rust image is an RGB image and has a plurality of color blocks.
In this embodiment, each connected domain in each color distribution image is obtained through a bwleabel function in matlab, and since the color distribution image corresponds to each pixel point in the corresponding corrosion image one by one, the position of each connected domain in the color distribution image corresponds to the position of each color block in the corrosion image corresponding to the color distribution image, and the connected domain in each color distribution image may also be referred to as a connected domain corresponding to each corrosion image. In this embodiment, when selecting a connected domain, 8 neighborhood connected domains are selected, which may be specifically adjusted according to actual needs. When the bwleabel function acquires the connected domain, a number is automatically created for each connected domain.
In this embodiment, the RGB image corresponding to the target casting corresponds to a plurality of target color categories, that is, the target casting corresponds to a plurality of target color categories, each target color category corresponds to one color distribution image and one corrosion image, and one color distribution image has a plurality of connected domains, that is, the corresponding corrosion image corresponds to a plurality of connected domains.
Step S3, obtaining the maximum color difference value corresponding to each pixel point in each connected domain in each corrosion image, and obtaining the connected domain corrosion degree corresponding to each connected domain in each corrosion image according to the maximum color difference value corresponding to each pixel point in each connected domain in each corrosion image.
In this embodiment, each connected domain in the corrosion image is a plurality of regions with similar colors, and the sizes of the connected domains in the corrosion images are not consistent in consideration of different cleaning degrees of different regions and different shot blasting and rust removing effects. If a larger communication area still exists after shot blasting rust removal, the rust removal effect of the current casting is not good, or the rust removal effect of the current casting is poor and the cleaning degree does not reach the standard under the condition that a plurality of small communication areas exist but are distributed densely after shot blasting rust removal.
In order to analyze the cleaning condition of each corrosion image, the embodiment first obtains and analyzes the corrosion condition of each communication domain corresponding to each corrosion image; in this embodiment, the calculation of the corrosion degree of a connected domain in any corrosion image is taken as an example to perform analysis, and specifically, the analysis includes:
firstly, coordinates of all pixel points in a connected domain are obtained, an 8-neighborhood window is established by taking the coordinates of all the pixel points as anchor points, and the maximum color difference value in the window, namely the maximum color difference value of the corresponding pixel point in the connected domain, is calculated. The formula for calculating the maximum color difference value in this embodiment is:
Figure DEST_PATH_IMAGE036
wherein the content of the first and second substances,
Figure 853375DEST_PATH_IMAGE006
is the maximum color difference value in the 8 th pixel point neighborhood window in the jth connected domain in the ith corrosion image,
Figure DEST_PATH_IMAGE038
is the neighborhood of the kth pixel point in the window of the jth connected domain in the ith corrosion imageThe RGB integrated value corresponding to each pixel point,
Figure DEST_PATH_IMAGE040
is the maximum value of the RGB integrated value of the neighborhood pixel point in the window of the kth pixel point,
Figure DEST_PATH_IMAGE042
and the value is the minimum value of the RGB comprehensive value of the neighborhood pixel point in the window of the kth pixel point.
In this example
Figure 225975DEST_PATH_IMAGE006
The larger the value of the numerical control steel wire rope is, the better the current shot blasting rust removal effect is, because if the rust removal effect of the casting formed by the lock pins on the three connecting rods is better, the color values of the casting are more uniform.
Considering that the pixel points close to the inside of the connected domain are often areas with serious corrosion, the more serious corrosion indicates that the cleanness is worse, so the more inner pixel points can represent the cleanness degree of the color block represented by the current connected domain, namely the maximum color difference value weight of the corresponding pixel points is higher.
As shown in fig. 2, the ellipse in the figure is a certain connected domain in the corrosion image; in this embodiment, after obtaining the maximum color difference value of each pixel point in the connected domain, the closest distance value between each pixel point in the connected domain and the edge of the connected domain where the pixel point is located is calculated (as shown in fig. 2, the distance from point 1 to point 2). Then after the nearest distance value corresponding to each pixel point in the connected domain is obtained, a circle corresponding to the pixel point is fitted by using a ransac algorithm with the kth pixel point in the connected domain as a center (the kth pixel point is shown as a point 2 in fig. 2) with the nearest distance value corresponding to the pixel point as a radius, an intersection point of the circle and the edge of the connected domain where the circle is located is obtained and is marked as a nearest edge intersection point (shown as a point 1 in fig. 2), a straight line passing through the kth pixel point and the corresponding nearest edge intersection point (shown as a line segment formed by the point 1 and the point 4 in fig. 2) is further obtained, and the straight line in the connected domain is marked as a nearest edge straight line; along the nearest edge straight line, the intersection point of the kth pixel point and the other edge of the connected domain (as shown by the point 4 in fig. 2) can be obtained, and the length of a line segment formed by the two intersection points is obtained and is recorded as the nearest edge straight line length (i.e., the distance from the point 1 to the point 4 shown in fig. 2).
According to the implementation, the corrosion degree of the connected domain corresponding to the connected domain is obtained according to the nearest edge straight line length, the nearest distance value and the maximum color difference value corresponding to each pixel point in the connected domain, and the specific calculation formula is as follows:
Figure DEST_PATH_IMAGE002A
wherein the content of the first and second substances,
Figure 271291DEST_PATH_IMAGE004
is the connected domain corrosion degree of the jth connected domain in the ith corrosion image,
Figure 666500DEST_PATH_IMAGE008
is the nearest distance value corresponding to the kth pixel point in the jth connected domain in the ith corrosion image,
Figure 152976DEST_PATH_IMAGE010
is the nearest edge straight line length corresponding to the kth pixel point in the jth connected domain in the ith corrosion image, J is the number of the pixel points in the jth connected domain,
Figure DEST_PATH_IMAGE044
all pixel points of the current jth connected domain are calculated, the larger the area of the jth connected domain is, namely the more the number of the pixel points is, the lower the cleanliness of the color block represented by the jth connected domain is.
Figure DEST_PATH_IMAGE046
Which represents half of the length of the nearest edge straight line corresponding to the kth pixel point, i.e. the distance from point 3 to point 4 as shown in fig. 2,
Figure DEST_PATH_IMAGE048
to representThe greater the distance between the kth pixel point and the nearest edge straight line center point, the closer the kth pixel point is to the edge of the connected domain where the kth pixel point is located, that is, the smaller the nearest distance value is, so that the pixel point corresponds to
Figure 241018DEST_PATH_IMAGE006
The lower the weight of (c). This embodiment implements negative correlation mapping using exp (-x) in order to prevent the weight from being 0, i.e., it is possible to prevent the weight from being 0
Figure DEST_PATH_IMAGE050
The larger, the
Figure 163844DEST_PATH_IMAGE006
The higher the weight of (c).
Figure 362744DEST_PATH_IMAGE006
The larger the value of the maximum color difference value corresponding to the kth pixel point of the jth connected domain in the ith corrosion image with different degrees is, the lower the corrosion degree of the connected domain corresponding to the connected domain is, namely, the better the cleanliness of the area corresponding to the connected domain is; the smaller the value, the higher the corrosion degree of the connected domain corresponding to the connected domain, i.e. the poorer the cleanliness of the region corresponding to the connected domain.
In this embodiment, the connected domain corrosion degree corresponding to each connected domain in the corrosion image is obtained according to the above method.
And step S4, obtaining the corrosion degree corresponding to each corrosion image according to the corrosion degree of the connected domain corresponding to each connected domain in each corrosion image.
In the embodiment, after the connected domain corrosion degree corresponding to each connected domain in the corrosion image is obtained, each connected domain in the corrosion image is taken as a node to establish a complete undirected graph.
In this embodiment, the weight value of the edge between two nodes in the completely undirected graph corresponding to the rusted image represents a cleaning condition when two corresponding connected domains are regarded as a whole, and in this embodiment, the minimum spanning tree corresponding to the rusted image is obtained according to the completely undirected graph corresponding to the rusted image, so as to obtain the rusted degree corresponding to the rusted image, where the process of calculating the weight value of the edge between two nodes is as follows:
according to the embodiment, firstly, through a connected domain processing function in matlab, the distance value and the area difference value between a certain connected domain and the rest connected domains in the corrosion image are obtained; then, according to the corrosion degree of the connected domain corresponding to a certain connected domain, and the distance and area difference between the connected domain and the rest of the connected domains, calculating the weight between the node corresponding to the certain connected domain and the nodes corresponding to other connected domains, wherein the calculation formula of the weight of any edge in the completely undirected graph is as follows:
Figure DEST_PATH_IMAGE012A
wherein the content of the first and second substances,
Figure 234885DEST_PATH_IMAGE014
is the weight of the edge between the a-th connected domain and the b-th connected domain in the ith rust image,
Figure 962669DEST_PATH_IMAGE016
is the distance value between the a-th connected domain and the b-th connected domain in the ith rust image,
Figure 716999DEST_PATH_IMAGE018
is the area difference value of the a-th connected domain and the b-th connected domain in the ith corrosion image,
Figure 250748DEST_PATH_IMAGE020
is the corrosion degree of the connected domain corresponding to the a-th connected domain in the ith corrosion image,
Figure 508554DEST_PATH_IMAGE022
rusting the connected domain corresponding to the b-th connected domain in the ith rusting imageTo the extent that,
Figure DEST_PATH_IMAGE052
is composed of
Figure 594191DEST_PATH_IMAGE020
And
Figure 835816DEST_PATH_IMAGE022
the maximum of the two.
According to the formula, if the distance value between the two connected domains is smaller, the closer the two connected domains are, the worse the cleaning degree is, and the larger the weight value of the corresponding edge is; if the distance value between the two connected domains is larger, the corresponding cleaning degree is better, and the weight value of the corresponding edge is smaller. If the area difference value of the two communicated areas is larger, the cleaning effect of cleaning shot blasting rust removal is poorer, and the weight of the edge between the two communicated areas is larger; if the smaller the difference between the areas of the two connected domains, the better the cleaning degree, the smaller the weight of the edge between the two connected domains. In this embodiment, when the weight of the edge between the two connected domains is calculated, the largest one of the corrosion degrees of the connected domains corresponding to the two connected domains is selected to participate in the calculation, and since the smaller the corrosion degree of the connected domain is, the better the cleanliness of the connected domain is, the largest value is selected as the corrosion degree of the connected domain between the two connected domains in order to ensure the detection quality.
In this embodiment, the rust image obtained by the above method corresponds to a completely undirected graph and the weights corresponding to the edges, and a corresponding minimum spanning tree is constructed; then calculating the sum of the weights of all edges in the minimum spanning tree corresponding to the corrosion image to obtain the corrosion degree corresponding to the corrosion image, wherein the corrosion degree reflects the cleaning effect of the area corresponding to the corrosion image, and the smaller the corrosion degree is, the better the corresponding cleaning effect is; if the degree of corrosion is greater, the corresponding cleaning effect is poorer. Because the connected domain corrosion degree selected in the process of calculating the weight is the maximum, the sum of the weights of the edges of the minimum spanning tree corresponding to the completely undirected graph is selected to reflect the corrosion degree of the corresponding corrosion image, and the corrosion degree of the corrosion image in the embodiment is a result of normalizing the sum of the weights of the edges of the corresponding minimum spanning tree.
The present embodiment obtains the degree of corrosion of a certain corrosion image according to steps S3 and S4, and since the corrosion image and the corresponding color class are in a one-to-one relationship, the degree of corrosion can also be recorded as the degree of corrosion of a certain color class. In the embodiment, the rust degrees of all the rust images corresponding to the RGB images corresponding to the target casting are calculated by using the same method, so that the index of the cleaning degree of the target casting is further calculated.
And step S5, obtaining a cleanliness index of the target casting according to the variance between the rust degree corresponding to each rust image and the target color category corresponding to each rust image.
Considering that the overall color of the casting is approximately uniform after shot blasting rust removal and only part of the rust is corroded, the embodiment does not consider the situation that the corrosion color accounts for more than the overall color of the casting after shot blasting rust removal. In the embodiment, the current corrosion degree, namely the cleaning degree, is judged according to the color of the HSV image corresponding to the target casting; however, the overall color of the HSV image corresponding to the shot-blasted and rust-removed target casting is approximately uniform, so that the embodiment selects the category with the largest ratio (which can be directly obtained from the H-channel histogram) from the color categories after DBSCAN clustering, and excludes the category with the largest ratio; the color category with the largest proportion is not analyzed in the embodiment, because for the color category with the largest proportion, the larger the area of the main color in the color category is, the smaller the color difference is, and the better the cleaning degree is; for each target color category (namely, the color category with rust), the lower the rust degree of the target color category is, the better the cleaning degree of the area corresponding to the current color category is; the lower the rust degree value of each target color category is, that is, the lower the corresponding rust degree value of the corresponding rust image is, the smaller the area of the corresponding color block (that is, the connected domain of the corresponding rust image) in the target color category is, the smaller the color difference is, and the more sparse the color difference is distributed among the color blocks.
In the embodiment, the degree of corrosion of each target color category is used for calculating and obtaining the index of the cleanliness of the target casting. In the embodiment, the entropy values of the color categories are calculated by using the corrosion degrees of the target color categories, so that the cleanliness index of the target casting is obtained, and the more uniform the surface color of the target casting is after shot blasting rust removal, the better the shot blasting rust removal effect is. The calculation formula of the cleanliness index of the target casting is as follows:
Figure DEST_PATH_IMAGE026A
wherein the content of the first and second substances,
Figure 314202DEST_PATH_IMAGE028
is the index of the cleanliness of the target casting, K is the number of color categories, K-1 is the number of target color categories,
Figure 957673DEST_PATH_IMAGE030
the rust degree corresponding to each k-th rust image, namely the rust degree of each target color category,
Figure 27260DEST_PATH_IMAGE032
is the proportion of the H channel component corresponding to the kth color class,
Figure 552920DEST_PATH_IMAGE034
the smaller the variance value of the ratio of different colors in the kth normalized target color class is, the more uniform the color values in each color class are, the better the cleaning effect is, and the smaller the value of jq is.
Wherein
Figure DEST_PATH_IMAGE054
The entropy of information among the target color categories indicates that the more concentrated the proportion of the target color categories is, the better the cleaning degree of shot blasting rust removal is, and the more dispersed the proportion of the target color categories is, the worse the cleaning degree of shot blasting rust removal is, and the more dispersed the proportion of the target color categories is, the rust with different degrees still exists; therefore, it is not only easy to use
Figure 287526DEST_PATH_IMAGE054
Value of (A)Smaller indicates more uniform target color classes and better cleaning.
Wherein
Figure DEST_PATH_IMAGE056
The larger the weight of the color class is, the worse the cleaning degree is, and the weight of the corresponding color class is correspondingly larger in order to highlight the occurrence of rust. Therefore, in the embodiment, the smaller the index of the cleaning degree of the target casting is, the better the cleaning effect is; the greater the index of cleanliness of the target casting, the poorer the cleaning effect.
After the cleanliness index of the target casting is obtained, the cleanliness threshold jqr can be set, wherein jqr is a hyper-parameter. When jq is less than jqr, determining that the cleaning degree of the current target casting reaches the standard and performing shot blasting and rust removing again; when jq > = jqr, the cleaning degree of the current target casting is not up to the standard, and therefore the shot blasting and rust removing treatment needs to be carried out on the target casting again. The threshold of the cleaning degree in the embodiment can be set according to actual needs.
In this embodiment, H channel values corresponding to each pixel point in an RGB image corresponding to a target casting are classified, then each connected domain in a corrosion image corresponding to each color category is analyzed, a maximum color difference value corresponding to each pixel point in each connected domain in the corrosion image is used to obtain a connected domain corrosion degree corresponding to each connected domain in each corrosion image, and then a corrosion degree corresponding to the corresponding corrosion image is obtained according to the connected domain corrosion degree corresponding to each connected domain in each corrosion image, and finally a cleanliness index of the target casting is obtained according to a variance between the corrosion degree corresponding to each corrosion image and the color category corresponding to each corrosion image. In the embodiment, the cleaning degree indexes of all castings after shot blasting and rust removal of all castings of the lock pins on the three-connecting rod are calculated by utilizing an image processing technology, so that the automatic judgment of the cleaning effect is realized, and the detection efficiency of the cleaning degree of the castings after shot blasting and rust removal is improved.
It should be noted that: the above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (7)

1. A method for detecting the cleanliness of a lock pin on a three-connecting-rod based on image processing is characterized by comprising the following steps:
acquiring RGB images corresponding to a target casting in a lock pin on the three-connecting rod;
classifying colors in the RGB image according to the H channel value corresponding to each pixel point in the RGB image to obtain a plurality of color categories; processing each target color category to obtain a rust image corresponding to each target color category, wherein the target color category is other color categories except the color category with the largest proportion in the color category set;
acquiring the maximum color difference value corresponding to each pixel point in each connected domain in each corrosion image, and acquiring the corrosion degree of each connected domain in each corrosion image according to the maximum color difference value corresponding to each pixel point in each connected domain in each corrosion image;
obtaining the corrosion degree corresponding to each corrosion image according to the corrosion degree of the connected domain corresponding to each connected domain in each corrosion image;
obtaining a cleaning degree index of the target casting according to the variance between the corrosion degree corresponding to each corrosion image and the target color category corresponding to each corrosion image;
classifying colors in the RGB image according to the H channel value corresponding to each pixel point in the RGB image to obtain a plurality of color categories; processing each target color category to obtain a rust image corresponding to each target color category, wherein the rust image comprises:
converting the RGB image into an HSV color space to obtain an HSV image;
classifying the H channel value of each pixel point in the HSV image according to a clustering algorithm to obtain a plurality of color categories in the HSV image;
performing color threshold segmentation on target color categories in the HSV image to obtain color distribution images corresponding to the target color categories;
and performing dot multiplication operation on each color distribution image and the RGB image to obtain a rust image corresponding to each color distribution image.
2. The method for detecting the cleanliness of the lock pin on the three-link based on the image processing as claimed in claim 1, wherein the obtaining of the maximum color difference value corresponding to each pixel point in each connected domain in each rust image and the obtaining of the rust degree of each connected domain in each rust image according to the maximum color difference value corresponding to each pixel point in each connected domain in each rust image comprises:
acquiring the maximum color difference value in a neighborhood window of each pixel point 8 in each connected domain in each corrosion image;
obtaining the nearest distance value between each pixel point in each connected domain and the edge of the connected domain in which the pixel point is located in each rust image;
and obtaining the corrosion degree of the connected domain corresponding to each connected domain in each corrosion image according to the maximum color difference value corresponding to each pixel point in each connected domain in each corrosion image and the closest distance value corresponding to each pixel point.
3. The method for detecting the cleanliness of the lock pin on the three-link based on the image processing as claimed in claim 2, wherein the obtaining of the rust degree of the connected domain corresponding to each connected domain in each rust image according to the maximum color difference value corresponding to each pixel point in each connected domain in each rust image and the closest distance value corresponding to each pixel point comprises:
for any connected domain in any tarnish image:
taking each pixel point in the connected domain as a center, and taking the nearest distance value corresponding to each pixel point as a radius to fit a corresponding circle;
acquiring intersection points of the circle corresponding to each pixel point and the edge of the connected domain where the corresponding pixel point is located, and recording as nearest edge intersection points;
constructing a corresponding straight line according to each pixel point and the corresponding nearest edge intersection point, and marking as a nearest edge straight line;
acquiring the length of a line segment between the intersection point of the nearest edge straight line corresponding to each pixel point and the other edge of the connected domain and the corresponding nearest edge intersection point, and recording the length as the nearest edge straight line length;
and obtaining the corrosion degree of the connected domain corresponding to the connected domain according to the maximum color difference value, the nearest edge straight line length and the nearest distance value corresponding to each pixel point in the connected domain.
4. The image processing-based method for detecting the cleanliness of the lock pin on the three-connecting-rod according to claim 3, wherein the calculation formula of the corrosion degree of the connected domain is as follows:
Figure DEST_PATH_IMAGE002
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE004
is the connected domain corrosion degree of the jth connected domain in the ith corrosion image,
Figure DEST_PATH_IMAGE006
is the maximum color difference value of the kth pixel point in the jth communication domain in the ith corrosion image,
Figure DEST_PATH_IMAGE008
is the shortest distance value corresponding to the kth pixel point in the jth connected domain in the ith corrosion image,
Figure DEST_PATH_IMAGE010
the length of a nearest edge straight line corresponding to a kth pixel point in a jth connected domain in the ith corrosion image is obtained, and J is the number of the pixel points in the jth connected domain.
5. The image processing-based method for detecting the cleanliness of the lock pin on the three-link according to claim 1, wherein obtaining the degree of corrosion corresponding to the corrosion image comprises:
taking each connected domain in the corrosion image as a node, and constructing a complete undirected graph corresponding to the corrosion image;
obtaining the weight of each side in the completely undirected graph according to the corrosion degree of the connected domain corresponding to any connected domain in the corrosion image, the area difference of each connected domain and the distance between each connected domain and each connected domain;
constructing a corresponding minimum spanning tree according to a complete undirected graph corresponding to the corrosion image;
and calculating the sum of the weights of all edges in the minimum spanning tree, and normalizing the sum to obtain the corrosion degree corresponding to the corrosion image.
6. The image processing-based method for detecting the cleanliness of the lock pin on the three-connecting-rod according to claim 5, wherein the calculation formula of the edge weight in the undirected graph is as follows:
Figure DEST_PATH_IMAGE012
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE014
is the weight of the edge between the a-th connected domain and the b-th connected domain in the ith rust image,
Figure DEST_PATH_IMAGE016
is the distance value between the a-th connected domain and the b-th connected domain in the ith rust image,
Figure DEST_PATH_IMAGE018
is the area difference between the a-th connected domain and the b-th connected domain in the ith rust image,
Figure DEST_PATH_IMAGE020
is the corrosion degree of the connected domain corresponding to the a-th connected domain in the ith corrosion image,
Figure DEST_PATH_IMAGE022
is the corrosion degree of the connected domain corresponding to the b-th connected domain in the ith corrosion image,
Figure DEST_PATH_IMAGE024
is the maximum value.
7. The image processing-based method for detecting the cleanliness of the lock pin on the three-link according to claim 1, wherein the target casting cleanliness index is calculated by the formula:
Figure DEST_PATH_IMAGE026
wherein the content of the first and second substances,
Figure DEST_PATH_IMAGE028
is the index of the cleanliness of the target casting, K is the number of color categories,
Figure DEST_PATH_IMAGE030
the degree of corrosion corresponding to the k-th corrosion image,
Figure DEST_PATH_IMAGE032
for the H channel component proportion corresponding to the kth color class,
Figure DEST_PATH_IMAGE034
is the variance value of the ratio of different colors in the k-th target color category after normalization.
CN202111571681.3A 2021-12-21 2021-12-21 Method for detecting cleanliness of lock pin on three-connecting-rod based on image processing Active CN113962994B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111571681.3A CN113962994B (en) 2021-12-21 2021-12-21 Method for detecting cleanliness of lock pin on three-connecting-rod based on image processing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111571681.3A CN113962994B (en) 2021-12-21 2021-12-21 Method for detecting cleanliness of lock pin on three-connecting-rod based on image processing

Publications (2)

Publication Number Publication Date
CN113962994A CN113962994A (en) 2022-01-21
CN113962994B true CN113962994B (en) 2022-03-15

Family

ID=79473486

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111571681.3A Active CN113962994B (en) 2021-12-21 2021-12-21 Method for detecting cleanliness of lock pin on three-connecting-rod based on image processing

Country Status (1)

Country Link
CN (1) CN113962994B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115049649B (en) * 2022-08-12 2022-11-11 山东振鹏建筑钢品科技有限公司 Reinforcing steel bar polishing and rust removing control method based on corrosion degree
CN115100196B (en) * 2022-08-24 2022-11-18 聊城市洛溪信息科技有限公司 Method for evaluating derusting effect of stamping part based on image segmentation

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110012628A1 (en) * 2009-07-14 2011-01-20 Mitsubishi Heavy Industries, Ltd. Corrosion detecting apparatus and outdoor structure
CN102183223A (en) * 2011-01-13 2011-09-14 新兴铸管股份有限公司 Method for determining metal corrosion area
US20130329012A1 (en) * 2012-06-07 2013-12-12 Liberty Reach Inc. 3-d imaging and processing system including at least one 3-d or depth sensor which is continually calibrated during use
CN103063167B (en) * 2012-12-28 2015-11-18 江苏大学 A kind of method of automatic decision laser cleaning effect
CN105844610B (en) * 2016-01-23 2018-08-21 重庆布委科技有限公司 Plant leaf blade rust staining automatic checkout system based on machine vision and method
CN110038859A (en) * 2019-05-24 2019-07-23 苏州贝亚敏光电科技有限公司 A kind of cleaning path automatic monitoring method of laser cleaning equipment
CN110334750B (en) * 2019-06-21 2021-06-08 西安工程大学 Power transmission line iron tower bolt corrosion degree image classification and identification method
CN111028197A (en) * 2019-11-01 2020-04-17 深圳先进技术研究院 Method and terminal for detecting metal corrosion
CN111383219B (en) * 2020-03-12 2020-12-01 众能联合数字技术有限公司 Method and system for intelligently detecting cleanliness of aerial work platform equipment
CN112643207B (en) * 2020-12-12 2022-09-30 南京理工大学 Laser automatic derusting system and method based on computer vision
CN112734720B (en) * 2021-01-08 2024-03-05 沈阳工业大学 Ship hull laser cleaning in-situ detection method and system based on visual identification
CN113689428B (en) * 2021-10-25 2022-06-07 江苏南通元辰钢结构制造有限公司 Mechanical part stress corrosion detection method and system based on image processing

Also Published As

Publication number Publication date
CN113962994A (en) 2022-01-21

Similar Documents

Publication Publication Date Title
CN107507173B (en) No-reference definition evaluation method and system for full-slice image
WO2018107939A1 (en) Edge completeness-based optimal identification method for image segmentation
CN114419025A (en) Fiberboard quality evaluation method based on image processing
CN113962994B (en) Method for detecting cleanliness of lock pin on three-connecting-rod based on image processing
CN116205919B (en) Hardware part production quality detection method and system based on artificial intelligence
CN114067114B (en) Area nuclear segmentation counting method based on algae cell morphology
CN116630813B (en) Highway road surface construction quality intelligent detection system
CN101877127A (en) Image reference-free quality evaluation method and system based on gradient profile
CN109376740A (en) A kind of water gauge reading detection method based on video
CN115294159B (en) Method for dividing corroded area of metal fastener
CN113935666B (en) Building decoration wall tile abnormity evaluation method based on image processing
CN114926410A (en) Method for detecting appearance defects of brake disc
CN115330645A (en) Welding image enhancement method
Mubashshira et al. An unsupervised approach for road surface crack detection
CN113313107A (en) Intelligent detection and identification method for multiple types of diseases on cable surface of cable-stayed bridge
CN113435460A (en) Method for identifying brilliant particle limestone image
CN117094975A (en) Method and device for detecting surface defects of steel and electronic equipment
CN109712116B (en) Fault identification method for power transmission line and accessories thereof
CN111402232B (en) Sperm aggregation detection method in semen
CN110349119B (en) Pavement disease detection method and device based on edge detection neural network
CN112528740A (en) Pressing plate state identification method
CN116862871A (en) Wood counting method based on mixed characteristics
CN115063603B (en) Wood annual ring line accurate extraction and restoration method based on edge information
CN116543414A (en) Tongue color classification and tongue redness and purple quantification method based on multi-model fusion
CN114677428A (en) Power transmission line icing thickness detection method based on unmanned aerial vehicle image processing

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