An intelligent detection method for pig hair removal
By analyzing the grayscale images and performing clustering processing on the surface of raw pig skin, residual pig hair is identified and removed, solving the problem of hair detection on the surface of raw pork and ensuring food safety and visual quality.
Patent Information
- Application Number
- CN202510855731.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-06-25
AI Technical Summary
Existing technologies make it difficult to effectively detect and remove residual pig hair on the surface of raw pork, leading to food safety and hygiene issues.
By obtaining the grayscale image of the raw pig skin surface and clustering it using the eigenvalues and color features of the pixels, the residual pig hair and other surface features can be identified and distinguished, thus realizing intelligent detection and reprocessing of the pig hair.
Accurately identify and remove residual pig hair on the surface of raw pigskin to improve food safety and visual quality.
Smart Images

Figure CN120374614B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image data processing technology, and in particular to an intelligent detection method for pig hair removal. Background Art
[0002] Pig hair may carry contaminants such as bacteria and parasites. During the slaughtering, processing and transportation of raw pork, the bacteria, parasites and other contaminants in the pig hair may fall off and contaminate the meat, affecting food safety and consumer health. Pig hair may also have an odor, affecting the taste and flavor of the processed pork. Therefore, it is necessary to remove the pig hair on the surface of the pork.
[0003] The hair on the outer surface of the pigskin of raw pork can be removed by tumbling, scalding, flame and chemical depilation.
[0004] For example, the pigs can be soaked in chemicals such as sodium hydroxide solution to dissolve and remove the hair; alternatively, a tumbler with rubber protrusions or chains can be used to remove the hair on the surface of the pigs through mechanical friction; alternatively, the pigs can be soaked in hot water to expand the hair follicles, thereby loosening the hair on the surface of the pigs, and removing the hair on the surface of the pigs mechanically.
[0005] After the hair removal process is completed, some residual hair may still remain on the surface of the pig. The residual hair may still carry pollutants such as bacteria and parasites. The residual hair may cause allergic reactions in some people, and the residual hair may affect the cleanliness and appearance of the pork surface. Therefore, it is necessary to test the pigs after the hair removal process to determine whether there is any residual hair on the surface of the pigs after the hair removal process. Summary of the Invention
[0006] In order to determine whether there is residual pig hair on the surface of a pig after depilation, the present application provides an intelligent detection method for pig depilation, comprising: obtaining a grayscale image of the outer surface of the pig skin after depilation, and determining a first eigenvalue of a target pixel point in the grayscale image; the first eigenvalue is at least used to characterize the difference between the average grayscale value of the grayscale image and the grayscale value of the target pixel point; determining a target line with the target pixel point as the starting point from the grayscale image, and obtaining a consistency value between the pixel area of the target line and the area of the minimum circumscribed rectangle of the target line; the adjacent pixels on the target line are The difference in grayscale value of the points is less than a preset difference threshold; the second eigenvalue of the target pixel is determined; the second eigenvalue is used to characterize the smoothness of the change of the grayscale value within the neighborhood of the target pixel, and the probability value of the target pixel belonging to the residual pig hair is determined according to the product of the first eigenvalue, the second eigenvalue and the consistency value; the pixels in the grayscale image are clustered according to the probability value of the pixel in the grayscale image and the color characteristics of the pixel in the grayscale image in the visible light image of the outer surface of the pigskin, and the detection result of the residual pig hair on the outer surface of the pigskin is determined according to the clustering result.
[0007] In this way, by clustering the probability value of the pixel points belonging to the residual pig hair and the color characteristics of the pixel points in the visible light image of the raw pig skin, the residual pig hair can be more accurately determined from the outer surface of the pig skin after depilation.
[0008] Optionally, the first eigenvalue of the target pixel is determined by: , where T is the first eigenvalue of the target pixel, norm is the normalization function, is the grayscale value of the target pixel, is the average grayscale value of the grayscale image, exp is an exponential function with a natural constant as the base, and R is the variance of the grayscale values of pixels in the neighborhood of the target pixel.
[0009] In this way, since the variance of the grayscale value in the neighborhood of the pixel point where noise exists is larger, the influence of noise in the grayscale image can be avoided by using the first eigenvalue of the target pixel point.
[0010] Optionally, the second eigenvalue of the target pixel is determined by: , where D is the second eigenvalue of the target pixel; F is the information entropy of the grayscale values of the pixels in the neighborhood of the target pixel, which is used to characterize the complexity of the grayscale values of the pixels in the neighborhood; is a second preset positive number, exp is an exponential function with a natural constant as the base, and M is the range of the grayscale values of pixels in the neighborhood of the target pixel.
[0011] In this way, by comparing the information entropy of the grayscale value in the neighborhood range with the range of the pixels in the neighborhood range, the second eigenvalue can reflect the gradual characteristics of the pixels in the neighborhood range of the target pixel.
[0012] Optionally, the information entropy is determined by: , where F is the information entropy, n is the number of types of grayscale values of pixels within the neighborhood of the target pixel, is the frequency ratio of the i-th gray value within the neighborhood of the target pixel point, is a logarithmic function with a natural constant as its base.
[0013] Optionally, the target line with the target pixel point as the starting point is determined in the following manner: the pixel point with the smallest difference in grayscale value between the target pixel point and the target pixel point within the neighborhood of the target pixel point is selected as the first extended pixel point; the pixel point with the grayscale value difference between the first extended pixel point and the target pixel point within the neighborhood of the first extended pixel point and the target pixel point is less than a preset difference threshold value as the next extended pixel point; when the differences in grayscale value between the pixels within the neighborhood of the extended pixel point and the extended pixel point are both greater than or equal to the preset difference threshold value, the determination of the extended pixel points is stopped to connect all the extended pixel points to obtain the target line corresponding to the target pixel point.
[0014] In this way, extended pixels having the same or similar grayscale values as the target pixel are determined with the target pixel as the starting point, thereby obtaining multiple extended pixels, which can facilitate use of the target line to determine whether the target pixel belongs to residual pig hair.
[0015] Optionally, the consistency value corresponding to the target pixel is determined by: , where W is the consistency value corresponding to the target pixel, and exp is an exponential function with a natural constant as the base. is the pixel area of the target line corresponding to the target pixel point, is the area of the minimum circumscribed rectangle of the target line corresponding to the target pixel point, The first preset positive number.
[0016] In this way, since the shape characteristics of the target lines determined by the residual pig hair or the wrinkles of the pig skin are different, the consistency between the pixel area of the target line and the area of the minimum circumscribed rectangle of the target line can be used to distinguish between the residual pig hair and the wrinkled part or texture part in the pig skin.
[0017] Optionally, the probability value of the target pixel point belonging to the residual pig hair is determined based on the product of the third eigenvalue and the consistency value, including: taking the product of the third eigenvalue and the consistency value as the target product, and normalizing the target product as the probability value of the target pixel point belonging to the residual pig hair.
[0018] Optionally, clustering the pixels in the grayscale image includes: using the pixel values of the red channel, green channel, and blue channel of the target pixel in the grayscale image in the visible light image of the outer surface of the pigskin as the first clustering dimension, second clustering dimension, and third clustering dimension of the target pixel, respectively; and performing mean shift clustering on the pixels in the grayscale image according to the probability value of the pixel in the grayscale image, the first clustering dimension, the second clustering dimension, and the third clustering dimension.
[0019] Optionally, the clustering result includes multiple clusters, and the detection result of residual pig hair in the outer surface of pig skin is determined based on the clustering result, including: taking the average value of the probability values of all pixel points in the cluster as the evaluation value of the cluster; taking the cluster with an evaluation value greater than a preset probability threshold as the target cluster where the residual pig hair is located; and taking the area composed of the pixel points included in the target cluster as the target defect area where the residual pig hair is located.
[0020] Optionally, the method further includes: when the detection result indicates that there are residual pig hairs on the outer surface of the pig skin, controlling the pig hair processing equipment to perform dehairing on the outer surface of the pig skin again.
[0021] The technical solution provided by the embodiments of the present application may include the following beneficial effects: for the target pixel point in the grayscale image of the outer surface of the pig skin after depilation, a target line with the target pixel point as the starting point can be determined, and the difference in grayscale value between adjacent pixels on the target line is less than a preset difference threshold; since the shape characteristics of the target line of pixels in other areas other than pig hair and the surface of pork are different, by obtaining the consistency value of the pixel area of the target line and the area of the minimum circumscribed rectangle of the target line, combined with the determined first eigenvalue and the second eigenvalue, the probability that the target pixel point belongs to residual pig hair can be more comprehensively evaluated; clustering is performed using the probability value and color characteristics of the pixel points, so as to obtain a more accurate detection result of the residual pig hair on the outer surface of the pig skin.
[0022] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 The present invention is a flowchart of an intelligent detection method for pig hair removal according to an exemplary embodiment. DETAILED DESCRIPTION
[0024] First, a brief introduction to the application scenario of the embodiment of the present application is given. In the application scenario of the present application, after the pig hair on the surface of the pig is dehaired, there may be some residual pig hair on the surface of the pig. The residual pig hair will affect the hygiene and appearance of the pork. Therefore, it is necessary to test the surface of the pork that has been dehaired to determine whether there is any residual pig hair on the surface of the pork after the dehairing treatment.
[0025] In response to the above technical problems, the present invention provides an intelligent detection method for pig hair removal. Figure 1 This is a flow chart of an intelligent detection method for pig hair loss according to an exemplary embodiment. Figure 1 As shown, the method includes the following steps.
[0026] In step S101, a grayscale image of the outer surface of the depilated pigskin is obtained, and a first eigenvalue of a target pixel in the grayscale image is determined.
[0027] In order to avoid the adverse effects of possible stains on the outer surface of the pigskin on subsequent test results, the surface of the pigs to be tested can be cleaned in advance.
[0028] An image acquisition device can be used to obtain a visible light image of the outer surface of the pig skin after depilation, and a grayscale image can be obtained by grayscale processing of the visible light image. The grayscale image of the outer surface of the pig skin may contain the surface texture of the pig skin, wrinkles of the pig skin, and residual pig hair due to incomplete depilation.
[0029] Pig hair and pig skin have different light reflectivity, and there are also certain differences in the color characteristics of pig hair and pig skin itself. After the depilation treatment on the outer surface of the pig skin, most of the pig hair on the outer surface of the pig skin has been removed. Compared with the pixel points corresponding to the pig skin itself in the grayscale image, the number of residual pig hair that may exist in the grayscale image is smaller, and the difference between the residual pig hair and the pixel points corresponding to the pig skin itself in the grayscale image is more obvious.
[0030] The target pixel point can be any pixel point among all the pixel points of the grayscale image; the first eigenvalue is used to at least characterize the difference between the average grayscale value of the grayscale image and the grayscale value of the target pixel point; the average grayscale value of the grayscale image can reflect the overall grayscale value of the surface of the pig skin. Since the amount of pig hair on the surface of the pig skin after depilation is less, the greater the difference between the grayscale value of the target pixel point and the average grayscale value of the entire grayscale image, the more likely the target pixel point is to be located at the location of residual pig hair.
[0031] In one embodiment, the first eigenvalue of the target pixel is determined by: , where T is the first eigenvalue of the target pixel, norm is the normalization function, is the grayscale value of the target pixel, is the average grayscale value of the grayscale image, exp is an exponential function with a natural constant as the base, and R is the variance of the grayscale values of pixels in the neighborhood of the target pixel.
[0032] In a grayscale image of the outer surface of a depilated pigskin, pixels corresponding to pigskin texture, residual pig hair, or pigskin wrinkles in the grayscale image usually have other pixels of the same type in their neighborhood.
[0033] For example, for a certain pixel point corresponding to residual pig hair in a grayscale image, due to the continuity of the pig hair, there are usually other pixel points corresponding to the pig hair within the neighborhood of the pixel point corresponding to the pig hair.
[0034] In the grayscale image of the outer surface of the pig skin after hair removal, there may be some noise pixels. The positions of these noise pixels in the grayscale image are scattered and may appear at different positions in the grayscale image. The pixel values of the noise pixels are random.
[0035] For noise pixels that may exist in a grayscale image, due to the randomness and dispersion of the noise pixels, there are usually no other pixels with the same or similar grayscale values in the neighborhood of the noise pixels, which makes the variance of the grayscale values of the pixels in the neighborhood of the noise pixels larger.
[0036] Compared with the noise pixels that may exist in the grayscale image, the variance of the grayscale values in the neighborhood of the pixel points corresponding to the pig hair in the grayscale image is smaller. Therefore, a first eigenvalue larger than the noise pixel can be determined to achieve the distinction between noise pixels and non-noise pixels, thereby avoiding the influence of the noise that may exist in the grayscale image on the detection results.
[0037] Since the residual pig hair is more prominent in the entire grayscale image, the difference between the grayscale value of the pixel corresponding to the pig hair in the grayscale image and the average grayscale value of the entire grayscale image is greater. Therefore, the greater the difference between the grayscale value of the target pixel and the average grayscale value of the entire grayscale image, the more likely the target pixel corresponds to the residual pig hair that may exist on the outer surface of the pig skin.
[0038] In this way, the first eigenvalue of the target pixel can reflect the probability that the target pixel belongs to the residual pig hair that may exist in the grayscale image, and can also avoid the influence of noise pixels that may exist in the grayscale image.
[0039] In step S103 , the second eigenvalue of the target pixel is determined, and the product of the first eigenvalue and the second eigenvalue is used as the third eigenvalue.
[0040] The second eigenvalue is used to characterize the smoothness of the change in grayscale value within the neighborhood of the target pixel point; there may be some image areas in the outer skin of raw pork with the same or similar grayscale value as the residual pig hair. However, the grayscale value changes of the pixels in these image areas with the same or similar grayscale values as the pig hair are different from the grayscale value changes of the pixels in the area where the pig hair is located. Therefore, the second eigenvalue can be used to distinguish between the residual pig hair and the parts with the same or similar grayscale values as the residual pig hair but not belonging to the pig hair.
[0041] In one embodiment, the second eigenvalue of the target pixel is determined by: , where D is the second eigenvalue of the target pixel; F is the information entropy of the grayscale values of the pixels in the neighborhood of the target pixel, which is used to characterize the complexity of the grayscale values of the pixels in the neighborhood; is a second preset positive number, exp is an exponential function with a natural constant as the base, and M is the range of the grayscale values of pixels in the neighborhood of the target pixel.
[0042] The extreme difference in the grayscale values of the pixels within the neighborhood of the target pixel can reflect the contrast of the pixels within the neighborhood of the target pixel. Compared with the grayscale value of the surface of raw pork that is similar to pig hair but does not belong to pig hair, the grayscale value change of the residual pig hair in the grayscale image is more gradual. Therefore, the second eigenvalue can eliminate the influence of the grayscale value of the residual pig hair in the grayscale image that is similar to the residual pig hair but does not actually belong to the residual pig hair.
[0043] The information entropy of the grayscale values of pixels in the neighborhood of the target pixel can characterize the complexity of the grayscale values of the pixels in the neighborhood. If the complexity of the grayscale values of the pixels in the neighborhood of the target pixel is higher and the range of the grayscale values of the pixels is smaller, it means that the change of the grayscale values of the pixels in the neighborhood of the target pixel is more consistent with the gradual characteristics of the residual pig hair.
[0044] The second preset positive number can be a positive number smaller than 1, such as 0.01 or 0.02. The second preset positive number is used to ensure that the two multiplied parts in the second eigenvalue are at least greater than 0, avoiding the situation where the calculation is meaningless due to the presence of at least one 0 in the two multiplied parts.
[0045] When the range of the grayscale values of the pixels in the neighborhood of the target pixel is the same, the lower the gradient of the grayscale values of the pixels in the neighborhood will make the number of types of grayscale values of the pixels in the neighborhood with the same range smaller. The neighborhood with fewer types may correspond to a smaller information entropy, making the value of the second eigenvalue smaller. Therefore, the second eigenvalue can better characterize the degree of gradient of the grayscale values in the neighborhood of the pixel.
[0046] In this way, by comparing the information entropy of the grayscale values in the neighborhood range and the range of the pixels in the neighborhood range, the second eigenvalue obtained can reflect the gradient characteristics of the pixels in the neighborhood range of the target pixel point, thereby evaluating the degree or probability that the target pixel point belongs to residual pig hair.
[0047] In one embodiment, the information entropy is determined by: , where F is the information entropy, n is the number of types of grayscale values of pixels within the neighborhood of the target pixel, is the frequency ratio of the i-th gray value within the neighborhood of the target pixel point, is a logarithmic function with a natural constant as its base.
[0048] The frequency ratio of the grayscale value in the neighborhood range of the target pixel is a positive number less than 1. Therefore, the logarithmic operation result of the frequency ratio of the logarithmic function with the natural constant as the base is less than 0. The negative sign in the information entropy calculation formula can ensure that the obtained information entropy value is positive.
[0049] The more types of grayscale values appear in the neighborhood of the target pixel, or the greater the difference in the frequency ratio of different grayscale values, the greater the information entropy of the grayscale values in the neighborhood of the target pixel. Therefore, the information entropy can better characterize the complexity of the grayscale values of the pixels in the neighborhood of the target pixel.
[0050] Since the first eigenvalue can reflect the difference between the target pixel and the overall grayscale value of all pixels in the grayscale image, and the first eigenvalue can avoid the influence of noise pixels that may exist in the grayscale image; the second eigenvalue can realize the distinction between residual pig hair in the grayscale image and pixels that have similar grayscale performance to the residual pig hair but do not belong to the residual pig hair.
[0051] The product of the first eigenvalue and the second eigenvalue is used as the third eigenvalue. The third eigenvalue can better integrate the effects of the first eigenvalue and the second eigenvalue, so as to better determine the image area where the residual pig hair is located from the grayscale image using the third eigenvalue.
[0052] In step S103 , a target line starting from the target pixel point is determined from the grayscale image, and a consistency value between the pixel area of the target line and the area of the minimum circumscribed rectangle of the target line is obtained.
[0053] The difference in grayscale values between adjacent pixels on the target line is less than a preset difference threshold.
[0054] Since the pig hair in the raw pig skin has been depilated, the residual pig hair is more isolated in the outer skin of the raw pig, so that in the grayscale image of the outer surface of the depilated raw pig skin, the residual pig hair appears as a continuous single line. Since the difference in grayscale value between adjacent pixels on the target line is less than the preset difference threshold, when the target pixel point is the pixel point corresponding to the residual pig hair, the obtained target line is usually a simpler single line.
[0055] In the grayscale image of the outer surface of a depilated pigskin, the features of the texture of the pigskin are more diverse than those of the residual hair. The texture of the pigskin may appear as more complex tree-like lines or mesh lines; or, there may be some wrinkles on the surface of the pigskin, which usually also appear as tree-like lines.
[0056] Since the difference in grayscale value between adjacent pixels on the target line is less than the preset difference threshold, when the target pixel is a pixel corresponding to the pigskin texture part or the wrinkled part, the obtained target line is usually a more complex tree-like or mesh-like line.
[0057] Since the line features of the residual pig hair are simpler, when the target pixel corresponds to the residual pig hair, the outer contour feature of the target line corresponding to the target pixel is more consistent with the minimum circumscribed rectangle of the target line.
[0058] Since the line features of the pigskin texture or wrinkle part are more complex, when the target pixel point corresponds to the pigskin texture or wrinkle part, the outer contour features of the target line corresponding to the target pixel point are more different from the minimum circumscribed rectangle of the target line.
[0059] Since the shape characteristics of the residual pig hair that may exist on the surface of the raw pig skin are simpler, while the line characteristics of the texture part or the wrinkled part of the pig skin are more complex, therefore, obtaining the consistency value between the pixel area of the target line and the area of the minimum circumscribed rectangle of the target line can facilitate the determination of the possible residual pig hair from the grayscale image through the consistency value.
[0060] In one embodiment, a target line starting from a target pixel point is determined in the following manner: the pixel point with the smallest difference in grayscale value between the target pixel point and the target pixel point in the neighborhood range is selected as the first extended pixel point; the pixel point with the smallest difference in grayscale value between the first extended pixel point and the target pixel point in the neighborhood range is selected as the next extended pixel point; when the differences in grayscale value between the pixels in the neighborhood range of the extended pixel point and the extended pixel point are all greater than or equal to the preset difference threshold, the determination of the extended pixel points is stopped, so as to connect all the extended pixel points to obtain the target line corresponding to the target pixel point.
[0061] The size of the neighborhood range can be in the range of 3×3, 5×5, and 7×7. The preset difference threshold can be set according to actual needs. For example, the preset difference threshold can be between 5 and 20, and two adjacent pixels with a grayscale value difference of less than 5 can be divided into the same target line.
[0062] For a target pixel in a grayscale image, if there are other pixels in the neighborhood of the target pixel whose grayscale values are less different from those of the target pixel, then the pixel with the smallest grayscale value difference from the target pixel among the other pixels in the neighborhood can be used as the first extended pixel of the target pixel.
[0063] On the contrary, since pig hair is usually a continuous single line, if there are no other pixels with a small difference in grayscale value from the target pixel in the neighborhood of the target pixel, it means that the target pixel has a high probability of corresponding to other parts of the pig skin other than the residual pig hair. A smaller consistency value can be determined for the target pixel, for example, the consistency value corresponding to the target pixel can be set to 0.
[0064] Since the length of pig hair is usually within a certain range, and in order to avoid the target line length determination process resulting in a long target line determination time, the target line can be determined based on the obtained extended pixel points when the number of obtained extended pixel points is greater than or equal to a preset number threshold, and the extended pixel point determination process can be stopped.
[0065] In this way, taking the target pixel point as the starting point, by determining the extended pixel points with the same or similar grayscale values as the target pixel point, and thereby obtaining multiple extended pixel points, the difference in grayscale values between adjacent pixel points can be made within the preset difference threshold, so that the target line can be used to determine whether the target pixel point is on the residual pig hair.
[0066] In one embodiment, the consistency value corresponding to the target pixel is determined by: , where W is the consistency value corresponding to the target pixel, and exp is an exponential function with a natural constant as the base. is the pixel area of the target line corresponding to the target pixel point, is the area of the minimum circumscribed rectangle of the target line corresponding to the target pixel point, The first preset positive number.
[0067] The closer it is to 1, the closer the pixel area of the target line corresponding to the target pixel point is to the area of the minimum circumscribed rectangle of the target line corresponding to the target pixel point. Since the pixel area of the pig hair line is more consistent with the area of the minimum circumscribed rectangle, a larger consistency value can be determined for the pixel points belonging to the pig hair, and a smaller consistency value can be determined for the pixel points belonging to the pig skin texture or wrinkles in the raw pig skin, thereby achieving the distinction between the pixel points where the residual pig hair is located in the grayscale image and the pixel points belonging to the pig skin texture or wrinkles.
[0068] The first preset positive number may be a value smaller than 1, such as 0.01 or 0.02. The first preset positive number is used to make the value of the exponential operation at least greater than 0.
[0069] By processing the inverse of the exponential function, the obtained consistency value can be made to be within the range of 0 to 1, so as to facilitate comparison and calculation between variables.
[0070] In this way, by comparing the consistency between the pixel area of the target line corresponding to the target pixel point and the area of the minimum circumscribed rectangle of the target line corresponding to the target pixel point, a larger consistency value can be determined for the pixel points in the grayscale image that are more likely to belong to residual pig hair, so as to realize the detection of residual pig hair in the grayscale image.
[0071] In step S104, the probability value of the target pixel point belonging to residual pig hair is determined based on the product of the third eigenvalue and the consistency value; the pixels in the grayscale image are clustered based on the probability value of the pixel points in the grayscale image and the color characteristics of the pixel points in the grayscale image in the visible light image of the outer surface of the pigskin, and the detection result of the residual pig hair on the outer surface of the pigskin is determined based on the clustering result.
[0072] In one embodiment, the probability value of the target pixel point belonging to the residual pig hair is determined based on the product of the third eigenvalue and the consistency value, including: taking the product of the third eigenvalue and the consistency value as the target product, and normalizing the target product as the probability value of the target pixel point belonging to the residual pig hair.
[0073] The product of the third eigenvalue and the consistency value is used as the target product. The target product can integrate the third eigenvalue and the consistency value, so that the target product can more comprehensively characterize the probability that the target pixel point belongs to residual pig hair.
[0074] Normalizing the target product can facilitate subsequent comparison and calculation between variables; wherein, the normalization of the target product can be implemented using the maximum-minimum method.
[0075] The probability value of a pixel point in a grayscale image is determined based on the gradient of the grayscale value within the pixel point's neighborhood, the shape characteristics of the target line corresponding to the pixel point, and the grayscale value of the pixel point. The probability value of the pixel point can distinguish between residual pig hair in the outer skin of raw pork and the wrinkles or texture of the pig skin. Therefore, based on the probability value of the pixel point in the grayscale image and the color characteristics of the pixel point in the visible light image, the possible residual pig hair in the outer skin of raw pork can be more accurately determined.
[0076] For a target pixel in a grayscale image, the color feature of the target pixel in the visible light image of the pigskin outer surface can be determined based on the pixel values of the target pixel at the corresponding position in the visible light image of the pigskin outer surface in the red, green, and blue channels, respectively.
[0077] In one embodiment, clustering pixels in a grayscale image includes: using the pixel values of the red channel, green channel, and blue channel of a visible light image of the outer surface of pigskin in the grayscale image as the first clustering dimension, the second clustering dimension, and the third clustering dimension of the target pixel in the grayscale image, respectively; and performing mean shift clustering on the pixels in the grayscale image based on the probability value of the pixel in the grayscale image, the first clustering dimension, the second clustering dimension, and the third clustering dimension.
[0078] Since the visible light image of the outer surface of the pig skin records the color characteristics of different parts of the pig skin, the color characteristics of the residual pig hair of the pig skin are different from the color characteristics of other parts of the pig skin. The pixel values of the red channel, green channel, and blue channel of the visible light image of the outer surface of the pig skin in the grayscale image are used as different clustering dimensions, respectively. The area where the residual pig hair is located can be determined after clustering.
[0079] When performing mean shift clustering on pixel points in the grayscale image, the probability value of the pixel point belonging to the residual pig hair is taken into account. Therefore, after clustering, in addition to clustering the pixels with the same or similar color features into the same cluster cluster, the pixels with the same or similar probability of belonging to the residual pig hair can also be clustered into the same cluster cluster, so as to determine the location of the residual pig hair from the multiple cluster clusters obtained.
[0080] Mean shift clustering is a non-parametric clustering algorithm based on kernel density estimation. Mean shift clustering can be used to cluster pixels in an image into different regions, thereby achieving image segmentation.
[0081] In an embodiment of the present application, since the clustering process of pixels in a grayscale image is determined based on the color features of the pixels in the visible light image and the probability value of the pixels belonging to residual pig hair, pixels with the same or similar color features and probability values of belonging to residual pig hair can be clustered into the same image area.
[0082] In this way, by clustering the pixels in the grayscale image, it is possible to easily determine the image region where the residual pig hair is located based on the obtained clusters.
[0083] In one embodiment, the clustering result includes multiple clusters, and the detection result of the residual pig hair in the outer surface of the pig skin is determined based on the clustering result, including: taking the average value of the probability values of all pixel points in the cluster as the evaluation value of the cluster; taking the cluster with an evaluation value greater than a preset probability threshold as the target cluster where the residual pig hair is located; and taking the area composed of the pixel points included in the target cluster as the target defect area where the residual pig hair is located.
[0084] Since the probability value of a pixel point can represent the probability that the pixel point belongs to residual pig hair, for the cluster clusters obtained after clustering, clustering of pixels with similar features is achieved. The average value of the probability values of all pixels in the cluster can reflect the probability that the cluster belongs to the area where the residual pig hair is located. Therefore, using the average value of the probability values of all pixels in the cluster as the evaluation value of the cluster can facilitate determining the image area where the residual pig hair is located from all cluster clusters.
[0085] The preset probability threshold can be set according to actual needs. For example, the preset probability threshold can be between 0.6 and 0.7. The cluster with an evaluation value greater than the preset probability threshold is used as the target cluster where the residual pig hair is located, thereby determining the area where the residual pig hair is located, which can facilitate the treatment of the pig hair remaining on the surface of the raw pig skin after depilation.
[0086] In one embodiment, when the detection result indicates that there are residual pig hairs on the outer surface of the pig skin, the pig hair processing device can be controlled to perform dehairing on the outer surface of the pig skin again.
[0087] When the test results indicate that there are residual pig hairs on the outer surface of the pigskin, the outer surface of the pigskin is dehaired again to ensure the hygiene and appearance of the surface of the raw pigskin.
[0088] In order to improve the processing efficiency of the residual pig hair, the pig hair processing equipment can be controlled to perform hair removal on the target defect area where the residual pig hair is located.
[0089] It will be understood that the present application is not limited to the exact construction that has been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof.
Claims
1. An intelligent detection method for pig hair removal, characterized in that: include: Acquire a grayscale image of the outer surface of the depilated pigskin, and determine a first eigenvalue of a target pixel in the grayscale image; The first eigenvalue is used to at least characterize the difference between the average grayscale value of the grayscale image and the grayscale value of the target pixel. The first eigenvalue of the target pixel is determined by: , where T is the first eigenvalue of the target pixel, norm is the normalization function, is the grayscale value of the target pixel, is the average grayscale value of the grayscale image, exp is an exponential function with a natural constant as the base, and R is the variance of the grayscale values of pixels in the neighborhood of the target pixel; Determine the second eigenvalue of the target pixel, and use the product of the first and second eigenvalues as the third eigenvalue; the second eigenvalue is used to characterize the smoothness of the change in the grayscale value within the neighborhood of the target pixel. The second eigenvalue of the target pixel is determined by the following method: , where D is the second eigenvalue of the target pixel; F is the information entropy of the grayscale values of the pixels in the neighborhood of the target pixel, which is used to characterize the complexity of the grayscale values of the pixels in the neighborhood; is a second preset positive number, exp is an exponential function with a natural constant as the base, and M is the range of the grayscale values of pixels within the neighborhood of the target pixel; Determine a target line starting from a target pixel point from the grayscale image, and obtain a consistency value between the pixel area of the target line and the area of the minimum circumscribed rectangle of the target line; the difference in grayscale values of adjacent pixels on the target line is less than a preset difference threshold; The target line starting from the target pixel point is determined in the following manner: the pixel point with the smallest difference in grayscale value between the target pixel point and the target pixel point in the neighborhood range is selected as the first extended pixel point; the pixel point with the grayscale value difference between the first extended pixel point and the target pixel point in the neighborhood range is selected as the next extended pixel point; when the grayscale value differences between the pixels in the neighborhood range of the extended pixel point and the extended pixel point are all greater than or equal to the preset difference threshold, the determination of the extended pixel points is stopped, so that all the extended pixels are connected to obtain the target line corresponding to the target pixel point; Determining a probability value of the target pixel belonging to residual pig hair based on the product of the third eigenvalue and the consistency value; clustering the pixels in the grayscale image based on the probability value of the pixel and the color characteristics of the pixel in the grayscale image in the visible light image of the outer surface of the pigskin, and determining a detection result of the residual pig hair on the outer surface of the pigskin based on the clustering result, wherein the clustering result includes a plurality of cluster clusters; The detection result of the residual pig hair on the outer surface of the pig skin is determined according to the clustering result, including: taking the average value of the probability values of all pixel points in the cluster as the evaluation value of the cluster; taking the cluster with an evaluation value greater than a preset probability threshold as the target cluster where the residual pig hair is located; and taking the area composed of the pixel points included in the target cluster as the target defect area where the residual pig hair is located.
2. The intelligent detection method for pig hair removal according to claim 1, characterized in that: The information entropy is determined in the following way: , where F is the information entropy, n is the number of types of grayscale values of pixels within the neighborhood of the target pixel, is the frequency ratio of the i-th gray value within the neighborhood of the target pixel point, is a logarithmic function with a natural constant as its base.
3. The intelligent detection method for pig hair removal according to claim 1, characterized in that: The consistency value corresponding to the target pixel is determined in the following way: , where W is the consistency value corresponding to the target pixel, and exp is an exponential function with a natural constant as the base. is the pixel area of the target line corresponding to the target pixel point, is the area of the minimum circumscribed rectangle of the target line corresponding to the target pixel point, The first preset positive number.
4. The intelligent detection method for pig hair removal according to claim 1, characterized in that: The probability value of the target pixel belonging to the residual pig hair is determined based on the product of the third eigenvalue and the consistency value, including: The product of the third eigenvalue and the consistency value is used as the target product, and the target product is normalized to obtain a probability value that the target pixel point belongs to the residual pig hair.
5. The intelligent detection method for pig hair removal according to claim 1, characterized in that: Clustering of pixels in grayscale images, including: The pixel values of the red channel, green channel, and blue channel of the visible light image of the target pixel point in the grayscale image on the outer surface of the pigskin are used as the first clustering dimension, the second clustering dimension, and the third clustering dimension of the target pixel point, respectively; Mean shift clustering is performed on the pixels in the grayscale image according to the probability values of the pixels in the grayscale image, the first clustering dimension, the second clustering dimension, and the third clustering dimension.
6. The intelligent detection method for pig hair removal according to claim 1, characterized in that: The method further comprises: When the detection result indicates that there are residual pig hairs on the outer surface of the pigskin, the pig hair processing equipment is controlled to perform dehairing on the outer surface of the pigskin again.
Citation Information
Patent Citations
Polycrystal layer photoetching process hot spot detection method based on image processing
CN117173176A
Furniture surface quality detection method based on machine vision
CN118823029A