A method for automatically visually inspecting the quality of finished preserved egg products
Through image data processing technology, the surface and internal shape characteristics of the egg are analyzed, and abnormal indicators are calculated, which solves the problem of inaccurate detection of internal quality problems in the quality inspection of the egg in the existing technology and improves the detection accuracy.
Patent Information
- Application Number
- CN202410262491.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-07
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-03-07
AI Technical Summary
It is difficult to accurately detect internal quality problems in the quality inspection of preserved eggs with the existing technology, resulting in poor detection accuracy.
The image data processing method is used to obtain the target surface image and internal image, segment and analyze the surface and internal areas of the egg, extract the appearance and internal shape features, and calculate abnormal indicators for quality inspection.
It improves the accuracy of quality inspection of preserved egg products, enables comprehensive detection of appearance and internal defects, and reduces the impact of manual subjective judgment.
Smart Images

Figure CN117949616B
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image data processing, and in particular to an automated visual inspection method for the quality of a finished preserved egg. Background Art
[0002] In the egg processing industry, Songhua eggs are widely popular for their unique taste and appearance. Therefore, quality inspection of Songhua eggs is very important. Traditional quality inspection methods mainly rely on manual visual inspection. In the face of automated Songhua egg production, manual visual inspection requires a lot of manpower input, which increases production costs. In addition, manual inspection is relatively slow and cannot meet the needs of large-scale production. It is easy to become a bottleneck of the production line. Due to human subjective judgment, different operators may have different evaluations on the quality of the same batch of Songhua eggs, resulting in uncertainty in quality control.
[0003] With the development of image data processing technology, image data processing technology can often be used in existing quality inspections. When using image data processing technology for quality inspections, the influence of human subjective factors can be reduced to a certain extent, thereby improving the accuracy of quality inspections. At present, when using image data processing technology for quality inspections, the method usually used is: defect detection is performed based on the different grayscale values in the collected surface image of the object, thereby achieving quality inspection.
[0004] However, when the quality inspection of preserved eggs is performed based on the grayscale values in the collected surface images, the following technical problems often occur:
[0005] Since the quality problems of preserved eggs often include appearance defects and internal quality problems, for example, appearance defects may be damage, which may cause changes in the surface grayscale value; internal quality problems may be internal deterioration of the preserved eggs, which often does not cause changes in the surface grayscale value. Therefore, when testing the quality of the finished preserved eggs, if only the difference in grayscale values is considered, quality testing of the preserved eggs may make it difficult to accurately detect the internal quality problems of the preserved eggs, resulting in poor accuracy in quality testing of the finished preserved eggs. Summary of the invention
[0006] In order to solve the technical problem of poor accuracy in quality inspection of finished Songhua eggs, the present invention proposes an automated visual inspection method for the quality of finished Songhua eggs.
[0007] The present invention provides an automated visual inspection method for the quality of a finished Songhua egg product, the method comprising:
[0008] Obtain a target surface image and a target internal image corresponding to the finished product of the batch of preserved eggs to be tested;
[0009] Performing pine egg surface region segmentation on the target surface image to obtain a pine egg surface region set;
[0010] Performing appearance shape analysis processing on each pine egg surface area in the pine egg surface area set to obtain appearance shape features corresponding to each pine egg surface area;
[0011] Determine the appearance abnormality index corresponding to the finished product of the batch of preserved eggs to be tested according to the appearance shape characteristics corresponding to all the preserved egg surface areas in the preserved egg surface area set;
[0012] Segmenting the target internal image into the internal region of the preserved egg to obtain a set of internal regions of the preserved egg;
[0013] Performing a Songhua egg internal shape analysis process on each Songhua egg internal region in the Songhua egg internal region set to obtain an internal shape feature corresponding to each Songhua egg internal region;
[0014] Determine the internal abnormality index corresponding to the finished product of the batch of preserved eggs to be tested according to the internal shape characteristics corresponding to all the internal areas of the preserved eggs in the set of internal areas of the preserved eggs;
[0015] According to the appearance abnormality index and the internal abnormality index, determine the target abnormality index corresponding to the batch of preserved eggs to be tested;
[0016] According to the target abnormality index, quality inspection is performed on the finished preserved egg batch to be inspected.
[0017] Optionally, performing appearance shape analysis processing on each pine egg surface area in the pine egg surface area set to obtain appearance shape features corresponding to each pine egg surface area includes:
[0018] Determine the ratio of the boundary length of the pine egg surface area to the area of the pine egg surface area as the contour coefficient corresponding to the pine egg surface area;
[0019] Performing edge detection on the surface area of the preserved egg to obtain an initial edge set corresponding to the surface area of the preserved egg;
[0020] The number of initial edges in the initial edge set is determined as the number of edge lines corresponding to the surface area of the preserved egg;
[0021] The slope of the line between each two adjacent pixels on each initial edge is used as the reference slope between the two pixels to obtain a reference slope set corresponding to each initial edge;
[0022] The appearance shape features corresponding to the surface area of the preserved egg are determined based on a reference slope set corresponding to all initial edges in an initial edge set corresponding to the surface area of the preserved egg, a contour coefficient and the number of edge lines corresponding to the surface area of the preserved egg.
[0023] Optionally, the formula corresponding to the appearance shape feature corresponding to the surface area of the preserved egg is:
[0024]
[0025] Among them, E r is the appearance shape feature corresponding to the rth Songhua egg surface region in the Songhua egg surface region set; r is the sequence number of the Songhua egg surface region in the Songhua egg surface region set; E r1 is the first appearance feature corresponding to the rth Songhua egg surface area in the Songhua egg surface area set; E r2 is the second appearance feature corresponding to the rth Songhua egg surface area in the Songhua egg surface area set; || is the absolute value function; p r is the silhouette coefficient corresponding to the rth Songhua egg surface area in the Songhua egg surface area set; p is the pre-acquired standard silhouette coefficient; G r is the number of edge lines corresponding to the rth Songhua egg surface area in the Songhua egg surface area set; n r is the number of pixels in the rth Songhua egg surface area in the Songhua egg surface area set; i and j are the serial numbers of the pixels in the rth Songhua egg surface area in the Songhua egg surface area set; I ri is the gray value corresponding to the i-th pixel point in the r-th Songhua egg surface area in the Songhua egg surface area set; I rj is the gray value corresponding to the jth pixel point in the rth Songhua egg surface area in the Songhua egg surface area set; a is the sequence number of the initial edge in the initial edge set corresponding to the rth Songhua egg surface area in the Songhua egg surface area set; σ ra It is the variance of the reference slope set corresponding to the rth pine egg surface area in the pine egg surface area set.
[0026] Optionally, determining the appearance abnormality index corresponding to the batch of preserved egg products to be tested according to the appearance shape features corresponding to all the preserved egg surface areas in the preserved egg surface area set includes:
[0027] Randomly select a pine egg surface area from the pine egg surface area set as a reference surface area;
[0028] Based on the information entropy of the appearance shape features corresponding to all the preserved egg surface areas in the preserved egg surface area set, and the difference between the appearance shape features corresponding to the reference surface area and other preserved egg surface areas in the preserved egg surface area set, the appearance abnormality index corresponding to the finished preserved egg batch to be tested is determined.
[0029] Optionally, the formula corresponding to the abnormal appearance index of the finished product of the batch of preserved eggs to be tested is:
[0030] W = W1 × W2;
[0031] Among them, W is the appearance abnormality index corresponding to the finished products of the batch of Songhua eggs to be tested; W1 is the information entropy of the appearance shape characteristics corresponding to all Songhua egg surface areas in the Songhua egg surface area set; W2 is the appearance abnormality factor corresponding to the finished products of the batch of Songhua eggs to be tested; N is the number of different appearance shape characteristics corresponding to all Songhua egg surface areas in the Songhua egg surface area set; b is the serial number of different appearance shape characteristics corresponding to all Songhua egg surface areas in the Songhua egg surface area set; n b is the number of Songhua egg surface regions in the Songhua egg surface region set whose corresponding appearance shape feature is equal to the bth appearance shape feature; n is the number of Songhua egg surface regions in the Songhua egg surface region set; Based on the natural constants The logarithm of ; c is the serial number of the Songhua egg surface area in the Songhua egg surface area set except the reference surface area; E is the appearance shape feature corresponding to the reference surface area; E c is the appearance shape feature corresponding to the cth preserved egg surface area in the preserved egg surface area set excluding the reference surface area; || is the absolute value function.
[0032] Optionally, performing a Songhua egg internal shape analysis process on each Songhua egg internal region in the Songhua egg internal region set to obtain an internal shape feature corresponding to each Songhua egg internal region includes:
[0033] Segmenting the yolk region from the inner region of the Songhua egg, and determining the centroid of the yolk region in the inner region of the Songhua egg as the target centroid corresponding to the inner region of the Songhua egg;
[0034] Taking the target mass center corresponding to the inner area of the preserved egg as an endpoint, a preset number of rays in different directions are made as reference rays to obtain a reference ray set corresponding to the inner area of the preserved egg;
[0035] Determine the intersection point between each reference ray in the reference ray set corresponding to the inner region of the Songhua egg and the boundary of the inner region of the Songhua egg as the first intersection point corresponding to each reference ray, and determine the intersection point between each reference ray and the boundary of the yolk region in the inner region of the Songhua egg as the second intersection point corresponding to each reference ray;
[0036] Determine the distance between the first intersection point and the second intersection point corresponding to each reference ray in the reference ray set corresponding to the inner area of the preserved egg as the target distance corresponding to each reference ray;
[0037] The internal shape features corresponding to the internal area of the preserved egg are determined according to the target distances corresponding to all reference rays in the reference ray set corresponding to the internal area of the preserved egg.
[0038] Optionally, determining the internal shape feature corresponding to the internal area of the preserved egg according to the target distances corresponding to all reference rays in the reference ray set corresponding to the internal area of the preserved egg includes:
[0039] Randomly select a reference ray from the reference ray set corresponding to the inner area of the preserved egg as the target ray corresponding to the inner area of the preserved egg;
[0040] The internal shape features corresponding to the internal area of the preserved egg are determined based on the target distance difference between the target ray and other reference rays in the reference ray set corresponding to the internal area of the preserved egg, and the area ratio between the yolk area in the internal area of the preserved egg and the minimum circumscribed circle of the yolk area in the internal area of the preserved egg.
[0041] Optionally, the determining of the internal abnormality index corresponding to the batch of preserved eggs to be tested according to the internal shape features corresponding to all the preserved egg internal regions in the preserved egg internal region set includes:
[0042] Randomly select a pine egg internal region from the pine egg internal region set as the target internal region;
[0043] According to the difference in internal shape characteristics between the target internal area and other internal areas of the preserved egg in the set of preserved egg internal areas, the formula corresponding to the internal abnormality index corresponding to the finished preserved egg batch to be tested is determined as follows:
[0044] H = H1 × H2;
[0045] H2=|L1-L2|; where H is the internal abnormality index corresponding to the finished product of the batch of Songhua eggs to be tested; H1 is the first internal abnormality feature corresponding to the finished product of the batch of Songhua eggs to be tested; H2 is the second internal abnormality feature corresponding to the finished product of the batch of Songhua eggs to be tested; R is the number of Songhua egg internal regions in the Songhua egg internal region set; k is the serial number of the Songhua egg internal region in the Songhua egg internal region set except the target internal region; || is the absolute value function; T is the internal shape feature corresponding to the target internal region; T k It is the internal shape feature corresponding to the kth preserved egg internal area in the set of preserved egg internal areas, excluding the target internal area; L1 is the mean of the grayscale values corresponding to all pixels in the yolk area of all preserved egg internal areas in the set of preserved egg internal areas; L2 is the mean of the grayscale values corresponding to all pixels in the yolk area of the standard preserved egg obtained in advance.
[0046] Optionally, both the appearance abnormality index and the internal abnormality index are positively correlated with the target abnormality index.
[0047] Optionally, the quality inspection of the batch of preserved eggs to be inspected according to the target abnormality index includes:
[0048] When the target abnormality index is greater than a preset abnormality threshold, it is determined that the quality of the finished product of the batch of preserved eggs to be tested is unqualified;
[0049] When the target abnormality index is less than or equal to the preset abnormality threshold, it is determined that the quality of the finished product of the batch of preserved eggs to be tested is qualified.
[0050] The present invention has the following beneficial effects:
[0051] The invention discloses an automatic visual inspection method for the quality of a Songhua egg finished product, which realizes the quality inspection of Songhua eggs by processing the target surface image and the target internal image, solves the technical problem of poor accuracy in quality inspection of Songhua egg finished products, and improves the accuracy of quality inspection of Songhua egg finished products. First, since the target surface image and the target internal image can be the outer surface image and the internal structure image of the Songhua egg finished product to be inspected, respectively, compared with the form of random inspection, the target surface image and the target internal image representing the overall information of the Songhua egg finished product to be inspected can facilitate the subsequent overall inspection of the appearance defects and internal quality of the Songhua egg finished product to be inspected, so that the inspection is more comprehensive. Then, since the appearance defects of Songhua eggs are often damaged, etc., which causes the appearance shape of Songhua eggs to change, the appearance shape analysis processing of each Songhua egg surface area can facilitate the understanding of whether each Songhua egg surface area has an appearance defect. Therefore, based on the appearance shape characteristics corresponding to all Songhua egg surface areas, the appearance abnormality index corresponding to the Songhua egg finished product to be inspected can characterize the overall appearance defect characteristics of the Songhua egg finished product to be inspected. Next, since the internal quality problem is often the internal deterioration of the Songhua egg, which causes the internal structure of the Songhua egg to change, the internal shape analysis of each Songhua egg internal area can facilitate understanding whether there is an internal quality problem in each Songhua egg internal area. Therefore, based on the internal shape characteristics corresponding to all Songhua egg internal areas, the internal abnormality index corresponding to the quantified batch of Songhua egg finished products to be tested can characterize the internal quality characteristics of the entire batch of Songhua egg finished products to be tested. Afterwards, based on the appearance abnormality index and the internal abnormality index, the target abnormality index corresponding to the quantified batch of Songhua egg finished products to be tested can characterize the internal and external quality characteristics of the entire batch of Songhua egg finished products to be tested. Finally, based on the target abnormality index, the quality inspection of the batch of Songhua egg finished products to be tested is carried out, and the quality inspection of the batch of Songhua egg finished products to be tested is realized. Compared with the Songhua egg quality inspection based on the difference in grayscale values in the collected object surface image, the present invention comprehensively considers the appearance shape and internal shape of the Songhua egg, thereby improving the accuracy of the quality inspection of the batch of Songhua egg finished products to be tested. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0053] Figure 1 The present invention is a flow chart of a method for automated visual inspection of the quality of finished preserved eggs. DETAILED DESCRIPTION
[0054] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation methods, structures, features and effects of the technical solutions proposed by the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0055] 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.
[0056] refer to Figure 1 , shows the process of some embodiments of an automated visual inspection method for finished Songhua eggs according to the present invention. The automated visual inspection method for finished Songhua eggs comprises the following steps:
[0057] Step S1, obtaining the target surface image and target internal image corresponding to the batch of preserved eggs to be tested.
[0058] The finished products of the batch of Songhua eggs to be tested may be a batch of Songhua eggs to be tested for quality. The finished products of the batch of Songhua eggs to be tested may be placed on a conveyor belt in a single layer, and there may be a certain interval between the Songhua eggs. The target surface image may be a surface image of the finished products of the batch of Songhua eggs to be tested. The target internal image may be an image characterizing the internal structure of the finished products of the batch of Songhua eggs to be tested, collected by X-ray or ultrasound. X-ray is also called X-ray.
[0059] It should be noted that since the target surface image and the target internal image can be the outer surface image and the internal structure image of the finished batch of preserved eggs to be inspected respectively, compared with the form of random inspection, the present invention obtains the target surface image and the target internal image that represent the overall information of the finished batch of preserved eggs to be inspected, which can facilitate the subsequent overall inspection of the appearance defects and internal quality of the finished batch of preserved eggs to be inspected, making its inspection more comprehensive.
[0060] As an example, this step may include the following steps:
[0061] The first step is to obtain the target surface image corresponding to the finished products of the batch of preserved eggs to be tested.
[0062] For example, an industrial camera or a camera can be used to collect images of a batch of preserved eggs to be inspected as an initial surface image, and the initial surface image can be preprocessed. The initial surface image after image preprocessing can be used as a target surface image, wherein the image preprocessing can include but is not limited to: denoising, image enhancement and grayscale.
[0063] The second step is to obtain the target internal image corresponding to the finished product of the batch of preserved eggs to be tested.
[0064] For example, images of the finished products of the batch of preserved eggs to be inspected can be collected by X-ray or ultrasound as the target internal images.
[0065] Step S2, performing preserved egg surface area segmentation on the target surface image to obtain a preserved egg surface area set.
[0066] Among them, the preserved egg surface area in the preserved egg surface area set may be the area where the preserved egg is located in the target surface image.
[0067] It should be noted that the surface area of a preserved egg can represent the outer surface of a preserved egg.
[0068] As an example, the threshold segmentation technology can be used to segment the area where the preserved egg is located from the target surface image as the preserved egg surface area, thereby obtaining a preserved egg surface area set.
[0069] Optionally, the area where the preserved egg is located can be identified from the target surface image by using neural network technology as the preserved egg surface area, thereby obtaining a preserved egg surface area set.
[0070] Step S3, performing appearance shape analysis processing on each preserved egg surface area in the preserved egg surface area set to obtain appearance shape features corresponding to each preserved egg surface area.
[0071] It should be noted that, since appearance defects of preserved eggs are often caused by breakage, etc., which results in changes in the appearance shape of the preserved eggs, performing appearance shape analysis on the surface area of each preserved egg can facilitate understanding whether there are appearance defects on the surface area of each preserved egg.
[0072] As an example, this step may include the following steps:
[0073] The first step is to determine the ratio of the boundary length of the above-mentioned preserved egg surface area to the area of the above-mentioned preserved egg surface area as the contour coefficient corresponding to the above-mentioned preserved egg surface area.
[0074] The length of the boundary of the surface area of the preserved egg can be represented by the number of pixels on the boundary of the surface area of the preserved egg. The area of the surface area of the preserved egg can be represented by the number of pixels in the surface area of the preserved egg.
[0075] In the second step, edge detection is performed on the surface area of the preserved egg to obtain an initial edge set corresponding to the surface area of the preserved egg.
[0076] Among them, the initial edge in the initial edge set corresponding to the surface area of the preserved egg can be an edge within the surface area of the preserved egg.
[0077] The third step is to determine the number of initial edges in the above initial edge set as the number of edge lines corresponding to the surface area of the preserved egg.
[0078] In the fourth step, the slope of the line between every two adjacent pixels on each initial edge is used as the reference slope between the two pixels to obtain a reference slope set corresponding to each initial edge.
[0079] The reference slope set corresponding to the initial edge may include: slopes of lines connecting all two adjacent pixel points on the initial edge.
[0080] The fifth step is to determine the appearance shape features corresponding to the above-mentioned preserved egg surface area based on the reference slope set corresponding to all initial edges in the initial edge set corresponding to the above-mentioned preserved egg surface area, the contour coefficient and the number of edge lines corresponding to the above-mentioned preserved egg surface area.
[0081] For example, the formula corresponding to the appearance shape characteristics of the surface area of the preserved egg can be:
[0082] E r =E r1 ×E r2 ×|p r -p|×G r ;
[0083] Among them, E r is the appearance shape feature corresponding to the rth Songhua egg surface region in the Songhua egg surface region set. r is the sequence number of the Songhua egg surface region in the Songhua egg surface region set. r1 is the first appearance feature corresponding to the rth preserved egg surface region in the preserved egg surface region set. r2 is the second appearance feature corresponding to the rth Songhua egg surface area in the Songhua egg surface area set. || is the absolute value function. p ris the contour coefficient corresponding to the rth Songhua egg surface area in the Songhua egg surface area set. p is the pre-acquired standard contour coefficient. The method for acquiring the standard contour coefficient may be: using a camera to collect a surface image of a Songhua egg of qualified quality, and performing image preprocessing on the surface image to obtain a target Songhua egg image, and determining the contour coefficient corresponding to the Songhua egg area in the target Songhua egg image as the standard contour coefficient. The calculation method of the contour coefficient corresponding to the Songhua egg area may be the same as the calculation method of the contour coefficient corresponding to the Songhua egg surface area. G r is the number of edge lines corresponding to the rth Songhua egg surface area in the Songhua egg surface area set. r is the number of pixels in the rth Songhua egg surface area in the Songhua egg surface area set. i and j are the serial numbers of the pixels in the rth Songhua egg surface area in the Songhua egg surface area set. ri is the gray value corresponding to the i-th pixel point in the r-th pine egg surface area in the pine egg surface area set. rj is the gray value corresponding to the jth pixel in the rth Songhua egg surface area in the Songhua egg surface area set. a is the sequence number of the initial edge in the initial edge set corresponding to the rth Songhua egg surface area in the Songhua egg surface area set. σ ra It is the variance of the reference slope set corresponding to the rth pine egg surface area in the pine egg surface area set.
[0084] It should be noted that the appearance contours of Songhua eggs without defects such as appearance damage are often similar, often presenting an elliptical shape. Since the contour coefficient is the ratio of the boundary length of the Songhua egg surface area to the area of the Songhua egg surface area, the contour coefficient can characterize the appearance contour of the Songhua egg to a certain extent. r When -p| is larger, it often means that the difference between the contour coefficient corresponding to the rth Songhua egg surface area and the standard contour coefficient is larger, which often means that the shape of the outer surface of the Songhua egg represented by the rth Songhua egg surface area is more likely to have changed due to damage, etc., which often means that the quality of the Songhua egg represented by the rth Songhua egg surface area is worse. r The smaller it is, the fewer the number of edge lines corresponding to the surface area of the r-th Songhua egg is, the smoother the surface area of the r-th Songhua egg is, the cleaner the outer surface of the Songhua egg represented by the surface area of the r-th Songhua egg is, and the better the cleaning quality of the Songhua egg represented by the surface area of the r-th Songhua egg is. r1The smaller it is, the smaller the grayscale difference between the pixels in the surface area of the r-th preserved egg is, the smoother the surface area of the r-th preserved egg is, the cleaner the outer surface of the preserved egg represented by the surface area of the r-th preserved egg is, and the better the cleaning quality of the preserved egg represented by the surface area of the r-th preserved egg is. For example, when the appearance of a preserved egg is damaged, the edge shape of the damaged defect is often irregular, so the slope distribution on the edge line of the damaged defect is often relatively discrete. r2 When E is larger, it often means that the slope distribution on the edge line in the surface area of the r-th Songhua egg is relatively more discrete, which often means that the Songhua egg represented by the surface area of the r-th Songhua egg is more likely to have appearance defects such as damage, and often means that the quality of the Songhua egg represented by the surface area of the r-th Songhua egg is worse. r The larger it is, the worse the outer surface quality of the preserved egg represented by the rth preserved egg surface area is.
[0085] Step S4, determining the appearance abnormality index corresponding to the finished preserved egg batch to be tested based on the appearance shape characteristics corresponding to all the preserved egg surface areas in the preserved egg surface area set.
[0086] It should be noted that, based on the appearance shape characteristics corresponding to the surface areas of all preserved eggs, the quantified appearance abnormality index corresponding to the finished preserved eggs in the batch to be tested can characterize the overall appearance defect characteristics of the finished preserved eggs in the batch to be tested.
[0087] As an example, this step may include the following steps:
[0088] In the first step, a preserved egg surface area is randomly selected from the above-mentioned preserved egg surface area set as a reference surface area.
[0089] In the second step, based on the information entropy of the appearance shape characteristics corresponding to all the preserved egg surface areas in the above-mentioned preserved egg surface area set, and the difference between the appearance shape characteristics corresponding to the reference surface area and other preserved egg surface areas in the above-mentioned preserved egg surface area set, determine the appearance abnormality index corresponding to the above-mentioned batch of preserved egg finished products to be tested.
[0090] For example, the formula corresponding to the appearance abnormality index of the finished product of the batch of preserved eggs to be tested can be:
[0091] W = W1 × W2;
[0092] Among them, W is the appearance abnormality index corresponding to the finished products of the batch of preserved eggs to be tested. W1 is the information entropy of the appearance shape characteristics corresponding to all the surface areas of the preserved eggs in the set of surface areas of the preserved eggs. W2 is the appearance abnormality factor corresponding to the finished products of the batch of preserved eggs to be tested. N is the number of different appearance shape characteristics corresponding to all the surface areas of the preserved eggs in the set of surface areas of the preserved eggs. b is the serial number of different appearance shape characteristics corresponding to all the surface areas of the preserved eggs in the set of surface areas of the preserved eggs. n b is the number of Songhua egg surface regions in the Songhua egg surface region set whose corresponding appearance shape feature is equal to the bth appearance shape feature. n is the number of Songhua egg surface regions in the Songhua egg surface region set. Based on the natural constants The logarithm of . c is the serial number of the Songhua egg surface area in the Songhua egg surface area set except the reference surface area. E is the appearance shape feature corresponding to the reference surface area. E c is the appearance shape feature corresponding to the cth Songhua egg surface area in the Songhua egg surface area set except the reference surface area. || is the absolute value function.
[0093] It should be noted that the appearance shape distribution between the batches of Songhua eggs with higher quality is often more uniform. When W1 is larger, it often indicates that the appearance shape feature distribution between the finished products of the batch of Songhua eggs to be tested is more chaotic, which often indicates that the quality of the finished products of the batch of Songhua eggs to be tested is relatively poor. When W2 is larger, it often indicates that the appearance shape feature difference between the finished products of the batch of Songhua eggs to be tested is larger, which often indicates that the quality of the finished products of the batch of Songhua eggs to be tested is relatively poor. Therefore, when W is larger, it often indicates that the quality of the finished products of the batch of Songhua eggs to be tested is relatively poor.
[0094] Optionally, the formula corresponding to the appearance abnormality index W corresponding to the finished product of the batch of preserved eggs to be tested can also be:
[0095] W=W1×W2×W3; wherein W3 is the mean of the appearance shape features corresponding to all the preserved egg surface areas in the preserved egg surface area set.
[0096] It should be noted that, since the appearance shape feature corresponding to the surface area of the Songhua egg is larger, it often indicates that the outer surface quality of the Songhua egg represented by the surface area of the Songhua egg is worse. Therefore, when W3 is larger, it often indicates that the quality of the finished Songhua egg batch to be tested is relatively worse. Therefore, at this time, when W is larger, it also often indicates that the quality of the finished Songhua egg batch to be tested is relatively worse.
[0097] Step S5, segmenting the target internal image into the internal area of the preserved egg to obtain a set of internal areas of the preserved egg.
[0098] Among them, the preserved egg internal region in the preserved egg internal region set may be the region where the preserved egg is located in the target internal image.
[0099] It should be noted that the internal area of a preserved egg can represent the internal structure of a preserved egg.
[0100] As an example, the threshold segmentation technology can be used to segment the area where the preserved egg is located from the target internal image as the preserved egg internal area, thereby obtaining a preserved egg internal area set.
[0101] Optionally, the area where the preserved egg is located can be identified from the target internal image through neural network technology as the preserved egg internal area, thereby obtaining a preserved egg internal area set.
[0102] Step S6, performing a preserved egg internal shape analysis process on each preserved egg internal region in the preserved egg internal region set to obtain internal shape features corresponding to each preserved egg internal region.
[0103] It should be noted that since internal quality problems are often caused by internal deterioration of the preserved eggs, which leads to changes in the internal structure of the preserved eggs, performing internal shape analysis on the internal area of each preserved egg can facilitate understanding whether there are internal quality problems in the internal area of each preserved egg.
[0104] As an example, this step may include the following steps:
[0105] The first step is to segment the yolk area from the internal area of the preserved egg, and determine the centroid of the yolk area in the internal area of the preserved egg as the target centroid corresponding to the internal area of the preserved egg.
[0106] For example, the yolk region can be segmented from the inner region of the preserved egg by using threshold segmentation technology or neural network technology.
[0107] In the second step, taking the target centroid corresponding to the internal area of the above-mentioned preserved egg as the endpoint, a preset number of rays in different directions are made as reference rays to obtain a reference ray set corresponding to the internal area of the above-mentioned preserved egg.
[0108] The preset number may be a preset number greater than 1. For example, the preset number may be 50. It should be noted that the larger the preset number is, the more objective the internal shape features determined subsequently are. The reference ray set corresponding to the internal area of the preserved egg may include: a preset number of rays in different directions with the target centroid corresponding to the internal area of the preserved egg as the endpoint.
[0109] In the third step, the intersection point between each reference ray in the reference ray set corresponding to the above-mentioned inner area of the preserved egg and the boundary of the above-mentioned inner area of the preserved egg is determined as the first intersection point corresponding to each reference ray, and the intersection point between each reference ray and the boundary of the yolk area in the above-mentioned inner area of the preserved egg is determined as the second intersection point corresponding to each reference ray.
[0110] For example, for any internal area of a preserved egg, draw an arbitrary ray with the target center of mass corresponding to the internal area of the preserved egg as the endpoint, and use the ray as the first reference ray. The first intersection point corresponding to the first reference ray can be the intersection point between the first reference ray and the boundary of the internal area of the preserved egg, and the second intersection point corresponding to the first reference ray can be the intersection point between the first reference ray and the boundary of the yolk area in the internal area of the preserved egg.
[0111] In the fourth step, the distance between the first intersection point and the second intersection point corresponding to each reference ray in the reference ray set corresponding to the internal area of the preserved egg is determined as the target distance corresponding to each reference ray.
[0112] It should be noted that a target distance can represent the distance between the yolk boundary and the eggshell boundary of a preserved egg in a certain direction.
[0113] The fifth step, according to the target distances corresponding to all reference rays in the reference ray set corresponding to the inner region of the preserved egg, determining the inner shape features corresponding to the inner region of the preserved egg may include the following sub-steps:
[0114] In a first sub-step, a reference ray is randomly selected from a set of reference rays corresponding to the inner region of the preserved egg as a target ray corresponding to the inner region of the preserved egg.
[0115] In the second sub-step, the internal shape features corresponding to the above-mentioned inner area of the preserved egg are determined based on the target distance difference between the target ray and other reference rays in the reference ray set corresponding to the above-mentioned inner area of the preserved egg, and the area ratio between the yolk area in the above-mentioned inner area of the preserved egg and the minimum circumscribed circle of the yolk area in the above-mentioned inner area of the preserved egg.
[0116] For example, the formula corresponding to the internal shape feature of the inner area of a preserved egg can be:
[0117] T m =T m1 ×T m2 ;
[0118] Among them, T mis the internal shape feature corresponding to the mth pine egg internal region in the pine egg internal region set. m is the sequence number of the pine egg internal region in the pine egg internal region set. m1 It is the first internal feature corresponding to the mth internal region of the preserved egg in the set of internal regions of the preserved egg. m2 It is the second internal feature corresponding to the mth internal region of the preserved egg in the set of internal regions of the preserved egg. m is the number of reference rays in the reference ray set corresponding to the mth pine egg internal region in the pine egg internal region set. f is the serial number of the reference ray in the reference ray set corresponding to the mth pine egg internal region in the pine egg internal region set, excluding the target ray. || is the absolute value function. D m is the target distance corresponding to the target ray corresponding to the mth pine egg internal area in the pine egg internal area set. mf It is the target distance corresponding to the fth reference ray in the reference ray set corresponding to the mth pine egg internal area in the pine egg internal area set, excluding the target ray. m1 is the area of the yolk region in the mth pine egg internal region in the pine egg internal region set, which can be represented by the number of pixels in the yolk region in the mth pine egg internal region. m2 It is the area of the minimum circumscribed circle of the yolk region in the mth preserved egg internal region in the set of preserved egg internal regions, and can be represented by the number of pixel points in the minimum circumscribed circle of the yolk region in the mth preserved egg internal region.
[0119] It should be noted that for high-quality preserved eggs, the egg skin is easy to peel, the skin and egg white are not adhered, and the yolk is slightly in the middle. m1 The smaller it is, the smaller the distance between the yolk boundary and the eggshell boundary at different positions in the internal area of the mth Songhua egg is, which often means that the yolk of the Songhua egg represented by the internal area of the mth Songhua egg is located in the middle, which often means that the internal structure of the Songhua egg represented by the internal area of the mth Songhua egg is relatively better. m2 The smaller the time, the more likely it is that The closer it is to 1, the closer the yolk of the Songhua egg represented by the internal area of the m-th Songhua egg is to a round shape, which means that the internal structure of the Songhua egg represented by the internal area of the m-th Songhua egg is relatively good. m The larger it is, the worse the internal structure of the songhua egg represented by the internal area of the m-th songhua egg is, and the worse the internal quality of the songhua egg represented by the internal area of the m-th songhua egg is.
[0120] Step S7, determining the internal abnormality index corresponding to the finished preserved egg batch to be tested based on the internal shape features corresponding to all the preserved egg internal regions in the preserved egg internal region set.
[0121] It should be noted that, based on the internal shape characteristics corresponding to the internal areas of all preserved eggs, the quantified internal abnormality indicators corresponding to the finished preserved eggs in the batch to be tested can characterize the overall internal quality characteristics of the finished preserved eggs in the batch to be tested.
[0122] As an example, this step may include the following steps:
[0123] In the first step, a pine egg internal region is randomly selected from the above pine egg internal region set as the target internal region.
[0124] In the second step, according to the difference in internal shape characteristics between the target internal area and other internal areas of the Songhua egg in the above Songhua egg internal area set, the formula corresponding to the internal abnormality index corresponding to the above-mentioned batch of Songhua egg finished products to be tested is determined as follows:
[0125] H = H1 × H2;
[0126] H2=|L1-L2|; where H is the internal abnormality index corresponding to the finished product batch of Songhua eggs to be tested. H1 is the first internal abnormality feature corresponding to the finished product batch of Songhua eggs to be tested. H2 is the second internal abnormality feature corresponding to the finished product batch of Songhua eggs to be tested. R is the number of Songhua egg internal regions in the Songhua egg internal region set. k is the serial number of the Songhua egg internal region in the Songhua egg internal region set except the target internal region. || is the absolute value function. T is the internal shape feature corresponding to the target internal region. T k It is the internal shape feature corresponding to the kth Songhua egg internal area in the Songhua egg internal area set, except the target internal area. L1 is the mean of the grayscale values corresponding to all pixels in the yolk area of all Songhua egg internal areas in the Songhua egg internal area set. L2 is the mean of the grayscale values corresponding to all pixels in the yolk area of the standard Songhua egg obtained in advance. The method for obtaining the standard Songhua egg yolk area can be: by X-ray or ultrasonic acquisition, an image of a Songhua egg of qualified quality is collected, and the yolk area in the image is determined as the standard Songhua egg yolk area.
[0127] It should be noted that the internal structure distribution between batches of Songhua eggs with higher quality is often more uniform. When H1 is larger, it often means that the difference in internal shape characteristics between the finished Songhua eggs in the batches to be tested is greater, which often means that the quality of the finished Songhua eggs in the batches to be tested is relatively worse. Since the yolk colors of Songhua eggs that have not deteriorated are often similar, when H2 is larger, it often means that the yolk color of the finished Songhua eggs in the batches to be tested deviates more from the yolk color of Songhua eggs that have not deteriorated, which often means that the quality of the finished Songhua eggs in the batches to be tested is less than expected, which often means that the quality of the finished Songhua eggs in the batches to be tested is relatively worse. Therefore, when H is larger, it often means that the quality of the finished Songhua eggs in the batches to be tested is relatively worse.
[0128] Step S8, determining the target abnormality index corresponding to the finished product of the batch of preserved eggs to be tested according to the appearance abnormality index and the internal abnormality index.
[0129] Among them, the above-mentioned appearance abnormality index and the above-mentioned internal abnormality index can both be positively correlated with the above-mentioned target abnormality index.
[0130] It should be noted that, based on the appearance abnormality index and the internal abnormality index, the target abnormality index corresponding to the quantified batch of preserved eggs to be tested can characterize the overall internal and external quality characteristics of the batch of preserved eggs to be tested.
[0131] As an example, the product of the appearance anomaly index and the internal anomaly index may be normalized to obtain a target anomaly index.
[0132] Step S9, performing quality inspection on the finished preserved eggs of the batch to be inspected according to the target abnormality index.
[0133] It should be noted that, based on the target abnormality indicators, quality inspection was carried out on the finished Songhua eggs in the batch to be inspected, thus realizing the quality inspection of the finished Songhua eggs in the batch to be inspected.
[0134] As an example, this step may include the following steps:
[0135] The first step is to determine that the quality of the finished product of the above batch of preserved eggs to be tested is unqualified when the above target abnormal index is greater than the preset abnormal threshold.
[0136] The preset abnormality threshold may be a preset threshold, for example, the preset abnormality threshold may be 0.6.
[0137] In the second step, when the above target abnormal index is less than or equal to the preset abnormal threshold, the quality of the finished product of the above batch of preserved eggs to be tested is determined to be qualified.
[0138] Optionally, when the quality of the finished preserved eggs in the batch to be tested is determined to be unqualified, the detection system can sound an alarm and record it at the same time. A link can be set up for manual re-inspection to conduct a second confirmation of the unqualified samples to ensure the accuracy of the test results.
[0139] In summary, compared with the quality inspection of preserved eggs based on the difference in grayscale values in the collected surface image of the object, the present invention comprehensively considers the appearance and internal shape of the preserved eggs, thereby improving the accuracy of the quality inspection of the finished products of the batch of preserved eggs to be inspected.
[0140] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for automated visual inspection of the quality of finished Songhua eggs, characterized in that: The following steps are involved: Obtain a target surface image and a target internal image corresponding to the finished product of the batch of preserved eggs to be tested; Performing pine egg surface region segmentation on the target surface image to obtain a pine egg surface region set; Performing appearance shape analysis processing on each pine egg surface area in the pine egg surface area set to obtain appearance shape features corresponding to each pine egg surface area; Determine the appearance abnormality index corresponding to the finished product of the batch of preserved eggs to be tested according to the appearance shape characteristics corresponding to all the preserved egg surface areas in the preserved egg surface area set; Segmenting the target internal image into the internal region of the preserved egg to obtain a set of internal regions of the preserved egg; Performing a Songhua egg internal shape analysis process on each Songhua egg internal region in the Songhua egg internal region set to obtain an internal shape feature corresponding to each Songhua egg internal region; Determine the internal abnormality index corresponding to the finished product of the batch of preserved eggs to be tested according to the internal shape characteristics corresponding to all the internal areas of the preserved eggs in the set of internal areas of the preserved eggs; Determine the target abnormality index corresponding to the batch of preserved eggs to be tested according to the appearance abnormality index and the internal abnormality index; According to the target abnormality index, quality inspection is performed on the finished products of the batch of preserved eggs to be inspected; The performing of appearance shape analysis processing on each pine egg surface area in the pine egg surface area set to obtain the appearance shape features corresponding to each pine egg surface area includes: Determine the ratio of the boundary length of the pine egg surface area to the area of the pine egg surface area as the contour coefficient corresponding to the pine egg surface area; Performing edge detection on the surface area of the preserved egg to obtain an initial edge set corresponding to the surface area of the preserved egg; The number of initial edges in the initial edge set is determined as the number of edge lines corresponding to the surface area of the preserved egg; The slope of the line between each two adjacent pixels on each initial edge is used as the reference slope between the two pixels to obtain a reference slope set corresponding to each initial edge; Determine the appearance shape feature corresponding to the surface area of the preserved egg according to the reference slope set corresponding to all initial edges in the initial edge set corresponding to the surface area of the preserved egg, the contour coefficient and the number of edge lines corresponding to the surface area of the preserved egg; The formula corresponding to the appearance shape characteristics of the surface area of the preserved egg is: Among them, E r is the appearance shape feature corresponding to the rth Songhua egg surface region in the Songhua egg surface region set; r is the sequence number of the Songhua egg surface region in the Songhua egg surface region set; E r1 is the first appearance feature corresponding to the rth Songhua egg surface area in the Songhua egg surface area set; E r2 is the second appearance feature corresponding to the rth Songhua egg surface area in the Songhua egg surface area set; | | is the absolute value function; p r is the silhouette coefficient corresponding to the rth Songhua egg surface area in the Songhua egg surface area set; p is the pre-acquired standard silhouette coefficient; G r is the number of edge lines corresponding to the rth Songhua egg surface area in the Songhua egg surface area set; n r is the number of pixels in the rth Songhua egg surface area in the Songhua egg surface area set; i and j are the serial numbers of the pixels in the rth Songhua egg surface area in the Songhua egg surface area set; I ri is the gray value corresponding to the i-th pixel point in the r-th Songhua egg surface area in the Songhua egg surface area set; I rj is the gray value corresponding to the jth pixel point in the rth Songhua egg surface area in the Songhua egg surface area set; a is the sequence number of the initial edge in the initial edge set corresponding to the rth Songhua egg surface area in the Songhua egg surface area set; σ ra is the variance of the reference slope set corresponding to the rth Songhua egg surface area in the Songhua egg surface area set; Determining the appearance abnormality index corresponding to the batch of preserved egg finished products to be tested according to the appearance shape features corresponding to all the preserved egg surface areas in the preserved egg surface area set includes: Randomly select a pine egg surface area from the pine egg surface area set as a reference surface area; Determine the appearance abnormality index corresponding to the finished product of the batch of preserved eggs to be tested according to the information entropy of the appearance shape features corresponding to all the preserved egg surface areas in the preserved egg surface area set, and the difference between the appearance shape features corresponding to the reference surface area and other preserved egg surface areas in the preserved egg surface area set; The formula corresponding to the abnormal appearance index of the finished product of the batch of Songhua eggs to be tested is: Among them, W is the appearance abnormality index corresponding to the finished products of the batch of Songhua eggs to be tested; W1 is the information entropy of the appearance shape characteristics corresponding to all Songhua egg surface areas in the Songhua egg surface area set; W2 is the appearance abnormality factor corresponding to the finished products of the batch of Songhua eggs to be tested; N is the number of different appearance shape characteristics corresponding to all Songhua egg surface areas in the Songhua egg surface area set; b is the serial number of different appearance shape characteristics corresponding to all Songhua egg surface areas in the Songhua egg surface area set; n b is the number of Songhua egg surface regions in the Songhua egg surface region set whose corresponding appearance shape feature is equal to the bth appearance shape feature; n is the number of Songhua egg surface regions in the Songhua egg surface region set; Based on the natural constants The logarithm of ; c is the serial number of the Songhua egg surface area in the Songhua egg surface area set except the reference surface area; E is the appearance shape feature corresponding to the reference surface area; E c is the appearance shape feature corresponding to the cth Songhua egg surface area in the Songhua egg surface area set except the reference surface area; | | is the absolute value function; The step of performing a Songhua egg internal shape analysis process on each Songhua egg internal region in the Songhua egg internal region set to obtain an internal shape feature corresponding to each Songhua egg internal region includes: Segmenting the yolk region from the inner region of the Songhua egg, and determining the centroid of the yolk region in the inner region of the Songhua egg as the target centroid corresponding to the inner region of the Songhua egg; Taking the target mass center corresponding to the inner area of the preserved egg as an endpoint, a preset number of rays in different directions are made as reference rays to obtain a reference ray set corresponding to the inner area of the preserved egg; Determine the intersection point between each reference ray in the reference ray set corresponding to the inner region of the Songhua egg and the boundary of the inner region of the Songhua egg as the first intersection point corresponding to each reference ray, and determine the intersection point between each reference ray and the boundary of the yolk region in the inner region of the Songhua egg as the second intersection point corresponding to each reference ray; Determine the distance between the first intersection point and the second intersection point corresponding to each reference ray in the reference ray set corresponding to the inner area of the preserved egg as the target distance corresponding to each reference ray; Determine the internal shape feature corresponding to the internal area of the preserved egg according to the target distances corresponding to all reference rays in the reference ray set corresponding to the internal area of the preserved egg; The step of determining the internal shape feature corresponding to the internal area of the preserved egg according to the target distances corresponding to all reference rays in the reference ray set corresponding to the internal area of the preserved egg comprises: Randomly select a reference ray from the reference ray set corresponding to the inner area of the preserved egg as the target ray corresponding to the inner area of the preserved egg; Determine the internal shape feature corresponding to the inner area of the preserved egg according to the target distance difference between the target ray and other reference rays in the reference ray set corresponding to the inner area of the preserved egg, and the area ratio between the yolk area in the inner area of the preserved egg and the minimum circumscribed circle of the yolk area in the inner area of the preserved egg; Determining the internal abnormality index corresponding to the batch of preserved eggs to be tested according to the internal shape features corresponding to all the preserved egg internal regions in the preserved egg internal region set includes: Randomly select a pine egg internal region from the pine egg internal region set as the target internal region; According to the difference in internal shape characteristics between the target internal area and other internal areas of the preserved egg in the set of preserved egg internal areas, the formula corresponding to the internal abnormality index corresponding to the finished preserved egg batch to be tested is determined as follows: H2=|L1-L2|; where H is the internal abnormality index corresponding to the finished product of the batch of Songhua eggs to be tested; H1 is the first internal abnormality feature corresponding to the finished product of the batch of Songhua eggs to be tested; H2 is the second internal abnormality feature corresponding to the finished product of the batch of Songhua eggs to be tested; R is the number of Songhua egg internal regions in the Songhua egg internal region set; k is the serial number of the Songhua egg internal region in the Songhua egg internal region set except the target internal region; | | is the absolute value function; T is the internal shape feature corresponding to the target internal region; T k It is the internal shape feature corresponding to the kth preserved egg internal area in the set of preserved egg internal areas, excluding the target internal area; L1 is the mean of the grayscale values corresponding to all pixels in the yolk area of all preserved egg internal areas in the set of preserved egg internal areas; L2 is the mean of the grayscale values corresponding to all pixels in the yolk area of the standard preserved egg obtained in advance.
2. The method for automated visual inspection of the quality of finished Songhua eggs according to claim 1, characterized in that: The appearance abnormality index and the internal abnormality index are both positively correlated with the target abnormality index.
3. The method for automated visual inspection of the quality of finished Songhua eggs according to claim 1, characterized in that: The method of performing quality inspection on the batch of preserved eggs to be inspected according to the target abnormality index comprises: When the target abnormality index is greater than a preset abnormality threshold, it is determined that the quality of the finished product of the batch of preserved eggs to be tested is unqualified; When the target abnormality index is less than or equal to the preset abnormality threshold, it is determined that the quality of the finished product of the batch of preserved eggs to be tested is qualified.
Citation Information
Patent Citations
Device and method for nondestructively detecting egg quality based on DSP (Dynamic Signal Processing) machine vision
CN102445456A
Nondestructive visual inspection grading method for internal quality of preserved eggs
CN110006899A
Preserved egg internal quality nondestructive testing method based on machine vision
CN112816487A
Nondestructive testing method for boiler pressure pipeline based on image processing
CN115526889A
Automatic hatching egg recognition system and method
CN117475292A
