A meat freshness detection method based on machine vision

By using a machine vision-based multi-dimensional detection method, combining a high-pixel camera and a microscope camera with a photometer, the color, texture, and gloss characteristics of meat products are extracted, and multi-dimensional detection indicators are constructed. This solves the problems of low efficiency and insufficient accuracy in meat product freshness detection, and achieves rapid, non-destructive, and accurate quality control.

CN118914185BActive Publication Date: 2025-11-28LINYI JINLUO WENRUI FOOD CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411087158.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2025-11-28
Estimated Expiration
2044-08-09

AI Technical Summary

Technical Problem

Current methods for detecting the freshness of meat products rely on manual inspection and single-focus machine vision, which suffer from low efficiency, high subjectivity, and inability to accurately detect surface abnormalities such as tiny mold spots or blood spots.

Method used

Using a machine vision-based approach, images of meat products are captured from multiple angles using a high-resolution camera and a microscope camera. Gloss data is collected using a photometer. Color and texture features are extracted through image preprocessing and a deep learning model to construct multi-dimensional detection indicators, including color index, texture roughness, and gloss. Mold and blood spot masks are then used for comprehensive evaluation.

Benefits of technology

It enables efficient and accurate detection of the freshness and quality of meat products, reduces human error, provides standardized testing standards, ensures consistent and reliable assessment, and can quickly and non-destructively test large numbers of samples to identify potential quality problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118914185B_ABST
    Figure CN118914185B_ABST
Patent Text Reader

Abstract

The application discloses a kind of meat freshness detection methods based on machine vision, it is related to meat detection field, this method is by using high-pixel camera and microscopic camera under standard illumination condition to six face shooting meat, obtains comprehensive surface image set and microscopic image set.Meanwhile, using photometer real-time collection meat specular reflectance intensity Rs And diffuse reflectance intensity Rd, record its gloss data.Through image pre-processing and feature extraction, obtain color feature extraction and texture feature analysis, and according to the data and features obtained, color index CI, texture roughness TR And gloss GZ.These parameters are dependent on objective image and optical data, avoid the error of artificial subjective judgment, significantly improve the accuracy of detection result.Again through the preset freshness threshold X, the method can provide standardized detection standard for different kinds of meat, ensure the consistency and reliability of evaluation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of meat product detection, in particular to a meat product freshness detection method based on machine vision. BACKGROUND

[0002] Machine vision technology belongs to an important field of artificial intelligence and computer science, aiming to enable computers to understand and interpret visual information like humans. In industrial automation and quality detection, machine vision has become an indispensable tool, widely used in manufacturing, agriculture, and food safety, etc. Specifically in food safety detection, machine vision systems use cameras and image processing algorithms to analyze the features of food surfaces, thereby judging their quality and safety. In the field of meat product detection, machine vision technology is mainly used to monitor the surface conditions 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 tests. 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 state of the inspector, leading to inconsistent detection results. In addition, sensory tests cannot accurately detect small mold spots or blood spots and other surface abnormalities in meat products. For example, when meat products are initially moldy and blood spots are wiped off, visual detection may not easily detect small mold spots or blood spots, thus missing the identification of early quality problems. Although some places have introduced single-focus machine vision detection, it can only detect the macro features of the surface and cannot analyze the micro changes in depth, which limits its application in detecting subtle quality problems. SUMMARY

[0004] In view of the deficiencies of the prior art, the present application provides a meat product freshness detection method based on machine vision, which solves the problems mentioned in the background art.

[0005] To achieve the above purpose, the present application realizes the following technical scheme: a meat product freshness detection method based on machine vision, comprising the following steps:

[0006] Step S1, use a camera to take multiple surface images of the meat product under standard lighting conditions, obtain a set of surface images and a set of microscopic images, and preprocess the normal focus images and microscopic images to obtain a standard surface image I1 n and a standard microscopic image I2 n Then use a sensor to collect the gloss data of the meat product.

[0007] Step S2, further process the obtained standard surface image I1 n and standard microscopic image I2 ncolor features and texture features of the meat product, to obtain a fresh feature set of the meat product;

[0008] In step S3, the extracted fresh feature set of the meat product and the gloss data are calculated and analyzed by a construction algorithm formula to obtain a color index CI, a texture roughness TR and a meat product gloss GZ, and a fresh appearance index XXD is calculated by summarizing, a preset freshness threshold X is compared with the obtained fresh appearance index XXD to preliminarily analyze the freshness of the meat product;

[0009] In step S4, the standard microscopic image I2 n is analyzed to identify the color difference of each pixel point of the meat product in the microscopic state, and a mold spot mask Bmask and a blood spot mask Cmask are obtained.

