Meat product freshness detection method based on machine vision
Through machine vision technology and deep learning models, combined with gloss and microscopic image analysis, the problems of low efficiency and insufficient accuracy of meat product freshness detection are solved, efficient and automated multi-dimensional evaluation and potential problem identification are achieved, and food is improved Safety and reliability of production line control.
Patent Information
- Application Number
- CN202411087158.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-08-09
AI Technical Summary
The freshness detection of existing meat products relies on manual inspection and simple sensory testing, which is inefficient and subjective, and cannot accurately detect tiny mildew spots or blood spots. The single focal length machine vision detection cannot deeply analyze microscopic changes, limiting the subtle quality problems. Identify.
Using machine vision-based detection methods, multiple surfaces and microscopic images of meat products are taken under standard lighting conditions through cameras and microcamera. Combining gloss data, color and texture characteristics are extracted to build color index, texture roughness and gloss , multi-level, multi-dimensional freshness evaluation, and deep learning models are used to identify mold spots and blood spots.
Improve the accuracy and consistency of test results, enables automatic and rapid assessment of freshness and quality of meat products, identify potential quality problems such as mold and blood spots, and ensures food safety and real-time monitoring on the production line.
Smart Images

Figure CN118914185A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of meat product detection, and in particular to a meat product freshness detection method based on machine vision. Background Art
[0002] Machine vision technology is an important field of artificial intelligence and computer science, which aims to enable computers to understand and interpret visual information like humans. In industrial automation and quality inspection, machine vision has become an indispensable tool and is widely used in manufacturing, agriculture, and food safety. Specifically for food safety inspection, machine vision systems use cameras and image processing algorithms to analyze the characteristics of food surfaces to determine their quality and safety. In the field of meat product inspection, machine vision technology is mainly used to monitor the surface condition of meat products to assess their freshness and quality.
[0003] At present, the freshness detection of meat products mainly relies on manual inspection and simple sensory testing. However, this traditional method has obvious limitations, mainly including low efficiency, strong subjectivity and lack of precise quantitative indicators. Manual inspection is easily affected by the experience and status of the inspectors, resulting in inconsistent test results. In addition, sensory testing cannot accurately detect surface abnormalities such as tiny mold spots or blood spots in meat products. For example, after the meat products are wiped off when they are initially moldy and blood spots appear, intuitive visual inspection is not easy to detect subtle small mold spots or blood spots, which may miss the identification of early quality problems. Although single-focal-length machine vision inspection has been introduced in some places, it can only detect macroscopic features of the surface, but cannot deeply analyze changes at the microscopic level, which limits its application in detecting subtle quality problems. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present invention provides a meat product freshness detection method based on machine vision, which solves the problems mentioned in the background technology.
[0005] To achieve the above objectives, the present invention is implemented through the following technical solutions: A method for detecting the freshness of meat products based on machine vision, comprising the following steps:
[0006] Step S1: Use a camera to take multiple surface images of meat products under standard lighting conditions to obtain a surface image set and a microscopic image set, and pre-process the normal focus image and the microscopic image to obtain a standard surface image I1. n and standard microscopic image I2 i , and then use sensors to collect gloss data of meat products;
[0007] Step S2: the acquired standard surface image I1 n and standard microscopic image I2 nExtract color features and texture features to obtain a meat product freshness feature set;
[0008] Step S3, constructing an algorithm formula to perform calculation and analysis on the extracted meat product freshness feature set and gloss data, obtaining the color index CI, texture roughness TR and glossiness GZ of the meat product, and performing summary calculation to obtain the appearance freshness index XXD, presetting the freshness threshold X and the obtained appearance freshness index XXD, and performing comparative evaluation to preliminarily analyze the freshness of the meat product;
[0009] Step S4: Standard microscopic image I2 n For each pixel in the image, color analysis is performed to identify the color difference of each pixel of the meat product under the microscopic state, and the mold mask Bmask and the blood mask Cmask are obtained;
[0010] Step S5, when the meat product is preliminarily evaluated to be fresh, the obtained mold mask Bmask and blood mask Cmask are used to perform correlation calculations to obtain the meat product foreign matter index YW, which is then comprehensively calculated with the obtained appearance freshness index XXD to obtain the comprehensive quality index PZZ, and the quality threshold P is preset for secondary comparative evaluation to deeply analyze the freshness of the meat product.
[0011] Preferably, the step S1 comprises:
[0012] S11, setting a white light source above the surface of the meat product, using a camera and a microscope camera with more than 12 million pixels to shoot six sides of the meat product, namely, the top, bottom, front, back, left and right sides, to obtain a surface image set and a microscope image set of the meat product;
[0013] S12, placing a photometer in a direction of equal-angle reflection with a white light source and at an angle deviating from the direction of specular reflection, and collecting gloss data of the meat product in real time, wherein the gloss data includes specular reflection light intensity Rs and diffuse reflection light intensity Rd; setting a white light source at a fixed angle to illuminate the surface of the meat product, using a photometer set in a direction of equal-angle reflection with the white light source, measuring and obtaining the specular reflection light intensity Rs, and then setting the photometer at a direction deviating from the orthogonal direction of specular reflection, 90 degrees, to measure the diffuse reflection light intensity Rd. This setting captures light diffusely reflected from the surface, that is, light scattered in all directions;
[0014] S13. Using the OpenCV library, the surface image and the microscopic image are adjusted to the same size according to the scale, and the anti-aliasing technology is applied to smooth the image edges. Then, the image quality of the surface image and the microscopic image of the same size is optimized by adjusting the image compression level and denoising technology.
[0015] S4. Collect surface image datasets and microscopic image datasets of various historical meat products, use semi-automatic tools to mask each surface image set and microscopic image set to represent the foreground area, mask the foreground images in the surface image set and microscopic image set and adjust the foreground pixels to 1 and the background pixels to 0, select U-Net as the deep learning model architecture, build a deep learning model, and then divide the surface image set and microscopic image set into a training set and a validation set, train the deep learning model with the training set, and tune the deep learning model with the validation set, then collect surface image datasets and microscopic image datasets of various historical meat products, annotate the foreground meat product pixels as white and the background pixels as black, and then build a deep learning model, perform segmentation training and verification on the annotated surface image dataset and microscopic image dataset, optimize the deep learning model, and then input the surface image set and microscopic image set obtained by real-time shooting into the deep learning model to remove the background to obtain the standard surface image I1. i and standard microscopic image I2 n , where the standard surface image I1 n Represents the nth standard surface image I1, standard microscopic image I2 n Represents the nth standard microscopic image I2.
[0016] Preferably, the step S2 comprises:
[0017] S21. Use the image processing library to load the standard surface image I1 n and standard microscopic image I2 n , converted into a pixel data set, using a two-dimensional coordinate system to represent the pixel position, and the standard surface image I1 n and standard microscopic image I2 n The upper left corner is defined as the origin (0,0), the X-axis extends i pixels to the right, and the Y-axis extends j pixels downward to obtain the pixel coordinates (Xi, Yj);
[0018] S22, then use the color space conversion technology to extract the standard surface image I1 according to the pixel coordinates (Xi, Yj). n and standard microscopic image I2 n Color features of the corresponding coordinates, the color features including a red component R, a green component G, and a blue component B;
[0019] S23, after extracting the color features, use the OpenCV library to analyze the standard surface image I1 n Convert to grayscale image and extract standard surface image I1 n The grayscale value H of the pixel coordinates (Xi, Yj) is used to generate texture features, and then the texture features and color features are summarized to generate the meat product freshness feature set.
[0020] Preferably, step S3 comprises:
[0021] S31, constructing a color algorithm formula, and calculating the standard surface image I1 of the meat product based on the color features in the meat product freshness feature set i The color situation is obtained by obtaining the color index CI;
[0022] The color index CI is calculated by the following algorithm formula:
[0023] ;
[0024] In the formula, 0.299, 0.587 and 0.114 are determined by weighting the sensitivity of the visual system to different colors;
[0025] Green is in the middle band of the visible spectrum, and the human eye is more sensitive to green. Therefore, the green channel has the highest weight in the conversion process, which is 0.587. This weight reflects the fact that the human eye is more sensitive to green.
[0026] The sensitivity of red is lower than that of green, but it is still quite obvious. The weight of the red channel is 0.299, which reflects the importance of red to human vision, although its weight is smaller than that of green.
[0027] Blue has the lowest sensitivity, so it has the smallest weight in the formula, which is 0.114. This is because the human eye is not as sensitive to short-wavelength blue light as it is to medium- and long-wavelength red and green light.
[0028] Preferably, S32, by constructing a texture roughness algorithm formula, the standard surface image I1 of the meat product is calculated based on the texture features in the meat product fresh feature set. i The gray value H is used to obtain the texture roughness TR;
[0029] The texture roughness TR is calculated by the following algorithm formula:
[0030] ;
[0031] Where N represents the image size, Xi represents the i-th pixel point on the X-axis of the image, Yj represents the j-th pixel point on the Y-axis, and I1 n Represents the standard surface image of the nth side of the meat product.
[0032] Preferably, S33, performing correlation calculation on the collected gloss data to obtain the glossiness GZ of the meat product, and analyzing the glossiness of the meat product;
[0033] The glossiness GZ of the meat product is calculated by the following algorithm formula:
[0034] .
[0035] Preferably, S34, comprehensively calculating the obtained color index CI, texture roughness TR and glossiness GZ of the meat product to obtain an appearance freshness index XXD to quantify the freshness of the meat product;
[0036] The appearance freshness index XXD is calculated by the following algorithm formula:
[0037] ;
[0038] In the formula, Indicates the color change rate, represents the texture change rate, represents the gloss change rate, w1, w2 and w3 represent the color change rate , Texture change rate and glossiness change rate The preset weight value, the specific parameters are set by the user according to the actual situation, and w1+w2+w3=1, CI0 represents the color index reference value, TR0 represents the texture roughness reference value, GZ0 represents the meat product gloss reference value;
[0039] S341, the user sets a freshness threshold X of the meat product, and then performs a preliminary comparative evaluation with the acquired appearance freshness index XXD to preliminarily analyze the freshness of the meat product;
[0040] The specific evaluation plan is as follows:
[0041] When the appearance freshness index XXD> the freshness threshold X, it means that the currently tested meat product is not fresh;
[0042] When the appearance freshness index XXD ≤ the freshness threshold X, it means that the currently tested meat product is fresh, and at this time, the meat product is subjected to in-depth testing.
[0043] Preferably, step S4 comprises:
[0044] S41, calculate the standard microscopic image I2 through the constructed color algorithm formula n The microscopic color index CI2 of each pixel coordinate (Xi, Yj) is calculated, and the color threshold segmentation method is used to obtain the mold mask Bmask and the blood mask Cmask;
[0045] The mold spot mask Bmask and the blood spot mask Cmask are obtained by the following color threshold segmentation method:
[0046] ;
[0047] ;
[0048] Where CI2(Xi, Yj) represents the color value of the pixel coordinate (Xi, Yj), L min Indicates the valley value of the color of the mildew, L max Indicates the peak value of the color of the mildew stain, T red Indicates the red threshold, which is set by the user according to needs.
[0049] Preferably, S42, based on the obtained mildew mask Bmask and blood stain mask Cmask, and then with the obtained appearance freshness index XXD obtained by comprehensive calculation, a comprehensive quality index PZZ is obtained by comprehensive calculation;
[0050] The comprehensive quality index PZZ is calculated by the following algorithm formula:
[0051] ;
[0052] Where M represents the total number of mildew pixels, Bmask m represents the mold mask Bmask of the mth pixel, B represents the total number of blood spot pixels, Cmask b Represents the blood spot mask Cmask of the b-th pixel.
[0053] Preferably, step S5 comprises:
[0054] S51, based on the quality index of the meat product, a preset quality threshold value P and the obtained comprehensive quality index PZZ are compared and evaluated to analyze the quality of the meat product;
[0055] The specific evaluation plan is as follows:
[0056] When the comprehensive quality index PZZ>quality threshold P, it means that the quality of the current meat product does not meet the expected freshness standard, and the meat product has mold spots and blood spots;
[0057] When the comprehensive quality index PZZ ≤ the quality threshold P, it means that the quality of the current meat product meets the expected freshness standard.
[0058] Beneficial Effects
[0059] The present invention provides a method for detecting the freshness of meat products based on machine vision. It has the following beneficial effects:
[0060] (1) This method uses a high-pixel camera and a microscope camera to shoot six sides of meat products under standard lighting conditions to obtain a comprehensive set of surface images and microscopic images. At the same time, a photometer is used to collect the specular reflection light intensity Rs and diffuse reflection light intensity Rd of the meat products in real time and record their gloss data. Through image preprocessing, color feature extraction and texture feature analysis, this method can accurately calculate the color index CI, texture roughness TR and gloss GZ. The acquisition of these parameters relies on objective images and optical data, avoiding errors caused by human subjective judgment and significantly improving the accuracy of the detection results. In addition, through the preset freshness threshold X, this method can provide standardized detection standards for different types of meat products to ensure the consistency and reliability of the evaluation.
[0061] (2) This method uses non-contact machine vision technology to quickly obtain the required image data and gloss data without physically destroying the meat products. The pre-processed image data is combined with the deep learning model for feature extraction and background removal to quickly generate a standard surface image I1. n and standard microscopic image I2 n This rapid testing technology not only reduces the time required for sample preparation and analysis in traditional physical and chemical testing, but also avoids destructive testing of samples, maintaining the integrity of meat products. In addition, the system's automated processing flow allows the testing process to efficiently process a large number of samples, facilitating real-time monitoring and quality control on the production line.
[0062] (3) Through the comprehensive analysis of multiple image features and optical data, this method can comprehensively evaluate the freshness and quality of meat products from multiple dimensions. First, by extracting and analyzing color features, the calculated color index CI can reflect the color changes of meat products. Secondly, the texture roughness TR index calculated by texture features provides a quantitative evaluation of the surface texture details of meat products. At the same time, the gloss GZ calculated by combining gloss data further reflects the smoothness and gloss characteristics of the meat surface. These multi-dimensional indicators are comprehensively calculated to generate the appearance freshness index XXD, and a preliminary comparative evaluation is performed with the preset freshness threshold X. When the meat product is initially evaluated as fresh, this method further uses microscopic image data to analyze the presence of mold and blood spots, and generates mold mask Bmask and blood mask Cmask. By calculating these masks, the comprehensive quality index PZZ is obtained, and combined with the preset quality threshold P, a secondary evaluation is performed to deeply analyze the quality status of the meat product. Such multi-level testing can not only preliminarily judge the freshness of meat products, but also detect potential quality problems such as mold and blood spots, thus providing comprehensive and accurate support for food safety control. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 The figure is a schematic diagram of the steps of a meat product freshness detection method based on machine vision of the present invention. DETAILED DESCRIPTION
[0064] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] Example 1
[0066] The present invention provides a method for detecting the freshness of meat products based on machine vision. Figure 1 , including the following steps:
[0067] Step S1: Use a camera to take multiple surface images of meat products under standard lighting conditions to obtain a surface image set and a microscopic image set, and pre-process the normal focus image and the microscopic image to obtain a standard surface image I1. n and standard microscopic image I2 i , and then use sensors to collect gloss data of meat products;
[0068] Step S2: the acquired standard surface image I1 n and standard microscopic image I2 n Extract color features and texture features to obtain a meat product freshness feature set;
[0069] Step S3, constructing an algorithm formula to perform calculation and analysis on the extracted meat product freshness feature set and gloss data, obtaining the color index CI, texture roughness TR and glossiness GZ of the meat product, and performing summary calculation to obtain the appearance freshness index XXD, presetting the freshness threshold X and the obtained appearance freshness index XXD, and performing comparative evaluation to preliminarily analyze the freshness of the meat product;
[0070] Step S4: Standard microscopic image I2 n For each pixel in the image, color analysis is performed to identify the color difference of each pixel of the meat product under the microscopic state, and the mold mask Bmask and the blood mask Cmask are obtained;
[0071] Step S5, when the meat product is preliminarily evaluated to be fresh, the obtained mold mask Bmask and blood mask Cmask are used to perform correlation calculations to obtain the meat product foreign matter index YW, which is then comprehensively calculated with the obtained appearance freshness index XXD to obtain the comprehensive quality index PZZ, and the quality threshold P is preset for secondary comparative evaluation to deeply analyze the freshness of the meat product.
[0072] In this embodiment, the core of the method lies in multi-level and multi-dimensional image analysis and data acquisition. First, by taking multiple surface images and microscopic images of meat products under standard lighting conditions and preprocessing these images, we can accurately obtain the standard surface image I1 n and standard microscopic image I2 n , and the gloss data of meat products is collected by sensors. This method not only provides high-quality basic data for subsequent analysis, but also ensures the consistency and accuracy of the detection process. In the feature extraction stage, we extracted the color features and texture features of meat products from the standard surface image and microscopic image to form a fresh feature set of meat products. Based on these features, the calculation formulas of color index CI, texture roughness TR and gloss GZ were constructed, and the appearance freshness index XXD was further calculated comprehensively. This comprehensive calculation method makes the freshness evaluation not only based on a single feature, but also comprehensively considers multiple aspects such as color, texture and gloss, thereby improving the comprehensiveness and accuracy of the detection. During the detection process, color analysis is performed on each pixel in the standard microscopic image, which can identify the presence of mold and blood spots, and obtain the mold mask Bmask and blood mask Cmask. Through further comprehensive calculation, the comprehensive quality index PZZ is obtained, and a secondary comparison evaluation is performed with the preset quality threshold P. This multi-level detection and analysis mechanism effectively solves the problem of inaccurate recognition of surface defects of meat products in traditional methods, thereby improving the reliability of meat product quality control.
[0073] Example 2
[0074] This embodiment is explained in Example 1, please refer to Figure 1 Specifically, step S1 includes:
[0075] S11, setting a white light source above the surface of the meat product, using a camera and a microscope camera with more than 12 million pixels to shoot six sides of the meat product, namely, the top, bottom, front, back, left and right sides, to obtain a surface image set and a microscope image set of the meat product;
[0076] S12, placing a photometer in a direction of equal-angle reflection with a white light source and at an angle deviating from the direction of specular reflection, and collecting gloss data of the meat product in real time, wherein the gloss data includes specular reflection light intensity Rs and diffuse reflection light intensity Rd; setting a white light source at a fixed angle to illuminate the surface of the meat product, using a photometer set in a direction of equal-angle reflection with the white light source, measuring and obtaining the specular reflection light intensity Rs, and then setting the photometer at a direction deviating from the orthogonal direction of specular reflection, 90 degrees, to measure the diffuse reflection light intensity Rd. This setting captures light diffusely reflected from the surface, that is, light scattered in all directions;
[0077] S13. Using the OpenCV library, the surface image and the microscopic image are adjusted to the same size according to the scale, and the anti-aliasing technology is applied to smooth the image edges. Then, the image quality of the surface image and the microscopic image of the same size is optimized by adjusting the image compression level and denoising technology.
[0078] S4. Collect surface image datasets and microscopic image datasets of various historical meat products, use semi-automatic tools to mask each surface image set and microscopic image set to represent the foreground area, mask the foreground images in the surface image set and microscopic image set and adjust the foreground pixels to 1 and the background pixels to 0, select U-Net as the deep learning model architecture, build a deep learning model, and then divide the surface image set and microscopic image set into a training set and a validation set, train the deep learning model with the training set, and tune the deep learning model with the validation set, then collect surface image datasets and microscopic image datasets of various historical meat products, annotate the foreground meat product pixels as white and the background pixels as black, and then build a deep learning model, perform segmentation training and verification on the annotated surface image dataset and microscopic image dataset, optimize the deep learning model, and then input the surface image set and microscopic image set obtained by real-time shooting into the deep learning model to remove the background to obtain the standard surface image I1. i and standard microscopic image I2 n , where the standard surface image I1 n Represents the nth standard surface image I1, standard microscopic image I2 n Represents the nth standard microscopic image I2.
[0079] In this embodiment, the surface and microscopic images of meat products are comprehensively and detailedly recorded by precisely setting the lighting and using high-resolution camera equipment, combined with real-time gloss data collection. This comprehensive shooting method ensures that surface features at different angles are accurately captured, providing rich data support for subsequent analysis. The precise setting and measurement of the photometer captures the specular reflection light intensity Rs and the diffuse reflection light intensity Rd, respectively, further enriching the gloss data and making the analysis of the gloss of meat products more comprehensive and accurate. The OpenCV library is used to uniformly resize and optimize the images, which not only improves the quality and consistency of the images, but also ensures the reliability of subsequent analysis. The historical data is annotated through semi-automatic tools, and the U-Net deep learning model is used for image segmentation training and optimization, so that the foreground and background of meat products can be distinguished more accurately. Such a processing and analysis process ensures the standard surface image I1 n and standard microscopic image I2 n The high-quality generation of images provides a reliable data basis for the freshness detection of meat products. This process significantly improves the accuracy and efficiency of detection, and effectively overcomes the problems of inconsistent image quality and insufficient feature extraction that may exist in traditional methods.
[0080] Example 3
[0081] This embodiment is explained in Example 2. Please refer to Figure 1 Specifically, step S2 includes:
[0082] S21. Use the image processing library to load the standard surface image I1 n and standard microscopic image I2 n , converted into a pixel data set, using a two-dimensional coordinate system to represent the pixel position, and the standard surface image I1 n and standard microscopic image I2 n The upper left corner is defined as the origin (0,0), the X-axis extends i pixels to the right, and the Y-axis extends j pixels downward to obtain the pixel coordinates (Xi, Yj);
[0083] S22, then use the color space conversion technology to extract the standard surface image I1 according to the pixel coordinates (Xi, Yj). n and standard microscopic image I2 n Color features of the corresponding coordinates, the color features including a red component R, a green component G, and a blue component B;
[0084] S23, after extracting the color features, use the OpenCV library to analyze the standard surface image I1 n Convert to grayscale image and extract standard surface image I1 nThe grayscale value H of the pixel coordinates (Xi, Yj) is used to generate texture features, and then the texture features and color features are summarized to generate the meat product freshness feature set.
[0085] In this embodiment, the method uses an image processing step to obtain a standard surface image I1 n and standard microscopic image I2 n It is converted into a detailed pixel data set, ensuring the precise positioning of each pixel. This method uses a two-dimensional coordinate system to accurately represent the position of each pixel, and extracts the color features of the image, including the three components of red, green, and blue, through color space conversion technology. This process lays the foundation for a comprehensive analysis of color features and ensures the accurate capture of color changes in meat products. In addition, texture features are further generated by converting the surface image into a grayscale image and extracting the grayscale value using the OpenCV library. This method not only improves the accuracy of texture feature extraction, but also enhances the ability to analyze the fine structure of the surface of meat products.
[0086] Example 4
[0087] This embodiment is explained in Example 1, please refer to Figure 1 Specifically, step S3 includes:
[0088] S31, constructing a color algorithm formula, and calculating the standard surface image I1 of the meat product based on the color features in the meat product freshness feature set i The color situation is obtained by obtaining the color index CI;
[0089] The color index CI is calculated by the following algorithm formula:
[0090] ;
[0091] In the formula, 0.299, 0.587 and 0.114 are determined by weighting the sensitivity of the visual system to different colors;
[0092] Green is in the middle band of the visible spectrum, and the human eye is more sensitive to green. Therefore, the green channel has the highest weight in the conversion process, which is 0.587. This weight reflects the fact that the human eye is more sensitive to green.
[0093] The sensitivity of red is lower than that of green, but it is still quite obvious. The weight of the red channel is 0.299, which reflects the importance of red to human vision, although its weight is smaller than that of green.
[0094] Blue has the lowest sensitivity, so it has the smallest weight in the formula, which is 0.114. This is because the human eye is not as sensitive to short-wavelength blue light as it is to medium- and long-wavelength red and green light.
[0095] S32, by constructing a texture roughness algorithm formula, the standard surface image I1 of the meat product is calculated based on the texture features in the meat product freshness feature set. i The gray value H is used to obtain the texture roughness TR;
[0096] The texture roughness TR is calculated by the following algorithm formula:
[0097] ;
[0098] Where N represents the image size, Xi represents the i-th pixel point on the X-axis of the image, Yj represents the j-th pixel point on the Y-axis, and I1 n Represents the standard surface image of the nth side of the meat product.
[0099] S33, performing correlation calculations based on the collected gloss data to obtain the glossiness GZ of the meat product, and analyzing the glossiness of the meat product;
[0100] The glossiness GZ of the meat product is calculated by the following algorithm formula:
[0101] .
[0102] In this embodiment, the method significantly improves the analysis accuracy of the freshness of meat products by constructing and applying accurate color algorithm formulas, texture roughness algorithm formulas and gloss calculation formulas. First, the color index CI calculated by the color algorithm formula fully considers the sensitivity of the human eye to different color components, thereby scientifically and accurately analyzing the color changes of meat products. Secondly, the calculation of texture roughness TR is based on the grayscale value of the image, which provides a deep understanding of the subtle texture changes on the surface of meat products, making the detection of surface texture more sensitive and accurate. Finally, through the analysis of gloss data, the calculated gloss GZ can reflect the gloss changes on the surface of meat products, which is crucial to judging the freshness of meat products. Overall, the application of these algorithm formulas not only enhances the quantitative analysis capability of the appearance characteristics of meat products, but also effectively improves the accuracy of freshness assessment, overcomes the limitations of traditional methods in processing color, texture and gloss data, and ensures the comprehensiveness and reliability of the detection results.
[0103] Example 5
[0104] This embodiment is explained in Example 4. Please refer to Figure 1 Specifically: S34, comprehensively calculating the obtained color index CI, texture roughness TR and glossiness GZ of the meat product to obtain the appearance freshness index XXD to quantify the freshness of the meat product;
[0105] The appearance freshness index XXD is calculated by the following algorithm formula:
[0106] ;
[0107] In the formula, Indicates the color change rate, represents the texture change rate, represents the gloss change rate, w1, w2 and w3 represent the color change rate , Texture change rate and glossiness change rate The preset weight value, the specific parameters are set by the user according to the actual situation, and w1+w2+w3=1, CI0 represents the color index reference value, TR0 represents the texture roughness reference value, GZ0 represents the meat product gloss reference value;
[0108] S341, the user sets a freshness threshold X of the meat product, and then performs a preliminary comparative evaluation with the acquired appearance freshness index XXD to preliminarily analyze the freshness of the meat product;
[0109] The specific evaluation plan is as follows:
[0110] When the appearance freshness index XXD> the freshness threshold X, it means that the currently tested meat product is not fresh;
[0111] When the appearance freshness index XXD ≤ the freshness threshold X, it means that the currently tested meat product is fresh, and at this time, the meat product is subjected to in-depth testing.
[0112] In this embodiment, the appearance freshness index XXD is obtained by comprehensively calculating the color index CI, texture roughness TR and glossiness GZ, which significantly improves the quantitative analysis ability of the freshness of meat products. This comprehensive calculation method uses the preset weights of the color change rate, texture change rate and gloss change rate to ensure a comprehensive evaluation of the appearance characteristics of meat products. This method can not only accurately quantify the freshness of meat products, but also make a preliminary evaluation based on the freshness threshold set by the user, thereby effectively distinguishing fresh and non-fresh meat products. Specifically, when the appearance freshness index XXD exceeds the set freshness threshold, the system can quickly identify the stale state of the meat product; and when the appearance freshness index XXD is below the quality threshold P, it indicates that the meat product still maintains a good freshness, thus entering a further in-depth detection link. This comprehensive evaluation mechanism provides a more scientific and reliable detection basis, significantly improves the detection efficiency and accuracy, and overcomes the problem that a single indicator cannot fully reflect the actual freshness of meat products.
[0113] Example 6
[0114] This embodiment is explained in Example 3, please refer to Figure 1Specifically, step S4 includes:
[0115] S41, calculate the standard microscopic image I2 through the constructed color algorithm formula n The microscopic color index CI2 of each pixel coordinate (Xi, Yj) is calculated, and the color threshold segmentation method is used to obtain the mold mask Bmask and the blood mask Cmask;
[0116] The mold spot mask Bmask and the blood spot mask Cmask are obtained by the following color threshold segmentation method:
[0117] ;
[0118] ;
[0119] Where CI2(Xi, Yj) represents the color value of the pixel coordinate (Xi, Yj), L min Indicates the valley value of the color of the mildew, L max Indicates the peak value of the color of the mildew stain, T red Indicates the red threshold, which is set by the user according to needs.
[0120] In this embodiment, by using the color threshold segmentation method in the microscopic image to obtain the mold mask Bmask and the blood mask Cmask, this method significantly enhances the ability to detect abnormal conditions on the surface of meat products. First, the constructed color algorithm formula is used to calculate the microscopic color index CI2 of each pixel, ensuring the accurate capture of color details in the microscopic image. Then, by setting the color threshold, the mold and blood areas are successfully separated from the microscopic image, realizing the automatic identification of surface defects of meat products. This method not only improves the accuracy of detection, but also can effectively identify and classify potential problem areas in meat products, such as mold and blood, avoiding the subjectivity and limitations of traditional manual inspection. Ultimately, the high quality standards of meat products before leaving the factory are ensured, thereby improving the food safety and quality assurance level of consumers.
[0121] Example 7
[0122] This embodiment is explained in Example 6. Please refer to Figure 1 Specifically: S42, based on the obtained mildew mask Bmask and blood stain mask Cmask, and then with the obtained appearance freshness index XXD obtained by comprehensive calculation, a comprehensive calculation is performed to obtain a comprehensive quality index PZZ;
[0123] The comprehensive quality index PZZ is calculated by the following algorithm formula:
[0124] ;
[0125] Where M represents the total number of mildew pixels, Bmask m represents the mold mask Bmask of the mth pixel, B represents the total number of blood spot pixels, Cmask b Represents the blood spot mask Cmask of the b-th pixel.
[0126] The step S5 comprises:
[0127] S51, based on the quality index of the meat product, a preset quality threshold value P and the obtained comprehensive quality index PZZ are compared and evaluated to analyze the quality of the meat product;
[0128] The specific evaluation plan is as follows:
[0129] When the comprehensive quality index PZZ>quality threshold P, it means that the quality of the current meat product does not meet the expected freshness standard, and the meat product has mold spots and blood spots;
[0130] When the comprehensive quality index PZZ ≤ the quality threshold P, it means that the quality of the current meat product meets the expected freshness standard.
[0131] In this embodiment, the comprehensive quality index PZZ is calculated by combining the appearance freshness index XXD with the mold mask Bmask and the blood mask Cmask, providing a comprehensive and accurate evaluation method for the quality inspection of meat products. This method can not only quantify the appearance freshness of meat products, but also comprehensively consider the influence of surface defects such as mold and blood spots, thereby realizing an accurate evaluation of the overall quality of meat products. By comparing and analyzing with the preset quality threshold P, meat products that meet and do not meet the freshness standards can be effectively distinguished. This comprehensive detection method not only improves the detection sensitivity and accuracy of meat product quality, but also ensures the safety and compliance of the final product with quality standards. Through systematic data analysis, enterprises can better control product quality, reduce the influx of substandard products into the market, and thus enhance consumer trust and satisfaction.
[0132] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and alterations may be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for detecting the freshness of meat products based on machine vision, characterized in that: The following steps are involved: Step S1: Use a camera to take multiple surface images of meat products under standard lighting conditions to obtain a surface image set and a microscopic image set, and pre-process the normal focus image and the microscopic image to obtain a standard surface image I1. n and standard microscopic image I2 i , and then use sensors to collect gloss data of meat products; Step S2: the acquired standard surface image I1 n and standard microscopic image I2 n Extract color features and texture features to obtain a meat product freshness feature set; Step S3, constructing an algorithm formula to perform calculation and analysis on the extracted meat product freshness feature set and gloss data, obtaining the color index CI, texture roughness TR and glossiness GZ of the meat product, and performing summary calculation to obtain the appearance freshness index XXD, presetting the freshness threshold X and the obtained appearance freshness index XXD, and performing comparative evaluation to preliminarily analyze the freshness of the meat product; Step S4: Standard microscopic image I2 n For each pixel in the image, color analysis is performed to identify the color difference of each pixel of the meat product under the microscopic state, and the mold mask Bmask and the blood mask Cmask are obtained; Step S5, when the meat product is preliminarily evaluated to be fresh, the obtained mold mask Bmask and blood mask Cmask are used to perform correlation calculations to obtain the meat product foreign matter index YW, which is then comprehensively calculated with the obtained appearance freshness index XXD to obtain the comprehensive quality index PZZ, and the quality threshold P is preset for secondary comparative evaluation to deeply analyze the freshness of the meat product.
2. The method for detecting the freshness of meat products based on machine vision according to claim 1, characterized in that: The step S1 comprises: S11, setting a white light source above the surface of the meat product, using a camera and a microscope camera with more than 12 million pixels to shoot six sides of the meat product, namely, the top, bottom, front, back, left and right sides, to obtain a surface image set and a microscope image set of the meat product; S12, placing the photometer in the direction of equal-angle reflection and the angle deviating from the direction of specular reflection with the white light source, and collecting gloss data of the meat product in real time, wherein the gloss data includes the specular reflection light intensity Rs and the diffuse reflection light intensity Rd; S13. Using the OpenCV library, the surface image and the microscopic image are adjusted to the same size according to the scale, and the anti-aliasing technology is applied to smooth the image edges. Then, the image quality of the surface image and the microscopic image of the same size is optimized by adjusting the image compression level and denoising technology. S4. Collect surface image datasets and microscopic image datasets of various historical meat products, annotate them, annotate foreground meat product pixels as white and background pixels as black, and then build a deep learning model. Perform segmentation training and verification on the annotated surface image datasets and microscopic image datasets, optimize the deep learning model, and then input the surface image datasets and microscopic image datasets obtained by real-time shooting into the deep learning model to remove the background and obtain the standard surface image I1. i and standard microscopic image I2 n .
3. The method for detecting the freshness of meat products based on machine vision according to claim 2, characterized in that: The step S2 comprises: S21. Use the image processing library to load the standard surface image I1 n and standard microscopic image I2 n , converted into a pixel data set, using a two-dimensional coordinate system to represent the pixel position, and the standard surface image I1 n and standard microscopic image I2 n The upper left corner is defined as the origin (0,0), the X-axis extends i pixels to the right, and the Y-axis extends j pixels downward to obtain the pixel coordinates (Xi, Yj); S22, then use the color space conversion technology to extract the standard surface image I1 according to the pixel coordinates (Xi, Yj). n and standard microscopic image I2 n Color features of the corresponding coordinates, the color features including a red component R, a green component G, and a blue component B; S23, after extracting the color features, use the OpenCV library to analyze the standard surface image I1 n Convert to grayscale image and extract standard surface image I1 n The grayscale value H of the pixel coordinates (Xi, Yj) is used to generate texture features, and then the texture features and color features are summarized to generate the meat product freshness feature set.
4. The method for detecting the freshness of meat products based on machine vision according to claim 3, characterized in that: The step S3 comprises: S31, constructing a color algorithm formula, and calculating the standard surface image I1 of the meat product based on the color features in the meat product freshness feature set i The color situation is obtained by obtaining the color index CI; The color index CI is calculated by the following algorithm formula: ; Wherein, 0.299, 0.587 and 0.114 are determined by weighting according to the sensitivity of the visual system to different colors.
5. The method for detecting the freshness of meat products based on machine vision according to claim 4, characterized in that: S32, by constructing a texture roughness algorithm formula, the standard surface image I1 of the meat product is calculated based on the texture features in the meat product freshness feature set. i The gray value H is used to obtain the texture roughness TR; The texture roughness TR is calculated by the following algorithm formula: ; Where N represents the image size, Xi represents the i-th pixel point on the X-axis of the image, Yj represents the j-th pixel point on the Y-axis, and I1 n Represents the standard surface image of the nth side of the meat product.
6. The method for detecting the freshness of meat products based on machine vision according to claim 4, characterized in that: S33, performing correlation calculations based on the collected gloss data to obtain the glossiness GZ of the meat product, and analyzing the glossiness of the meat product; The glossiness GZ of the meat product is calculated by the following algorithm formula: 。 7. The method for detecting the freshness of meat products based on machine vision according to claim 6, characterized in that: S34, comprehensively calculating the obtained color index CI, texture roughness TR and glossiness GZ of the meat product to obtain an appearance freshness index XXD to quantify the freshness of the meat product; The appearance freshness index XXD is calculated by the following algorithm formula: ; In the formula, Indicates the color change rate, represents the texture change rate, represents the gloss change rate, w1, w2 and w3 represent the color change rate , Texture change rate and glossiness change rate The preset weight value, the specific parameters are set by the user according to the actual situation, and w1+w2+w3=1, CI0 represents the color index reference value, TR0 represents the texture roughness reference value, GZ0 represents the meat product gloss reference value; S341, the user sets a freshness threshold X of the meat product, and then performs a preliminary comparative evaluation with the acquired appearance freshness index XXD to preliminarily analyze the freshness of the meat product; The specific evaluation plan is as follows: When the appearance freshness index XXD> the freshness threshold X, it means that the currently tested meat product is not fresh; When the appearance freshness index XXD ≤ the freshness threshold X, it means that the currently tested meat product is fresh, and at this time, the meat product is subjected to in-depth testing.
8. The method for detecting the freshness of meat products based on machine vision according to claim 7, characterized in that: The step S4 comprises: S41, calculate the standard microscopic image I2 through the constructed color algorithm formula n The microscopic color index CI2 of each pixel coordinate (Xi, Yj) is calculated, and the color threshold segmentation method is used to obtain the mold mask Bmask and the blood mask Cmask; The mold spot mask Bmask and the blood spot mask Cmask are obtained by the following color threshold segmentation method: ; ; Where CI2(Xi, Yj) represents the color value of the pixel coordinate (Xi, Yj), L min Indicates the valley value of the color of the mildew, L max Indicates the peak value of the color of the mildew stain, T red Indicates the red threshold, which is set by the user according to needs.
9. The method for detecting the freshness of meat products based on machine vision according to claim 8, characterized in that: S42, performing a comprehensive calculation based on the obtained mildew mask Bmask and blood mask Cmask and the obtained appearance freshness index XXD, to obtain a comprehensive quality index PZZ; The comprehensive quality index PZZ is calculated by the following algorithm formula: ; Where M represents the total number of mildew pixels, Bmask m represents the mold mask Bmask of the mth pixel, B represents the total number of blood spot pixels, Cmask b Represents the blood spot mask Cmask of the b-th pixel.
10. The method for detecting the freshness of meat products based on machine vision according to claim 9, characterized in that: The step S5 comprises: S51, based on the quality index of the meat product, a preset quality threshold value P and the obtained comprehensive quality index PZZ are compared and evaluated to analyze the quality of the meat product; The specific evaluation plan is as follows: When the comprehensive quality index PZZ>quality threshold P, it means that the quality of the current meat product does not meet the expected freshness standard, and the meat product has mold spots and blood spots; When the comprehensive quality index PZZ ≤ the quality threshold P, it means that the quality of the current meat product meets the expected freshness standard.
Citation Information
Patent Citations
Meat online non-destructive testing method and apparatus based on fusion of image and spectrum information
CN101551341A
Method for quickly measuring total quantity of livestock meat bacteria based on hyperspectral imaging technology
CN102628794A
Preserved meat quality detection method
CN106290224A
Hyperspectral detection method of color and texture changes in preserved meat salting process
CN106525875A
Prepared meat product quality intelligent evaluation system and method
CN108960315A
Cited By
Purple sand ware identification method and system based on image processing
CN120451288A
