A method for detecting pearl appearance quality based on image processing
Through image processing technology, binarization, noise cancellation, boundary extraction and vector angle mean calculation are used to achieve efficient and accurate recognition of pearl appearance quality, solving the problems of low efficiency and poor accuracy of traditional detection methods, especially the problem of identifying subtle defects.
Patent Information
- Application Number
- CN202210448416.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-26
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2042-04-26
AI Technical Summary
Traditional pearl appearance quality detection methods rely on manual visual inspection, which has subjectivity, low detection efficiency, poor accuracy, and difficulty in identifying subtle depressions or raised parts.
Using an image processing method, through binarization, noise cancellation, individual extraction, boundary extraction and boundary coordinate extraction processing, the average vector angle value is calculated as feature parameters, and input to the classifier for pearl appearance quality recognition.
It improves the efficiency and accuracy of pearl appearance quality detection, reduces the error detection rate, and can effectively identify subtle depressions or raised parts.
Smart Images

Figure CN114926402B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pearl detection, and in particular to a method for detecting the appearance quality of pearls based on image processing. Background Art
[0002] Pearls are an ancient organic gemstone, primarily found in pearl oysters and mother-of-pearl molluscs. Pearls are calcium carbonate-containing mineral beads produced by the endocrine system of oysters, composed of numerous tiny aragonite crystals. Roundness has always been a key indicator of pearl quality: a high roundness indicates acceptable quality, while a low roundness indicates unacceptable quality. Traditional methods of inspecting pearl appearance rely on manual visual inspection, which is subjective, inefficient, inaccurate, and labor-intensive.
[0003] A search revealed a Chinese patent application with publication number CN 208075753 U, which proposes a device for inspecting the appearance of pearls. By incorporating a detection device and a drive mechanism, the device quantifies the inspection method and avoids the errors associated with direct visual inspection of pearls. However, a certain drawback remains: the device cannot detect and identify subtle depressions or protrusions in pearls with substandard appearance. Summary of the Invention
[0004] The object of the present invention is to provide a method for detecting the appearance quality of pearls based on image processing to solve the problems raised in the above-mentioned background technology.
[0005] The technical solution of the present invention is: a method for detecting the appearance quality of pearls based on image processing, comprising the following steps:
[0006] S1. Binarization processing: performing binarization processing on the collected images of pearls with qualified appearance quality and the collected images of pearls with unqualified appearance quality, respectively, to obtain binarized images;
[0007] S2, denoising: performing denoising on the binarized images to obtain denoised images;
[0008] S3. Individual pearl extraction: Individual pearl images of acceptable appearance quality and individual pearl images of unacceptable appearance quality in the entire image after noise removal are subjected to individual extraction, respectively, to obtain individual images of acceptable and unacceptable pearls;
[0009] S4. Boundary extraction processing: performing boundary extraction processing on the individual images of the pearls with qualified appearance quality and the pearls with unqualified appearance quality, respectively, to obtain images after boundary extraction processing;
[0010] S5, boundary coordinate extraction processing: performing boundary coordinate extraction processing on the image after boundary extraction processing to obtain boundary coordinate point values;
[0011] S6. Calculate the mean of the vector angle values: calculate the vector angle values composed of these points respectively, and calculate their mean as the feature parameter;
[0012] S7. Classification and identification: The mean value is input into the classifier to classify and identify pearls with qualified appearance quality and pearls with unqualified appearance quality.
[0013] Preferably, in S1, the binarization process includes the following steps:
[0014] S11. Setting the threshold , judge all the points on the image Whether the threshold condition is met;
[0015] S12, put the image The point is classified as an object point and the pixel value is set to 1; otherwise, it is classified as a background point and the pixel value is set to 0.
[0016] Preferably, in S2, the noise reduction process includes the following steps:
[0017] S21, marking all targets in the binarized image;
[0018] S22, calculating the area of all marked objects;
[0019] S23. Setting threshold , the area is larger than Otherwise, the target object is deleted.
[0020] Preferably, in S3, the individual extraction process includes: considering each pearl as a connected component, assuming is a connected component in the denoised image, yes A point in All elements in are obtained by the following formula:
[0021]
[0022] in, , is a suitable structural element when The iteration ends when That is, a single pearl.
[0023] Preferably, in S4, the boundary extraction process includes the following steps:
[0024] S41. Calculate the two-dimensional Fourier transform of the individual pearl image , the calculation formula is as follows:
[0025]
[0026] Among them, the size of the individual pearl image is , represents any point, represents an imaginary unit;
[0027] S42, use high-pass filter Multiply , the filtering function is:
[0028]
[0029] in, , is the cutoff radius;
[0030] S43, calculate the inverse Fourier transform of the result in S42, the inverse Fourier transform formula is:
[0031]
[0032] S44, taking the real part of the result of S43 to obtain image boundary information;
[0033] S45. Binarize the result in S44 to obtain a binary boundary.
[0034] Preferably, in S5, the boundary coordinate extraction process includes: sampling to obtain pixel points of the image boundary, obtaining the direction chain code of the image boundary in a clockwise direction according to the 8-direction chain code direction, and obtaining the direction chain code of the image boundary in a clockwise direction. When the chain code value is 0, the coordinates of its next point are , a point in the image When the chain code value is 1, the coordinates of its next point are , a point in the image When the chain code value is 2, the coordinates of its next point are ...and so on to obtain the complete closed image boundary coordinates.
[0035] Preferably, in S6, calculating the mean of the vector angle values includes the following steps:
[0036] S61. Based on the coordinate values obtained in step S5, the vector angle formed by the pearl boundary points is calculated using the following formula:
[0037]
[0038] in, , is the vector formed by two adjacent points;
[0039] S62, for the convenience of statistics, Divide by 10, round to the nearest integer, and then multiply by 10. The formula is as follows:
[0040]
[0041] S63. Let the total number of vector angles be , the maximum angle is 180 degrees, for any vector angle , count all vector angles with an angle equal to The total number is , then the angle is Histogram components of The calculation formula is as follows:
[0042]
[0043] S64, mean The calculation formula is as follows:
[0044] .
[0045] Preferably, in S7, the classification identification includes the following steps:
[0046] S71, each take Pearls of good appearance and quality Take pearls with unqualified appearance quality as training samples, repeat S1-S6, and calculate the mean of each pearl with qualified appearance quality and each pearl with unqualified appearance quality , and divided into two subsets and ;
[0047] S72. Calculate the mean vector of pearls with qualified appearance quality and pearls with unqualified appearance quality , , the calculation formula is as follows:
[0048]
[0049] S73. Calculate the intra-class discrete matrix of pearls with qualified appearance quality and pearls with unqualified appearance quality , , the calculation formula is as follows:
[0050]
[0051] S74. Calculate the total discrete matrix within the class , the calculation formula is as follows:
[0052]
[0053] S75, Calculation Matrix The inverse matrix of ;
[0054] S76. Calculate vector , the calculation formula is as follows:
[0055]
[0056] S77, the discriminant function is , the calculation formula is as follows:
[0057]
[0058] S78. Calculate the threshold of the function , the calculation formula is as follows:
[0059]
[0060] S79, when Greater than , then the pearls are of unqualified appearance quality. Less than , then the pearls are of qualified appearance quality.
[0061] The present invention provides an improved method for detecting the appearance quality of pearls based on image processing. Compared with the prior art, the present invention has the following improvements and advantages:
[0062] First, the present invention mainly solves the problem of pearl appearance quality detection. By obtaining the coordinate values of the image boundary points, the angle value of the vector formed by these points is calculated, and the mean value is used as the feature parameter. The mean value is input into the classifier to realize the recognition of the pearl appearance quality.
[0063] Secondly, the present invention starts from the edge of the pearl and finds the characteristic parameters of the vector angle formed by the pearl edge points, thereby amplifying the edge information of the pearl, increasing the difference between pearls with qualified appearance quality and pearls with unqualified appearance quality, and solving the problem of being unable to detect and identify the subtle concave or convex parts of pearls with unqualified appearance quality. The present invention not only improves the detection efficiency of pearl appearance quality, but also reduces the false detection rate, which can meet actual detection needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] The present invention will be further explained below in conjunction with the accompanying drawings and embodiments:
[0065] Figure 1 This is a flow chart of pearl appearance quality testing according to the present invention. DETAILED DESCRIPTION
[0066] The present invention is described in detail below, clearly and completely describing the technical solutions in the embodiments of the present invention. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0067] The present invention provides an improved method for detecting the appearance quality of pearls based on image processing. The technical solution of the present invention is:
[0068] like Figure 1 As shown, a pearl appearance quality detection method based on image processing includes the following steps:
[0069] S1. Binarization processing: Binarization processing is performed on the images of pearls with qualified appearance quality and the images of pearls with unqualified appearance quality acquired by the industrial camera, respectively, to obtain binarized images;
[0070] Specifically, the binarization process includes the following steps:
[0071] S11. Setting the threshold , judge all the points on the image Whether the threshold condition is met;
[0072] S12, put the image The point is divided into object points and the pixel value is set to 1; otherwise, it is divided into background points and the pixel value is set to 0;
[0073] S2, denoising: performing denoising on the binarized images to obtain denoised images;
[0074] Specifically, the noise reduction process includes the following steps:
[0075] S21, marking all targets in the binarized image;
[0076] S22, calculating the area of all marked objects;
[0077] S23. Setting threshold , the area is larger than The target object is retained; otherwise, the target object is deleted;
[0078] S3. Individual pearl extraction: Individual pearl images of acceptable appearance quality and individual pearl images of unacceptable appearance quality in the entire image after noise removal are subjected to individual extraction, respectively, to obtain individual images of acceptable and unacceptable pearls;
[0079] Specifically, the individual extraction process includes: considering each pearl as a connected component, assuming is a connected component in the denoised image, yes A point in All elements in are obtained by the following formula:
[0080]
[0081] in, , is a suitable structural element when The iteration ends when That is, a single pearl.
[0082] S4. Boundary extraction processing: performing boundary extraction processing on the individual images of the pearls with qualified appearance quality and the pearls with unqualified appearance quality, respectively, to obtain images after boundary extraction processing;
[0083] Specifically, the boundary extraction process includes the following steps:
[0084] S41. Calculate the two-dimensional Fourier transform of the individual pearl image , the calculation formula is as follows:
[0085]
[0086] Among them, the size of the individual pearl image is , represents any point, represents an imaginary unit;
[0087] S42, use high-pass filter Multiply , the filtering function is:
[0088]
[0089] in, , is the cutoff radius;
[0090] S43, calculate the inverse Fourier transform of the result in S42, the inverse Fourier transform formula is:
[0091]
[0092] S44, taking the real part of the result of S43 to obtain image boundary information;
[0093] S45, binarize the result in S44 to obtain a binarized boundary;
[0094] S5, boundary coordinate extraction processing: performing boundary coordinate extraction processing on the image after boundary extraction processing to obtain boundary coordinate point values;
[0095] Specifically, the boundary coordinate extraction process includes: sampling the pixel points of the image boundary, obtaining the direction chain code of the image boundary in the clockwise direction according to the 8-way chain code direction, and obtaining the direction chain code of the image boundary in the clockwise direction. When the chain code value is 0, the coordinates of its next point are , a point in the image When the chain code value is 1, the coordinates of its next point are , a point in the image When the chain code value is 2, the coordinates of its next point are ...and so on to obtain the complete closed image boundary coordinates;
[0096] S6. Calculate the mean of the vector angle values: calculate the vector angle values composed of these points respectively, and calculate their mean as the feature parameter;
[0097] Specifically, calculating the mean of the vector angle values includes the following steps:
[0098] S61. Based on the coordinate values obtained in step S5, the vector angle formed by the pearl boundary points is calculated using the following formula:
[0099]
[0100] in, , is the vector formed by two adjacent points;
[0101] S62, for the convenience of statistics, Divide by 10, round to the nearest integer, and then multiply by 10. The formula is as follows:
[0102]
[0103] S63. Let the total number of vector angles be , the maximum angle is 180 degrees, for any vector angle , count all vector angles with an angle equal to The total number is , then the angle is Histogram components of The calculation formula is as follows:
[0104]
[0105] S64, mean The calculation formula is as follows:
[0106] ;
[0107] S7. Classification and identification: The mean value is input into a classifier to classify and identify pearls with acceptable appearance quality and pearls with unacceptable appearance quality;
[0108] Specifically, classification recognition includes the following steps:
[0109] S71, each take Pearls of good appearance and quality Take pearls with unqualified appearance quality as training samples, repeat S1-S6, and calculate the mean of each pearl with qualified appearance quality and each pearl with unqualified appearance quality , and divided into two subsets and ;
[0110] S72. Calculate the mean vector of pearls with qualified appearance quality and pearls with unqualified appearance quality , , the calculation formula is as follows:
[0111]
[0112] S73. Calculate the intra-class discrete matrix of pearls with qualified appearance quality and pearls with unqualified appearance quality , , the calculation formula is as follows:
[0113]
[0114] S74. Calculate the total discrete matrix within the class , the calculation formula is as follows:
[0115]
[0116] S75, Calculation Matrix The inverse matrix of ;
[0117] S76. Calculate vector , the calculation formula is as follows:
[0118]
[0119] S77, the discriminant function is , the calculation formula is as follows:
[0120]
[0121] S78. Calculate the threshold of the function , the calculation formula is as follows:
[0122]
[0123] S79, when Greater than , then the pearls are of unqualified appearance quality. Less than , then the pearls are of qualified appearance quality.
[0124] The present invention mainly solves the problem of pearl appearance quality detection. By obtaining the coordinate values of the image boundary points, the angle values of the vectors composed of these points are obtained, and their mean is calculated as a feature parameter. The mean value is input into a classifier to realize the recognition of the pearl appearance quality.
[0125] Starting from the edge of the pearl, the characteristic parameters of the vector angle formed by the pearl edge points are found, which amplifies the edge information of the pearl, increases the difference between pearls with qualified appearance quality and pearls with unqualified appearance quality, and solves the problem of being unable to detect and identify the subtle concave or convex parts of pearls with unqualified appearance quality. The present invention not only improves the detection efficiency of pearl appearance quality, but also reduces the false detection rate, which can meet actual detection needs.
[0126] The above description is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for detecting the appearance quality of pearls based on image processing, characterized in that: The following steps are involved: S1. Binarization processing: performing binarization processing on the collected images of pearls with qualified appearance quality and the collected images of pearls with unqualified appearance quality, respectively, to obtain binarized images; S2, denoising: performing denoising on the binarized images to obtain denoised images; S3. Individual pearl extraction: Individual pearl images of acceptable appearance quality and individual pearl images of unacceptable appearance quality in the entire image after noise removal are subjected to individual extraction, respectively, to obtain individual images of acceptable and unacceptable pearls; S4. Boundary extraction processing: performing boundary extraction processing on the individual images of the pearls with qualified appearance quality and the pearls with unqualified appearance quality, respectively, to obtain images after boundary extraction processing; S5, boundary coordinate extraction processing: performing boundary coordinate extraction processing on the image after boundary extraction processing to obtain boundary coordinate point values; S6. Calculate the mean of the vector angle values: calculate the vector angle values composed of these points respectively, and calculate their mean as the feature parameter; S7. Classification and identification: The mean value is input into the classifier to classify and identify pearls with qualified appearance quality and pearls with unqualified appearance quality.
2. The pearl appearance quality detection method based on image processing according to claim 1, characterized in that: In S1, the binarization process includes the following steps: S11. Setting the threshold , judge all the points on the image Whether the threshold condition is met; S12, put the image The point is classified as an object point and the pixel value is set to 1; otherwise, it is classified as a background point and the pixel value is set to 0.
3. The method for detecting pearl appearance quality based on image processing according to claim 2, characterized in that: In S2, the noise reduction process includes the following steps: S21, marking all targets in the binarized image; S22, calculating the area of all marked objects; S23. Setting threshold , the area is larger than Otherwise, the target object is deleted.
4. The method for detecting pearl appearance quality based on image processing according to claim 3, characterized in that: In S3, the individual extraction process includes: considering each pearl as a connected component, assuming is a connected component in the denoised image, yes A point in All elements in are obtained by the following formula: in, , is a suitable structural element when The iteration ends when That is, a single pearl.
5. The method for detecting pearl appearance quality based on image processing according to claim 4, characterized in that: In S4, the boundary extraction process includes the following steps: S41. Calculate the two-dimensional Fourier transform of the individual pearl image , the calculation formula is as follows: Among them, the size of the individual pearl image is , represents any point, represents an imaginary unit; S42, use high-pass filter Multiply , the filtering function is: in, , is the cutoff radius; S43, calculate the inverse Fourier transform of the result in S42, the inverse Fourier transform formula is: S44, taking the real part of the result of S43 to obtain image boundary information; S45. Binarize the result in S44 to obtain a binary boundary.
6. The method for detecting pearl appearance quality based on image processing according to claim 5, characterized in that: In S5, the boundary coordinate extraction process includes: sampling the pixel points of the image boundary, obtaining the direction chain code of the image boundary in the clockwise direction according to the 8-way chain code direction, and obtaining the direction chain code of the image boundary in the clockwise direction. When the chain code value is 0, the coordinates of its next point are , a point in the image When the chain code value is 1, the coordinates of its next point are , a point in the image When the chain code value is 2, the coordinates of its next point are ...and so on to obtain the complete closed image boundary coordinates.
7. The method for detecting pearl appearance quality based on image processing according to claim 6, characterized in that: In S6, calculating the mean of the vector angle values includes the following steps: S61. Based on the coordinate values obtained in step S5, the vector angle formed by the pearl boundary points is calculated using the following formula: in, , is the vector formed by two adjacent points; S62, for the convenience of statistics, Divide by 10, round to the nearest integer, and then multiply by 10. The formula is as follows: S63. Let the total number of vector angles be , the maximum angle is 180 degrees, for any vector angle , count all vector angles with an angle equal to The total number is , then the angle is Histogram components of The calculation formula is as follows: S64, mean The calculation formula is as follows: 。 8. The method for detecting pearl appearance quality based on image processing according to claim 7, characterized in that: In S7, classification and recognition include the following steps: S71, each take Pearls of good appearance and quality Take pearls with unqualified appearance quality as training samples, repeat S1-S6, and calculate the mean of each pearl with qualified appearance quality and each pearl with unqualified appearance quality , and divided into two subsets and ; S72. Calculate the mean vector of pearls with qualified appearance quality and pearls with unqualified appearance quality , , the calculation formula is as follows: S73. Calculate the intra-class discrete matrix of pearls with qualified appearance quality and pearls with unqualified appearance quality , , the calculation formula is as follows: S74. Calculate the total discrete matrix within the class , the calculation formula is as follows: S75, calculation matrix The inverse matrix of ; S76. Calculate vector , the calculation formula is as follows: S77, the discriminant function is , the calculation formula is as follows: S78. Calculate the threshold of the function , the calculation formula is as follows: S79, when Greater than , then the pearls are of unqualified appearance quality. Less than , then the pearls are of qualified appearance quality.
Citation Information
Patent Citations
A device for detecting pearl outward appearance
CN208075753U
Device for automatically grading pearls on line according to size and shape on basis of monocular multi-view machine vision
CN102928431A
Capsule head defect detection method and apparatus
CN105139027A