[0010] In step S5, when the meat product is preliminarily evaluated as fresh, the mold spot mask Bmask and the blood spot mask Cmask are associated to calculate a foreign matter index YW of the meat product, and a comprehensive quality index PZZ is obtained by comprehensive calculation of the obtained fresh appearance index XXD, and a preset quality threshold P is compared for secondary evaluation to deeply analyze the freshness of the meat product.

[0011] Preferably, the step S1 comprises:

[0012] S11, a white light source is arranged above the surface of the meat product, a camera with more than 12 million pixels and a microscope camera are used to take pictures of the upper surface, lower surface, front surface, rear surface, left surface and right surface of the meat product, and a surface image set and a microscopic image set of the meat product are obtained;

[0013] S12, the photometer is placed at an angle of reflection equal to that of the white light source and an angle deviating from the direction of mirror reflection, and the gloss data of the meat product is collected in real time, the gloss data including a mirror reflection light intensity Rs and a diffuse reflection light intensity Rd; the white light source is set at a fixed angle and irradiated onto the surface of the meat product, the photometer is set at an angle of reflection equal to that of the white light source to measure the mirror reflection light intensity Rs, and the photometer is set at an angle of 90 degrees deviating from the direction of mirror reflection to measure the diffuse reflection light intensity Rd, and this setting captures the light diffused in all directions;

[0014] S13, the surface image and the microscopic image are adjusted to the same size according to the scale, the image edges are smoothed by applying the anti-aliasing technology, and the surface image and the microscopic image of the same size are optimized in picture quality by adjusting the compression level and the noise reduction technology of the image;

[0015] S4, collect surface image data sets and microscopic image data sets of a plurality of historical meat products, use a semi-automatic tool to mask the foreground area for each surface image set and microscopic image set, mask the foreground image in the surface image set and the microscopic image set and adjust the foreground pixels to 1 and the background pixels to 0, select U-Net as a deep learning model architecture, build a deep learning model, then divide the surface image set and the microscopic image set into a training set and a validation set, train the deep learning model through the training set, optimize the deep learning model through the validation set, then collect surface image data sets and microscopic image data sets of a plurality of historical meat products, label the foreground meat product pixels as white and the background pixels as black, build a deep learning model, perform segmentation training and verification on the labeled surface image data set and the microscopic image data set, optimize the deep learning model, and input the real-time captured surface image set and the microscopic image set into the deep learning model to remove the background and obtain a standard surface image I1 n and a standard microscopic image I2 n , wherein the standard surface image I1 n represents the nth standard surface image I1, and the standard microscopic image I2 n represents the nth standard microscopic image I2.

[0016] Preferably, the step S2 comprises:

[0017] S21, loading the standard surface image I1 n and the standard microscopic image I2 n into an image processing library, converting them into pixel data groups, using a two-dimensional coordinate system to represent pixel positions, and defining the upper left corner of the standard surface image I1 n and the standard microscopic image I2 n as the origin (0, 0), with the X-axis extending to the right by i pixel points and the Y-axis extending downward by j pixel points to obtain pixel point coordinates (Xi, Yj);

[0018] S22, then according to the pixel point coordinates (Xi, Yj), using color space conversion technology, extracting color features corresponding to the coordinates of the standard surface image I1 n and the standard microscopic image I2 n , wherein the color features include red component R, green component G and blue component B;

[0019] S23, after extracting the color features, using the OpenCV library to convert the standard surface image I1 n into a grayscale image, extracting the grayscale value H of the pixel point coordinates (Xi, Yj) in the standard surface image I1 n to generate texture features, and then combining the texture features and the color features to generate a meat product freshness feature set.

[0020] Preferably, the step S3 comprises:

[0021] S31, constructing a color algorithm formula, calculating the color condition of the standard surface image I1 of the meat product according to the color feature in the fresh feature set of the meat product, and obtaining a color index CI; n

[0022] The color index CI is obtained by the following algorithm formula:

[0023] ;

[0024] In the formula, 0.299, 0.587 and 0.114 are determined according to the sensitivity of the visual system to different colors;

[0025] Green is in the middle wave band in the visible spectrum, and the sensitivity of the human eye to green is high, therefore, the weight of the green channel in the conversion process is the highest, which is 0.587, which reflects the characteristics that the human eye is more sensitive to green;

[0026] The sensitivity of red is lower than that of green, but it is still obvious, and the weight of the red channel is 0.299, which reflects the importance of red to human vision, although its weight is less than that of green;

[0027] The sensitivity of blue is the lowest, so the weight in the formula is the smallest, which is 0.114, because the human eye is less sensitive to short-wavelength blue light than to medium- and long-wavelength red and green light.

[0028] Preferably, S32, constructing a texture roughness algorithm formula, calculating the gray value H of the standard surface image I1 of the meat product according to the texture feature in the fresh feature set of the meat product, and obtaining a texture roughness TR; n

[0029] The texture roughness TR is obtained by the following algorithm formula:

[0030] ;

[0031] In the formula, N represents the image size, Xi represents the i-th pixel point of the X-axis of the image, Yj represents the j-th pixel point of the Y-axis, and I1 n represents the standard surface image of the n-th surface of the meat product.

[0032] Preferably, S33, obtaining the glossiness GZ of the meat product by associated calculation of the collected gloss data, and analyzing the glossiness of the meat product;

[0033] The meat product glossiness GZ is obtained by the following algorithm formula:

[0034] .​​

[0035] Preferably, S34, the acquired color index CI, texture roughness TR and meat glossiness GZ are comprehensively calculated 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, represents the color change rate, represents the texture change rate, represents the glossiness change rate, w1, w2 and w3 respectively represent the preset weight values of the color change rate , the texture change rate and the glossiness change rate , the specific parameters of which 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, and GZ0 represents the meat glossiness reference value;

[0039] S341, set the freshness threshold X of the meat product by the user, and then preliminarily compare and evaluate the obtained appearance freshness index XXD to preliminarily analyze the freshness degree of the meat product;

[0040] The specific evaluation scheme is as follows:

[0041] When the appearance freshness index XXD is greater than the freshness threshold X, it indicates that the current detected meat product is not fresh;

[0042] When the appearance freshness index XXD is less than or equal to the freshness threshold X, it indicates that the current detected meat product is fresh, and at this time, the meat product is subjected to in-depth detection.

[0043] Preferably, the step S4 comprises:

[0044] S41, calculate the microscopic color index CI2 of each pixel point coordinate (Xi, Yj) of the standard microscopic image I2 n using the color algorithm formula constructed, and use the color threshold segmentation method to obtain a mold spot mask Bmask and a blood spot 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] CI2 (Xi, Yj) represents the color value of the (Xi, Yj) pixel point coordinate, L min represents the valley value of the mold spot color, L max represents the peak value of the mold spot color, T red represents the red threshold, which is set by the user according to the needs.

[0049] Preferably, S42, according to the obtained mold mask Bmask and blood mask Cmask, and the appearance freshness index XXD obtained by comprehensive calculation, comprehensive calculation is carried out to obtain the comprehensive quality index PZZ;

[0050] The comprehensive quality index PZZ is calculated and obtained by the following algorithm formula:

[0051] ;

[0052] In the formula, M represents the total number of mold pixel points, Bmask m represents the mold mask Bmask of the mth pixel point, B represents the total number of blood pixel points, and Cmask b represents the blood mask Cmask of the bth pixel point.

[0053] Preferably, the step S5 comprises:

[0054] S51, based on the quality index of the meat product, the preset quality threshold P is compared with the obtained comprehensive quality index PZZ, and the quality of the meat product is evaluated by secondary comparison and analysis;

[0055] The specific evaluation scheme is as follows:

[0056] When the comprehensive quality index PZZ is greater than the quality threshold P, it indicates 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 is less than or equal to the quality threshold P, it indicates that the quality of the current meat product meets the expected freshness standard.

[0058] Beneficial effects

[0059] The application provides a meat product freshness detection method based on machine vision. It has the following beneficial effects:

[0060] (1) The method uses high-pixel cameras and microscopic cameras to capture six images of meat products under standard lighting conditions, obtaining a comprehensive set of surface images and microscopic images. At the same time, a photometer is used to collect the specular reflection intensity Rs and diffuse reflection intensity Rd of the meat product in real time, recording its gloss data. Through image preprocessing, color feature extraction and texture feature analysis, the method can accurately calculate the color index CI, texture roughness TR and gloss GZ. The acquisition of these parameters relies on objective image and optical data, avoiding the error of subjective judgment, significantly improving the accuracy of the detection results. In addition, through the pre-set freshness threshold X, the method can provide standardized detection standards for different types of meat products, ensuring the consistency and reliability of the evaluation.

[0061] (2) The method uses non-contact machine vision technology to quickly obtain the required image data and gloss data without physical damage to the meat product. Through pre-processed image data, combined with the use of deep learning models for feature extraction and background removal, standard surface images I1 n and standard microscopic images I2 n are quickly generated. This rapid detection technology not only reduces the time required for sample preparation and analysis in traditional physical and chemical detection, but also avoids destructive detection of samples, maintaining the integrity of the meat product. In addition, the automated processing of the system allows the detection process to efficiently handle a large number of samples, providing convenience for real-time monitoring and quality control on the production line.

[0062] (3) Through the comprehensive analysis of multiple image features and optical data, the method can comprehensively evaluate the freshness and quality of meat products from multiple dimensions. First, through the extraction and analysis of color features, the calculated color index CI can reflect the color change of the meat product. Second, the texture roughness TR index calculated using texture features provides a quantitative evaluation of the surface texture details of the meat product, and the gloss GZ calculated using gloss data further reflects the smoothness and gloss characteristics of the meat product surface. These multi-dimensional indicators generate an appearance freshness index XXD through comprehensive calculation, and a pre-set freshness threshold X is used for preliminary comparative evaluation. In the case of preliminary evaluation of fresh meat products, the method further uses microscopic image data to analyze the presence of mold spots and blood spots, generating mold spot mask Bmask and blood spot mask Cmask. Through the calculation of these masks, the comprehensive quality index PZZ is obtained, and combined with the pre-set quality threshold P, a secondary evaluation is performed to deeply analyze the quality of the meat product. Such multi-level detection not only allows preliminary judgment of the freshness of meat products, but also detects potential quality problems such as mold spots and blood spots, thereby providing comprehensive and accurate support for food safety control. BRIEF DESCRIPTION OF DRAWINGS

[0063] Figure 1 A meat freshness detection method based on machine vision. DETAILED DESCRIPTION

[0064] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.

[0065] Embodiment 1

[0066] The present application provides a meat freshness detection method based on machine vision, please refer to Figure 1 , comprising the following steps:

[0067] Step S1, using a camera to shoot multiple surface images of the meat product under standard lighting conditions, obtaining a surface image set and a microscopic image set, and preprocessing the normal focal length image and the microscopic image to obtain a standard surface image I1 n and a standard microscopic image I2n, and then using a sensor to collect meat product gloss data;

[0068] Step S2, the color features and texture features of the obtained standard surface image I1 n and the standard microscopic image I2 n are extracted to obtain a meat product freshness feature set;

[0069] Step S3, the meat product freshness feature set and the gloss data extracted are calculated and analyzed by constructing an algorithm formula to obtain the color index CI, the texture roughness TR and the meat product gloss GZ, and the appearance freshness index XXD is calculated by summarizing, the preset freshness threshold X is compared with the obtained appearance freshness index XXD, and the freshness of the meat product is preliminarily analyzed;

[0070] Step S4, the color of each pixel point in the standard microscopic image I2 n is analyzed and identified to obtain the mold spot mask Bmask and the blood spot mask Cmask;

[0071] Step S5, when the meat product is preliminarily evaluated as fresh, the meat product foreign matter index YW is obtained by associated calculation through the obtained mold spot mask Bmask and blood spot mask Cmask, then the comprehensive quality index PZZ is obtained by comprehensive calculation with the obtained appearance freshness index XXD, and the freshness of the meat product is deeply analyzed by secondary comparison and evaluation with the preset quality threshold P.

[0072] The core of the method in this embodiment lies in multi-level and multi-dimensional image analysis and data collection. First, by shooting multiple surface images and microscopic images of the meat product under standard lighting conditions and pre-processing these images, we can accurately obtain standard surface images I1 n and standard microscopic images I2 n At the same time, the gloss data of the meat product is collected through the sensor. 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 extract the color features and texture features of the meat product from the standard surface images and microscopic images to form a new set of fresh features of the meat product. Based on these features, the calculation formulas of color index CI, texture roughness TR and gloss GZ are constructed, and the appearance freshness index XXD is further calculated. This comprehensive calculation method makes the freshness evaluation not only based on a single feature, but also considers multiple aspects such as color, texture and gloss, thereby improving the comprehensiveness and accuracy of the detection. In the detection process, color analysis is performed on each pixel in the standard microscopic image to identify the presence of mold spots and blood spots, and to obtain the mold spot mask Bmask and the blood spot mask Cmask. Through further comprehensive calculation, the comprehensive quality index PZZ is obtained, and a secondary comparison and evaluation with the preset quality threshold P is performed. This multi-level detection and analysis mechanism effectively solves the problem of inaccurate identification of surface defects in traditional methods, thereby improving the reliability of meat product quality control.

[0073] Embodiment 2

[0074] This embodiment is an explanation and illustration in Embodiment 1, please refer to Figure 1 , specifically: the step S1 includes:

[0075] S11, set a white light source above the surface of the meat product, use a camera with more than 12 million pixels and a microscopic camera to shoot the upper surface, lower surface, front surface, back surface, left surface and right surface of the meat product, and obtain a set of surface images and a set of microscopic images of the meat product;

[0076] S12, place the photometer at the same angle as the reflection direction of the white light source and at an angle deviating from the mirror reflection direction to collect the gloss data of the meat product in real time, the gloss data including the specular reflection intensity Rs and the diffuse reflection intensity Rd; set the white light source at a fixed angle to illuminate the surface of the meat product, and use the photometer to measure the specular reflection intensity Rs by setting it at the same angle as the reflection direction of the white light source, and then set the photometer at an angle deviating from the orthogonal direction of the specular reflection, i.e. 90 degrees, to measure the diffuse reflection intensity Rd. This setting captures the light diffused by the surface, i.e. the light scattered in all directions;

[0077] S13, using OpenCV library, adjusting the surface image and the microscopic image to the same size according to the scale, applying anti-aliasing technology to smooth the image edge, and then adjusting the compression level of the image and using denoising technology to optimize the quality of the surface image and the microscopic image of the same size;

[0078] S4, collecting surface image datasets and microscopic image datasets of various historical meat products, using a semi-automatic tool to mask the foreground area of each surface image set and microscopic image set, masking the foreground image in the surface image set and the microscopic image set and adjusting the foreground pixels to 1 and the background pixels to 0, selecting U-Net as the deep learning model architecture, constructing the deep learning model, and then dividing the surface image set and the microscopic image set into training set and validation set, training the deep learning model through the training set, optimizing the deep learning model through the validation set, collecting surface image datasets and microscopic image datasets of various historical meat products, labeling the foreground meat product pixels as white and the background pixels as black, constructing the deep learning model, and then performing segmentation training and verification on the labeled surface image dataset and the microscopic image dataset to optimize the deep learning model, and inputting the real-time captured surface image set and the microscopic image set into the deep learning model to remove the background and obtain the standard surface image I1 n and the standard microscopic image I2 n wherein the standard surface image I1 n represents the nth standard surface image I1, and the standard microscopic image I2 n represents the nth standard microscopic image I2.

[0079] In this embodiment, by accurately setting the light and using high-resolution camera equipment, combined with real-time gloss data collection, the surface and microscopic images of meat products are recorded comprehensively and in detail. This comprehensive shooting method ensures that the surface features at different angles are accurately captured, providing rich data support for subsequent analysis. The accurate setting and measurement of the photometer capture the specular reflection intensity Rs and the diffuse reflection intensity Rd, further enriching the gloss data, making the analysis of meat gloss more comprehensive and accurate. Using OpenCV library for uniform size adjustment and optimization of images not only improves the quality and consistency of images, but also ensures the reliability of subsequent analysis. By annotating historical data using a semi-automatic tool and using U-Net deep learning model for image segmentation training and optimization, the distinction between foreground and background of meat products is more accurate. Such processing and analysis process ensures that the standard surface image I1 n and the standard microscopic image I2 nhigh-quality generation, providing a reliable data foundation for freshness detection of meat products. This process significantly improves the accuracy and efficiency of detection, effectively overcoming the inconsistencies in image quality and insufficient feature extraction that may exist in traditional methods.

[0080] Embodiment 3

[0081] This embodiment is an explanation and illustration in Embodiment 2, please refer to Figure 1 , specifically: the step S2 includes:

[0082] S21, using image processing library to load standard surface image I1 n and standard microscopic image I2 n , convert to pixel data set, use two-dimensional coordinate system to represent pixel position, define the upper left corner of standard surface image I1 n and standard microscopic image I2 n as the origin (0, 0), the X-axis extends to the right by i pixel points, and the Y-axis extends downward by j pixel points, to obtain the pixel point coordinates (Xi, Yj);

[0083] S22, according to the pixel point coordinates (Xi, Yj), using color space conversion technology, extracting the color features of the corresponding coordinates of standard surface image I1 n and standard microscopic image I2 n , the color features include red component R, green component G and blue component B;

[0084] S23, after extracting the color features, using OpenCV library to convert standard surface image I1 n into a grayscale image, and extracting the grayscale value H of the pixel point coordinates (Xi, Yj) in standard surface image I1 n , generating texture features, and then combining the texture features and color features to generate meat product freshness feature set.

[0085] In this embodiment, through the image processing steps, standard surface image I1 n and standard microscopic image I2 n are converted into detailed pixel data sets, ensuring accurate positioning of each pixel. This method accurately represents the position of each pixel using a two-dimensional coordinate system and extracts color features of the image, including red, green and blue components, through color space conversion technology. This process lays the foundation for comprehensive analysis of color features, ensuring accurate capture of color changes in meat products. In addition, by using OpenCV library to convert the surface image into a grayscale image and extracting the grayscale value, texture features are further generated. This method not only improves the accuracy of texture feature extraction, but also enhances the analysis capability of the subtle structure of meat product surface.

[0086] Embodiment 4

[0087] This embodiment is an explanation and illustration in Embodiment 1, please refer to Figure 1 , specifically: the step S3 comprises:

[0088] S31, constructing a color algorithm formula, calculating the color condition of the standard surface image I1 of the meat product according to the color feature in the fresh feature set of the meat product, and obtaining a color index CI; n

[0089] The color index CI is calculated and obtained by the following algorithm formula:

[0090] ;

[0091] In the formula, 0.299, 0.587 and 0.114 are determined according to the sensitivity of the visual system to different colors;

[0092] Green is in the middle wave band in the visible spectrum, and the sensitivity of the human eye to green is high, therefore, the weight of the green channel in the conversion process is the highest, which is 0.587, which reflects the characteristics that the human eye is more sensitive to green;

[0093] The sensitivity of red is lower than that of green, but it is still obvious, and the weight of the red channel is 0.299, which reflects the importance of red to human vision, although its weight is less than that of green;

[0094] The sensitivity of blue is the lowest, so the weight in the formula is the smallest, which is 0.114, because the human eye is less sensitive to short-wavelength blue light than to medium- and long-wavelength red and green light.

[0095] S32, constructing a texture roughness algorithm formula, calculating the gray value H of the standard surface image I1 of the meat product according to the texture feature in the fresh feature set of the meat product, and obtaining a texture roughness TR; n

[0096] The texture roughness TR is calculated and obtained by the following algorithm formula:

[0097] ;

[0098] In the formula, N represents the image size, Xi represents the i-th pixel point of the X axis of the image, Yj represents the j-th pixel point of the Y axis, and I1 n represents the standard surface image of the n-th surface of the meat product.

[0099] S33, calculating and obtaining the glossiness GZ of the meat product by associating the collected gloss data, and analyzing the glossiness of the meat product;

[0100] ​​The meat product glossiness GZ is obtained 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 precise color algorithm formula, texture roughness algorithm formula and glossiness calculation formula. 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 change of the meat product. Second, the calculation of the texture roughness TR is based on the gray value of the image, which provides a deep understanding of the subtle texture changes on the surface of the meat product, making the detection of surface texture more sensitive and accurate. Finally, through the analysis of the gloss data, the calculated glossiness GZ can reflect the gloss change of the surface of the meat product, which is crucial for judging the freshness of the meat product. Overall, the application of these algorithm formulas not only enhances the quantitative analysis ability of the appearance characteristics of the meat product, but also effectively improves the accuracy of the freshness evaluation, overcomes the limitations of traditional methods in processing color, texture and gloss data, and ensures the comprehensiveness and reliability of the detection results.

[0103] Embodiment 5

[0104] This embodiment is an explanation and description in embodiment 4, please refer to Figure 1 , specifically: S34, the obtained color index CI, texture roughness TR and meat product glossiness GZ are comprehensively calculated to obtain the appearance freshness index XXD to quantify the freshness of the meat product;

[0105] The appearance freshness index XXD is obtained by the following algorithm formula:

[0106] ;

[0107] In the formula, represents the color change rate, represents the texture change rate, represents the glossiness change rate, w1, w2 and w3 respectively represent the preset weight values of the color change rate , the texture change rate and the glossiness change rate , the specific parameters of which 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, and GZ0 represents the meat product glossiness reference value;

[0108] S341, set the freshness threshold X of the meat product by the user, and preliminarily compare and evaluate it with the obtained appearance freshness index XXD to preliminarily analyze the freshness of the meat product;

[0109] The specific assessment plan is as follows:

[0110] When the appearance freshness index XXD > the freshness threshold X, it means that the meat product being tested is not fresh.

[0111] When the appearance freshness index XXD ≤ freshness threshold X, it indicates that the meat product being tested is fresh, and in this case, a deeper test is performed on the meat product.

[0112] In this embodiment, the appearance freshness index XXD is obtained by comprehensively calculating the color index CI, texture roughness TR, and gloss GZ, significantly improving the quantitative analysis capability of meat product freshness. This comprehensive calculation method utilizes preset weights for 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 perform preliminary evaluation based on user-defined freshness thresholds, thereby effectively distinguishing between fresh and non-fresh meat products. Specifically, when the appearance freshness index XXD exceeds the set freshness threshold, the system can quickly identify the non-fresh state of the meat product; while when the appearance freshness index XXD is below the quality threshold P, it indicates that the meat product still maintains good freshness, thus entering the further in-depth detection stage. This comprehensive evaluation mechanism provides a more scientific and reliable detection basis, significantly improving detection efficiency and accuracy, and overcoming the problem that a single index cannot comprehensively reflect the actual freshness of meat products.

[0113] Example 6

[0114] This embodiment is an explanation based on Embodiment 3. Please refer to it. Figure 1 Specifically, step S4 includes:

[0115] S41. Calculate the standard microscopic image I2 using the constructed color algorithm formula. n The microscopic color index CI2 of each pixel coordinate (Xi, Yj) is obtained, and the mold mask Bmask and bloodstain mask Cmask are obtained using the color threshold segmentation method.

[0116] The mold spot mask Bmask and bloodstain mask Cmask were obtained using the following color threshold segmentation method:

[0117] ;

[0118] ;

[0119] In the formula, CI2(Xi, Yj) represents the color value of the (Xi, Yj)th pixel coordinate, and L min The valley value, L, represents the color of mold spots. maxPeak value representing the color of mold spots, T red Red threshold value, which is set by the user according to requirements.

[0120] In this embodiment, the mold spot mask Bmask and the blood spot mask Cmask are obtained by using color threshold segmentation method in the microscopic image. This method significantly enhances the detection ability of abnormal states on the surface of meat products. First, the microscopic color index CI2 of each pixel point is calculated using the constructed color algorithm formula, which ensures accurate capture of color details in the microscopic image. Then, by setting the color threshold, the mold spot and blood spot areas are successfully separated from the microscopic image, realizing automatic identification of surface defects of meat products. This method not only improves the accuracy of detection, but also effectively identifies and classifies potential problem areas in meat products, such as mold spots and blood spots, avoiding the subjectivity and limitations of traditional manual inspection. Finally, it ensures the high quality standard of meat products before leaving the factory, thereby improving the level of food safety and quality assurance for consumers.

[0121] Embodiment 7

[0122] This embodiment is an explanation and description in Embodiment 6, please refer to Figure 1 Specifically: S42, according to the obtained mold spot mask Bmask and blood spot mask Cmask, and the appearance freshness index XXD obtained by comprehensive calculation, comprehensive calculation is carried out to obtain the comprehensive quality index PZZ;

[0123] The comprehensive quality index PZZ is calculated and obtained by the following algorithm formula:

[0124] ;

[0125] In the formula, M represents the total number of mold spot pixels, Bmask m represents the mth pixel point mold spot mask Bmask, B represents the total number of blood spot pixels, Cmask b represents the bth pixel point blood spot mask Cmask.

[0126] The step S5 includes:

[0127] S51, based on the quality index of meat products, preset quality threshold P and the obtained comprehensive quality index PZZ, secondary comparison and evaluation analysis the quality of meat products;

[0128] The specific evaluation scheme is as follows:

[0129] When the comprehensive quality index PZZ is greater than the 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 indicator PZZ is less than or equal to the quality threshold P, it indicates that the quality of the current meat product meets the expected freshness standard.

[0131] In this embodiment, the comprehensive quality indicator PZZ is calculated by combining the mold spot mask Bmask and the blood spot mask Cmask with the appearance freshness indicator XXD, providing a comprehensive and accurate evaluation method for meat quality detection. This method not only quantifies the appearance freshness of meat products, but also considers the impact of surface defects such as mold spots and blood spots, achieving accurate evaluation of the overall quality of meat products. By comparing with the preset quality threshold P, it can effectively distinguish meat products that meet and do not meet the freshness standard. This comprehensive detection method not only improves the detection sensitivity and accuracy of meat quality, but also ensures the safety and quality of the final product. Through systematic data analysis, enterprises can better control product quality, reduce the inflow of non-standard products into the market, and thus improve consumer trust and satisfaction.

[0132] Although embodiments of the present application have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the present application, and the scope of the present application 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: Includes the following steps: Step S1: Use a camera to capture multiple surface images of meat products under standard lighting conditions to obtain a surface image set and a microscopic image set. Preprocess the normal focal length images and microscopic images to obtain a standard surface image I1. n and standard microscopic images I2 n Then, sensors are used to collect gloss data of meat products; Step S2: Then process the acquired standard surface image I1 n and standard microscopic images I2 n Feature extraction is performed on color and texture features to obtain a fresh feature set of meat products; Step S3: By extracting the freshness feature set and gloss data of meat products, construct an algorithm formula for calculation and analysis to obtain the color index CI, texture roughness TR and gloss GZ of meat products, and summarize and calculate to obtain the appearance freshness index XXD. The preset freshness threshold X is compared with the obtained appearance freshness index XXD to conduct a preliminary analysis of the freshness of meat products. Step S4: Then examine the standard microscopic image I2. n For each pixel in the image, color analysis is performed to identify the color difference of each pixel in the meat product under microscopic conditions, and mold spot mask Bmask and blood spot mask Cmask are obtained; Step S5: If the meat products are initially assessed as fresh, the foreign matter index YW of the meat products is obtained by correlation calculation using the obtained mold mask Bmask and blood spot mask Cmask. Then, it is combined with the obtained appearance freshness index XXD to obtain the comprehensive quality index PZZ. A second comparative evaluation is performed using a preset quality threshold P to deeply analyze the freshness of the meat products.

2. The method for detecting the freshness of meat products based on machine vision according to claim 1, characterized in that: Step S1 includes: S11. Set a white light source above the surface of the meat product, and use a camera with more than 12 megapixels and a microscope camera to take six-sided pictures of the meat product, including the top, bottom, front, back, left and right sides, to obtain a set of surface images and a set of microscope images of the meat product. S12. Place the photometer at the same angle as the white light source and at an angle deviating from the specular reflection direction to collect gloss data of meat products in real time. The gloss data includes specular reflection light intensity Rs and diffuse reflection light intensity Rd. S13. Using the OpenCV library, adjust the surface image and the microscopic image to the same size according to the scale bar, apply anti-aliasing technology to smooth the image edges, and then optimize the image quality of the surface image and microscopic image of the same size by adjusting the image compression level and noise reduction technology. S14. Collect surface image datasets and microscopic image datasets of various historical meat products. Foreground meat product pixels are labeled white, and background pixels are labeled black. Then, construct a deep learning model. Perform segmentation training and validation on the labeled surface image dataset and microscopic image dataset, optimize the deep learning model, and then input the real-time captured surface image dataset and microscopic image dataset into the deep learning model to remove the background and obtain a standard surface image I1. n and standard microscopic images I2 n .

3. The method for detecting the freshness of meat products based on machine vision according to claim 2, characterized in that: Step S2 includes: S21. Load the standard surface image I1 using the image processing library. n and standard microscopic images I2 n Converted into pixel data sets, pixel positions are represented using a two-dimensional coordinate system, and the standard surface image I1 is used. n and standard microscopic images I2 n The top 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 locate and obtain the pixel coordinates (Xi, Yj). S22. Then, based on the pixel coordinates (Xi, Yj), use color space conversion technology to extract the standard surface image I1. n and standard microscopic images I2 n The color features corresponding to the coordinates, wherein the color features include a red component R, a green component G, and a blue component B; S23. After extracting color features, use the OpenCV library to process 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. Then, the texture features and color features are combined to generate a fresh feature set for meat products.

4. The method for detecting the freshness of meat products based on machine vision according to claim 3, characterized in that: Step S3 includes: S31. Construct a color algorithm formula and calculate the standard surface image I1 of meat products based on the color features in the freshness feature set of meat products. n Based on the color situation, obtain the color index CI; The color index CI is calculated using the following algorithm formula: ; In the formula, 0.299, 0.587 and 0.114 are determined by weighting the visual system’s sensitivity 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, and based on the texture features in the freshness feature set of meat products, the standard surface image I1 of the meat products is calculated. n The grayscale value H is used to obtain the texture roughness TR; The texture roughness TR is calculated using the following algorithm formula: ; In the formula, N represents the image size, Xi represents the i-th pixel on the X-axis, Yj represents the j-th pixel on the Y-axis, and I1 n A standard surface image representing the nth side of a meat product.

6. The method for detecting the freshness of meat products based on machine vision according to claim 4, characterized in that: S33. Based on the collected gloss data, perform correlation calculations to obtain the gloss level GZ of meat products, and analyze the gloss level of meat products. The glossiness GZ of the meat product is calculated using 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. The obtained color index CI, texture roughness TR and meat product gloss GZ are comprehensively calculated to obtain the appearance freshness index XXD to quantify the freshness of meat products. The appearance freshness index XXD is calculated using the following algorithm formula: ; In the formula, Indicates the rate of color change. Indicates the rate of change of texture. The values ​​represent the rate of change in gloss, and w1, w2, and w3 represent the rates of change in color, respectively. Texture change rate and gloss change rate The preset weight values ​​are set by the user according to the actual situation, and w1+w2+w3=1, CI0 represents the color index baseline value, TR0 represents the texture roughness baseline value, and GZ0 represents the meat product gloss baseline value. S341. The user sets a freshness threshold X for meat products, and then compares and evaluates it with the obtained appearance freshness index XXD to conduct a preliminary analysis of the freshness of the meat products. The specific assessment plan is as follows: When the appearance freshness index XXD > the freshness threshold X, it means that the meat product being tested is not fresh. When the appearance freshness index XXD ≤ freshness threshold X, it indicates that the meat product being tested is fresh, and in this case, a deeper test is performed on the meat product.

8. The method for detecting the freshness of meat products based on machine vision according to claim 7, characterized in that: Step S4 includes: S41. Calculate the standard microscopic image I2 using the constructed color algorithm formula. n The microscopic color index CI2 of each pixel coordinate (Xi, Yj) is obtained, and the mold mask Bmask and bloodstain mask Cmask are obtained using the color threshold segmentation method. The mold spot mask Bmask and bloodstain mask Cmask were obtained using the following color threshold segmentation method: ; ; In the formula, CI2(Xi, Yj) represents the color value of the (Xi, Yj)th pixel coordinate, and L min The valley value, L, represents the color of mold spots. max T represents the peak value of the mold spot color. red This indicates the red threshold, which can be set by the user according to their needs.

9. The method for detecting the freshness of meat products based on machine vision according to claim 1, characterized in that: Step S5 includes: S51. Based on the quality indicators of meat products, a second comparative evaluation and analysis of the quality of meat products is conducted using a preset quality threshold P and the obtained comprehensive quality indicator PZZ. The specific assessment plan is as follows: When the comprehensive quality index PZZ > the quality threshold P, it means that the quality of the current meat products does not meet the expected freshness standard, and the meat products have mold and blood spots. When the comprehensive quality index PZZ ≤ quality threshold P, it means that the quality of the current meat products 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