Method and system for detecting food materials of crushing and mixing machines based on image features
The method and system analyze meat ingredients using image features to determine fatness and leanness, enhancing the accuracy of meat detection and blending parameter adjustment in crushing and mixing machines.
Patent Information
- Application Number
- CN202411463398.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-10-21
AI Technical Summary
Existing methods fail to accurately determine the state of meat ingredients based on their fatness or leanness, leading to poor detection of meat ingredients in crushing and mixing machines.
A method and system that analyze meat ingredients using image features, identifying fat and lean meat pixels, characterizing superpixel blocks for arrangement regularity, and performing regional growth based on lean meat and fat indices to obtain state parameters.
Accurately characterizes meat state by analyzing lean meat and fat distribution, ensuring precise adjustment of mixing parameters for optimal blending results.
Smart Images

Figure CN118968504B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method and system for detecting food materials of a crushing and mixing machine based on image features. Background Art
[0002] A food crusher and blender is a very common kitchen appliance. It contains rotating blades and a blender. Through the high-speed rotation of the blades and blender, it can not only quickly crush the ingredients into small blocks or particles, but also evenly mix different ingredients, make ingredients into a slurry, emulsify ingredients, etc. Because it can handle a wide variety of ingredients, it is loved by many families. Adjusting the parameters of the crusher and blender according to the different states of the ingredients can maintain the original taste and flavor of the ingredients, save time and electricity, and extend the service life of the appliance. If the ingredients are not stirred according to the appropriate parameters corresponding to the ingredients, it is likely to cause the ingredients to be over-crushed or not crushed, the texture of the ingredients to change, or even the mixer to heat up or be damaged.
[0003] It is difficult for ordinary people to distinguish the states of different ingredients and choose appropriate stirring parameters. For meat ingredients, stirring parameters are usually selected only according to the type of meat and the degree of cutting. The stirring effect of meat ingredients is usually closely related to the fat and lean meat content in the meat ingredients. The existing analysis method cannot judge the state of meat according to the fatness and leanness of specific meat, resulting in poor detection effect on the state of meat ingredients. Summary of the invention
[0004] In order to solve the technical problem that the prior art cannot judge the state of meat according to the fatness or leanness of specific meat, resulting in poor detection effect of the state of meat ingredients, the purpose of the present invention is to provide a method and system for detecting ingredients of a crushing and mixing machine based on image features. The technical solution adopted is as follows:
[0005] The present invention provides a method for detecting food materials of a crushing and mixing machine based on image features, the method comprising:
[0006] Obtaining a grayscale image of the meat to be blended, and identifying fat pixels and lean meat pixels in the grayscale image of the meat to be blended;
[0007] According to the shape characteristics of each superpixel block in the lean meat area and the arrangement of the local superpixel blocks, the arrangement regularity of each superpixel block is obtained; the lean meat area is an area composed of lean meat pixels;
[0008] In the preset detection window of each pixel, the lean meat index of each pixel is obtained according to the distribution texture characteristics of the lean meat pixel in the preset detection window, and the distribution characteristics and arrangement regularity of the super pixel block in the preset detection window; the fat index of each pixel is obtained according to the distribution characteristics of the fat pixel in the preset detection window corresponding to each pixel; in the grayscale image of the meat to be blended, the growth criterion is obtained according to the lean meat index and the fat index of the pixel to perform regional growth, and the number of regions of the grayscale image of the meat to be blended is obtained;
[0009] According to the number of regions of the grayscale image of the meat to be blended, the arrangement regularity of all superpixel blocks and the proportion of fat pixels, the state parameters of the meat corresponding to the grayscale image of the meat to be blended are obtained.
[0010] Furthermore, the method for obtaining the arrangement regularity is:
[0011] Taking any superpixel block as the target superpixel block, normalizing the ratio of the area to the perimeter of the target superpixel block to obtain the shape regularity of the target superpixel block;
[0012] Taking any pixel point on the edge of the target superpixel block as the target pixel point, obtaining a target straight line along the gradient direction of the target pixel point, and obtaining the intersection point between the target straight line and the edge of other superpixel blocks; on the target straight line, taking the distance between the first intersection points on both sides of the target pixel point as the first distance, and taking the distance between the second intersection points on both sides of the target pixel point as the second distance;
[0013] When both the first distance and the second distance of the target pixel point exist, the local regularity of the target pixel point is obtained according to the first distance and the second distance of the target pixel point, and if the local regularity is less than zero, the local regularity is set to a preset local regularity; when the first distance and the second distance of the target pixel point cannot exist at the same time, the local regularity of the target pixel point is set to a preset local regularity;
[0014] Taking the average of the local regularity of all pixels on the edge of the target superpixel block as the distribution regularity of the target superpixel block;
[0015] The arrangement regularity of each super pixel block is obtained according to the shape regularity and the distribution regularity of each super pixel block, and both the shape regularity and the distribution regularity are positively correlated with the arrangement regularity.
[0016] Furthermore, the specific expression of the local regularity is:
[0017] ;
[0018] In the formula, Represented as the first The local regularity of each pixel, Represented as the first The first distance of pixels, Represented as the first The second distance of pixels, Expressed as adjustment coefficient.
[0019] Furthermore, the method for acquiring the distribution texture feature includes:
[0020] Any pixel in the grayscale image of the meat to be blended is used as a reference pixel;
[0021] Obtaining a gradient direction histogram of lean meat pixels according to the gradient directions of all lean meat pixels in a preset detection window corresponding to the reference pixel, calculating the proportion of the number of lean meat pixels corresponding to the maximum gradient direction distribution in the gradient direction histogram to the total number of pixels in the preset detection window, and obtaining a direction probability of the reference pixel;
[0022] The contrast of the grayscale values of all lean meat pixels in the preset detection window is calculated as the grayscale contrast of the reference pixel; the distribution texture characteristics of the reference pixel are obtained according to the grayscale contrast of the reference pixel and the direction probability, and the grayscale contrast and the direction probability are both positively correlated with the distribution texture characteristics.
[0023] Furthermore, the method for obtaining the lean meat index includes:
[0024] According to the distribution density of the super pixel block in the preset detection window corresponding to the reference pixel, the distribution density feature of the reference pixel is obtained; the product of the distribution texture feature of the reference pixel and the distribution density feature is normalized to obtain the lean meat distribution degree of the reference pixel;
[0025] If the reference pixel is a lean meat pixel, the superpixel block where the reference pixel is located is used as the reference superpixel block corresponding to the reference pixel; if the reference pixel is a fat pixel, the superpixel block closest to the reference pixel is used as the reference superpixel block corresponding to the reference pixel;
[0026] According to the lean meat distribution degree of the reference pixel point and the arrangement regularity of the corresponding reference superpixel block, a lean meat index of the reference pixel point is obtained, and both the lean meat distribution degree and the arrangement regularity are positively correlated with the lean meat index.
[0027] Furthermore, the specific expression of the distribution density feature is:
[0028] ;
[0029] In the formula, Expressed as The distribution density characteristics of pixels, It is expressed as the total number of pixels in the grayscale image of the meat to be stirred. Expressed as The pixel points correspond to the side length of the preset detection window. It is represented by the total number of superpixel blocks in the grayscale image of the meat to be blended, Expressed as The total number of superpixel blocks corresponding to the preset detection window.
[0030] Furthermore, the method for obtaining the fat index includes:
[0031] Any pixel in the grayscale image of the meat to be blended is used as a detection pixel; the position code of each fat pixel in the preset detection window corresponding to the detection pixel is obtained; the shortest distance between the detection pixel and the edge of the corresponding preset detection window is used as the number of detection circles;
[0032] When the number of detection circles is less than or equal to the preset initial number of detection circles, the preset fat index is used as the fat index of the detection pixel point;
[0033] When the number of detection circles is greater than the preset initial detection circle number, an arrangement sequence of all fat pixels in a preset detection window corresponding to the detection pixel is obtained according to a preset arrangement order; when the number of fat pixels in the arrangement sequence is less than or equal to the preset fat number, the preset fat index is used as the fat index of the detection pixel; when the number of fat pixels in the arrangement sequence is greater than the preset fat number, the difference in the position code between each two adjacent fat pixels in the arrangement sequence is calculated to obtain the position difference, and the average value of all the position differences in the arrangement sequence is used as the fat index of the detection pixel;
[0034] The preset arrangement order is: taking the detection pixel point as the starting point, and placing the fat pixel points in each circle in the preset detection window in the arrangement sequence in order from the starting point outward in the order of increasing circle numbers from 1.
[0035] Furthermore, the step of acquiring a growth criterion according to the lean meat index and the fat index of the pixel point to perform regional growth and obtain the number of regions of the grayscale image of the meat to be stirred includes:
[0036] According to the lean meat index and the fat index of each pixel point, a growth index of each pixel point is obtained, wherein the lean meat index and the fat index are both positively correlated with the growth index;
[0037] Any pixel point in the grayscale image of the meat to be stirred is used as a growth point, and regional growth is performed according to the growth criterion to obtain a growth area; after the growth is completed, any pixel point outside the growth area in the grayscale image of the meat to be stirred is used as a new growth point to perform iterative regional growth until there is no new growth point for regional growth and the growth stops;
[0038] The growth criterion is: when the difference in growth index between the pixel to be grown and the growth point is less than or equal to a preset growth threshold, growth can be performed; the pixel to be grown is a pixel in a preset neighborhood range of the growth point;
[0039] The number of all growth regions in the grayscale image of the meat to be stirred is counted as the number of regions of the grayscale image of the meat to be stirred.
[0040] Furthermore, the method for obtaining the state parameter includes:
[0041] The average of the arrangement regularity of all superpixel blocks in the grayscale image of the meat to be blended is taken as the average arrangement regularity of the grayscale image of the meat to be blended;
[0042] According to the number of regions of the grayscale image of the meat to be stirred, the average arrangement regularity and the proportion of fat pixels, the state parameters of the grayscale image of the meat to be stirred are obtained. The average arrangement regularity is positively correlated with the state parameters, and the number of regions and the proportion are negatively correlated with the state parameters.
[0043] The present invention also provides a crushing and mixing machine food detection system based on image features, including a memory and a processor, and the processor executes a computing program stored in the memory to implement a crushing and mixing machine food detection method based on image features as described above.
[0044] The present invention has the following beneficial effects:
[0045] 1. The present invention analyzes the shape and arrangement of superpixel blocks in the lean meat area in the grayscale image of the meat to be stirred, obtains the arrangement regularity of each superpixel block, reflects the arrangement structural characteristics of each muscle fiber bundle, and can characterize the regular tightness of the meat surface texture. Further, through the distribution of lean meat and fat of each pixel in the preset detection window, the lean meat index and fat index are obtained, and the local characteristics of each pixel are comprehensively characterized. The growth criteria of the pixel points are defined according to the lean meat index and the fat index to perform regional growth, so that the meat characteristics characterized by the pixels in the obtained growth area are more consistent, and the number of regions obtained is more reliable, which meets the analysis of the number of meat pieces. Finally, the state parameters of the corresponding meat are obtained by combining the number of regions of the grayscale image of the meat to be stirred, the arrangement regularity of the superpixel blocks and the proportion of fat pixels. The state parameters of the meat are comprehensively evaluated from the number of overall meat pieces, the lean muscle fiber analysis of the meat pieces and the fat proportion analysis of the meat pieces, so that the state detection of the overall meat in the crushing and stirring machine is more accurate and the detection results are more reliable.
[0046] 2. In the process of characterizing the local features of each pixel and then performing regional growth, considering that the surface features corresponding to meat often have two different surface features, lean meat and fat, the local features of the pixels are comprehensively analyzed to consider both lean meat and fat. When obtaining the lean meat index, not only the texture distribution of the lean meat part is considered, but also the distribution of the local muscle fiber bundles is analyzed to obtain a more comprehensive lean meat index. At the same time, considering the different characteristics of meat fat distribution, the fat index is further obtained according to the distribution of fat pixels. This makes the region obtained by regional growth based on the lean meat index and fat index more reliable and the regional division more accurate, so that the number of regions has a higher accuracy for the subsequent characterization of the meat state. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0048] Figure 1 A flow chart of a method for detecting food materials in a crushing and mixing machine based on image features provided by an embodiment of the present invention;
[0049] Figure 2 A schematic diagram of obtaining a first distance and a second distance corresponding to a pixel point provided by an embodiment of the present invention;
[0050] Figure 3A schematic diagram of an arrangement sequence of fat pixels in a preset detection window corresponding to pixels obtained according to an embodiment of the present invention;
[0051] Figure 4 A flow chart of a method for adjusting mixing parameters of a crushing and mixing machine based on image features provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0052] Embodiment of a method and system for detecting food materials in a crushing and mixing machine based on image features:
[0053] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation method, structure, features and effects of a food detection method and system for a crushing and mixing machine based on image features proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0054] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0055] The following is a detailed description of a method and system for detecting food materials in a crushing and mixing machine based on image features provided by the present invention in conjunction with the accompanying drawings.
[0056] See also Figure 1 , which shows a flow chart of a method for detecting food materials of a crushing and mixing machine based on image features provided by an embodiment of the present invention, the method comprising the following steps:
[0057] S1: Obtain a grayscale image of the meat to be blended, and identify fat pixels and lean meat pixels in the grayscale image of the meat to be blended.
[0058] When using a blender to blend meat ingredients, the blending parameters need to be adjusted for different meats because the density of the tissues of different meats is different. The speed adjustment of traditional blenders is usually based on general settings, without personalized adjustments for the fatness of specific meats. This means that no matter how fat or lean the meat is, the blender will run at the preset speed. Fatter meat usually contains more oil, so it will produce more lubrication when blending, and requires a lower speed to fully blend. Leaner meat is relatively dry and requires a higher speed to ensure full mixing and processing. Taking the most common beef, pork and lamb as examples, beef has a coarse texture and a tighter texture, so it is necessary to choose a high speed, strong power and a longer blending time to ensure that the meat is completely broken. Lamb has a delicate texture, so you can choose a lower speed and a moderate blending time. Pork has soft muscles and is easy to blend. It can be broken up in a short time using medium and low speeds.
[0059] However, if the mixing parameters are adjusted only for different types of meat, the mixing results will be poor, because even beef with dense meat has parts with high fat content, and pork with soft meat has parts with dense fibers. In addition, the different degrees of meat cutting also directly affect whether the meat ingredients are easy to break. Therefore, before mixing, the surface condition of the meat in the mixing machine can be analyzed to obtain the state parameters of the meat.
[0060] First, a micro CCD (Charge-Coupled Device) camera with good packaging and perfect protection is installed on the inner wall of the blender to prevent moisture and food from infiltrating and affecting image acquisition. The position and angle of the camera are adjusted to ensure that the surface condition of the entire meat food can be clearly captured. The CCD camera is used to collect the image of the meat to be blended that has not been blended yet in the blender. The collected image of the meat to be blended is grayed, and filtered to remove most of the noise in the image. Image enhancement is then performed to provide a clearer image for subsequent food detection. Finally, the background is removed to obtain a grayscale image of the meat to be blended. It should be noted that the method of graying the image, denoising and enhancing the image, and finally removing the background is an image preprocessing method well known to those skilled in the art, such as using median filtering to denoise, using a single-scale retina cortex theory (Retina Cortex, Retinex) algorithm for image enhancement, and background difference method to remove the background, etc., which will not be repeated here.
[0061] Since the meat block is composed of a lean meat part and a fat part, and the contrast between the lean meat part and the fat part is clear, the Otsu threshold method can be used to segment the two parts well. In an embodiment of the present invention, the Otsu threshold algorithm is used for the pre-processed grayscale image of the meat to be stirred, and pixel points are segmented according to the segmentation threshold value, and the pixel points greater than the segmentation threshold value are regarded as fat pixel points, and the pixel points less than or equal to the segmentation threshold value are regarded as lean meat pixel points. It should be noted that the Otsu threshold algorithm is a technical means well known to those skilled in the art, and its segmentation threshold value is selected by the algorithm adaptively, which will not be described in detail here.
[0062] At this point, the fat pixels and lean meat pixels corresponding to different parts of the meat in the grayscale image of the meat to be stirred are obtained, which is convenient for subsequent analysis of the meat state.
[0063] S2: According to the shape characteristics of each superpixel block in the lean meat area and the arrangement of the local superpixel blocks, the arrangement regularity of each superpixel block is obtained; the lean meat area is the area composed of lean meat pixels.
[0064] The lean part of the meat contains a linear muscle fiber bundle structure. The analysis of muscle fibers can reveal the firmness of the meat. Due to the different amounts of exercise, growth rates, and muscle composition of animals, the distribution of muscle fiber bundles inside is also different. For example, cattle have a large amount of exercise and grow slowly, so their muscle fiber bundles are usually arranged in parallel, tightly, and thick and long. Pigs have a small amount of exercise and grow quickly, so their muscle fiber bundles appear in a staggered arrangement to form a mesh structure, which is loosely arranged, and the fiber bundles are small and short. The arrangement, tightness, and length of mutton muscle fiber bundles are between beef and pork.
[0065] Therefore, the distribution of fiber bundles can characterize the firmness of meat. It is preferred to separate the muscle fiber bundle structure in the lean meat area to facilitate the subsequent analysis of the fiber distribution. In the embodiment of the present invention, the area composed of all lean meat pixels is taken as the lean meat area, and the SLIC (Simple Linear Iterative Cluster) superpixel segmentation algorithm is used in the lean meat area to obtain a preset number of superpixel blocks, where the number of superpixel blocks is set based on experience.
[0066] In the embodiment of the present invention, the preset number of segmentations is set according to the total number of pixels in the lean meat area. It is known from experience that the number of pixels in the muscle fiber bundle is about 5% of the lean meat area. The number of superpixel blocks is controlled according to the number of pixels in the lean meat area so that the superpixel blocks can cover a muscle fiber bundle structure. That is, the preset number of segmentations in the embodiment is the total number of pixels in the lean meat area divided by 20 and rounded down. The specific value can be adjusted by the implementer according to the specific implementation situation. It should be noted that the SLIC superpixel segmentation algorithm is a technical means well known to those skilled in the art and will not be described in detail here.
[0067] Since adjacent superpixel blocks have similar texture, color, brightness and other features, each superpixel block in the lean meat area contains a basic muscle fiber bundle structure, and each superpixel block can be considered as a pseudo muscle fiber bundle. Furthermore, according to the shape characteristics and local arrangement of each superpixel block, the arrangement regularity of each superpixel block is obtained, that is, according to the shape and distribution of the muscle fiber bundle structure, the arrangement of the muscle fiber bundle is obtained.
[0068] Firstly, any superpixel block is taken as a target superpixel block, and the target superpixel block is analyzed to make the method of obtaining the arrangement regularity of each superpixel block clearer. Firstly, the shape characteristics of the target superpixel block itself are analyzed.
[0069] The more regular the shape of the target superpixel block itself is, the more regularly the local superpixel blocks of the target superpixel block can be arranged. Therefore, the ratio of the area to the perimeter of the target superpixel block is normalized to obtain the shape regularity of the target superpixel block. Since the area of each superpixel block is relatively similar, the larger the perimeter, the more complex the edge of the target superpixel block is, and the smaller the shape regularity is.
[0070] The distribution is further reflected according to the regularity of other super-pixel blocks around the target super-pixel block. Preferably, any pixel point on the edge of the target super-pixel block is used as the target pixel point, a target straight line is obtained along the gradient direction of the target pixel point, and the intersection of the target straight line and the edge of other super-pixel blocks is obtained. When the target super-pixel block is relatively regular, the target straight line can be regarded as a vertical line on the edge where the target pixel point is located. Through the intersection position of the target straight line and the edge of other super-pixel blocks, the change in the spacing between the target super-pixel block at the target pixel point and other surrounding super-pixel blocks can be further calculated. It should be noted that the method for calculating the gradient direction of a pixel point is a technical means well known to those skilled in the art, and will not be repeated here.
[0071] Since the distribution of super pixel blocks is in an adjacent distribution state, the edge where the target pixel is located can also be regarded as the edge between two adjacent super pixel blocks, and on the target straight line, there are different intersections from near to far on both sides of the target pixel. The distance between the first intersections on both sides of the target pixel is taken as the first distance, and the first distance is the spacing between the two adjacent super pixel blocks corresponding to the target pixel at this position. The distance between the second intersections on both sides of the target pixel is taken as the second distance, and the second distance is the spacing between the four adjacent super pixel blocks corresponding to the target pixel at this position. It should be noted that the calculation of the distance between two points is a technical means well known to those skilled in the art, such as using Euclidean distance calculation, etc., which is not limited here.
[0072] See also Figure 2 , which shows a schematic diagram of obtaining the first distance and the second distance corresponding to a pixel point provided by an embodiment of the present invention. Figure 2 In the figure, 1-4 represent four adjacent superpixel blocks, 2 is taken as the target superpixel block, S is taken as the target pixel point, then S1 represents the first intersection point on both sides of the target pixel point, and the distance between two S1s is the first distance, S2 represents the second intersection point on both sides of the target pixel point, and the distance between two S2s is the second distance.
[0073] In one embodiment of the present invention, when both the first distance and the second distance of the target pixel point exist, the local regularity of the target pixel point is obtained according to the first distance and the second distance of the target pixel point, and the change of the local spacing of the super pixel block can be reflected by the first distance and the second distance. The specific expression of the local regularity is:
[0074] ;
[0075] In the formula, Represented as the first The local regularity of each pixel, Represented as the first The first distance of pixels, Represented as the first The second distance of pixels, It is expressed as an adjustment coefficient, which is set to 0.001 in the present invention in order to prevent the denominator from being zero, making the formula meaningless.
[0076] in It is expressed as the distance between two adjacent superpixel blocks represented by the first distance. When it extends outward to four adjacent superpixel blocks, the extended distance is expressed by It represents the degree of difference between the extended spacing and the first distance. When the data values between the numerator and the denominator are closer, that is, the degree of difference is closer to 1, it means that the spacing does not change much at this time. The small change in spacing indicates that the distribution arrangement of the superpixel blocks is also relatively regular. The local distribution of the target superpixel block at the target pixel position is relatively regular. Therefore, the greater the local regularity of each pixel point, the more regular the local distribution at the target pixel point position may be.
[0077] If the local regularity is less than zero, it means that the difference between the spacings is large, and the distribution of the local superpixel blocks cannot be arranged regularly. In order to prevent the local regularity from affecting subsequent calculations when it is negative, the local regularity is set to the preset local regularity. And when the first distance and the second distance of the target pixel point cannot exist at the same time, it means that the position of the target superpixel block corresponding to the target pixel point is at a relatively marginal position. At this time, the local adjacent superpixel blocks of the target superpixel block are insufficient, and the distribution regularity cannot be characterized according to the change in spacing. Therefore, the local regularity of the target pixel point at this time is set to the preset local regularity. In the embodiment of the present invention, the preset local regularity is 0, and the specific numerical value can be adjusted by the implementer according to the specific situation.
[0078] Combined with the local regularity of all pixels on the edge of the target superpixel block, the distribution of the overall local superpixel block of the target superpixel block is obtained. Preferably, the average value of the local regularity of all pixels is taken as the distribution regularity of the target superpixel block.
[0079] The regularity of arrangement of each superpixel block is further obtained by combining the shape feature and the distribution feature. The regularity of arrangement of each superpixel block is obtained according to the shape regularity and the distribution regularity of each superpixel block. The arrangement regularity reflects the arrangement of the superpixel block and the compactness of the muscle fiber bundle distribution. The shape regularity and the distribution regularity are both positively correlated with the arrangement regularity. In the embodiment of the present invention, the specific expression of the arrangement regularity is:
[0080] ;
[0081] In the formula, Expressed as The regularity of the arrangement of superpixel blocks, Expressed as The area of a superpixel block, Expressed as The perimeter of a superpixel block, that is, the total number of edge pixels, Represented as the first The local regularity of each pixel, It is expressed as a normalization function. It should be noted that normalization is a technical means well known to those skilled in the art. The normalization function can be linear normalization or standard normalization, etc. The specific normalization method is not limited here.
[0082] in, Expressed as The regularity of the shape of a superpixel block. Since the superpixel block exists, the perimeter must also exist. There will be no situation where the denominator is meaningless. Expressed as The distribution regularity of each super pixel block. Multiplication is used to reflect that both the shape regularity and the distribution regularity are positively correlated with the arrangement regularity. In other embodiments of the present invention, other basic mathematical operations can also be used to reflect that both the shape regularity and the distribution regularity are positively correlated with the arrangement regularity, such as addition, power operation, etc., which will not be elaborated here.
[0083] At this point, the preliminary arrangement analysis of each superpixel block in the lean meat area is completed, that is, the distribution compactness of each muscle fiber bundle. The more regular the arrangement of the superpixel blocks, the tighter the muscle fiber bundles.
[0084] S3: In the preset detection window of each pixel, the lean meat index of each pixel is obtained according to the distribution texture characteristics of the lean meat pixels in the preset detection window, and the distribution characteristics and arrangement regularity of the superpixel blocks in the preset detection window; the fat index of each pixel is obtained according to the distribution characteristics of the fat pixels in the preset detection window corresponding to each pixel; in the grayscale image of the meat to be stirred, the growth criterion is obtained according to the lean meat index and fat index of the pixel to perform regional growth, and the number of regions of the grayscale image of the meat to be stirred is obtained.
[0085] Since the texture characteristics and colors of different meat pieces are similar, and the internal texture of the meat pieces is relatively complex, it is difficult to segment different meat pieces, and it is difficult to directly judge the size of the meat pieces from the edges and then adjust the stirring parameters. Therefore, the present invention uses regional growing to segment different meat pieces. Since there may be both lean meat and fat in the meat pieces, the growth criteria of the pixel points are adjusted according to the local distribution of lean meat and fat at the pixel points, so that the regional growing can accurately segment different meat block areas.
[0086] First, a preset detection window corresponding to each pixel is obtained, and the lean meat and fat situation of each pixel is obtained by analyzing the pixel points in the preset detection window. Preferably, the method for obtaining the preset detection window is to construct a grayscale image of the meat to be stirred with each pixel as the center. The window, where Start traversing from 1 until there is at least lean pixels and The method for constructing a window in this embodiment can make the consideration of local lean meat pixels and fat pixels equal, so that the analysis result of the distribution of lean meat and fat in each preset detection window is more accurate. If the preset detection window cannot be obtained according to the stop condition, the stop condition can be lowered to ensure that each pixel can obtain a preset detection window. In other embodiments of the present invention, the size of the preset detection window can also be directly set, which is not limited here.
[0087] Furthermore, the lean meat distribution corresponding to the lean meat pixels in the preset detection window of each pixel is analyzed, and the lean meat index of each pixel in the preset detection window is comprehensively characterized from three aspects: the distribution texture of the lean meat pixels in the preset detection window, the distribution of superpixel blocks and the arrangement regularity of superpixel blocks in the preset detection window.
[0088] In an embodiment of the present invention, any pixel in the grayscale image of the meat to be stirred is first used as a reference pixel, and a local analysis is performed on the preset detection window of the reference pixel. The gradient direction histogram of the lean meat pixel is obtained according to the gradient direction of all lean meat pixel points in the preset detection window corresponding to the reference pixel point. The gradient histogram can clearly reflect the main distribution direction of the texture corresponding to the lean meat pixel point, and the proportion of the number of lean meat pixel points corresponding to the total number of pixels in the preset detection window when the gradient direction is most distributed in the gradient direction histogram is calculated to obtain the direction probability of the reference pixel point, wherein when the gradient direction is most distributed, the gradient direction is the main direction of the lean meat texture distribution corresponding to the gradient direction, and the direction probability is the probability that the texture corresponding to the lean meat pixel point is the main direction. It should be noted that the method of obtaining the histogram is a technical means well known to those skilled in the art, and will not be elaborated here.
[0089] Preferably, a grayscale co-occurrence matrix is used to calculate the contrast of the grayscale values of all lean meat pixels in a preset detection window as the grayscale contrast of the reference pixels. The grayscale contrast can reflect the grayscale differences between muscle fiber bundles through the distribution of grayscale levels. The greater the grayscale contrast, the more complex the texture corresponding to the lean meat pixels in the preset detection window. In other embodiments of the present invention, the standard deviation of the grayscale values of the lean meat pixels in the preset detection window can also be used as the grayscale contrast, which is not limited here. It should be noted that the grayscale co-occurrence matrix and the standard deviation methods are both technical means well known to those skilled in the art and will not be elaborated here.
[0090] Since the arrangement direction of the muscle fiber bundles presents a very clear directional feature, the larger the directional probability, the more obvious the current structure of the muscle fiber bundles in the preset detection window, and the tighter the arrangement of the muscle fiber bundles. The grayscale contrast reflects the grayscale distribution of the muscle fiber bundles in the preset detection window. The larger the grayscale contrast, the clearer the texture between the tightly arranged muscle fiber bundles, that is, the edge of the muscle fiber bundle is more clearly visible. Therefore, the compactness of the muscle fiber bundle is positively correlated with the grayscale contrast. The distribution texture features of the reference pixel are obtained based on the grayscale contrast and directional probability of the reference pixel. The distribution texture features can reflect the compact arrangement of the texture, and the grayscale contrast and directional probability are both positively correlated with the distribution texture features. In an embodiment of the present invention, the expression of the distribution texture features is:
[0091] ;
[0092] In the formula, Expressed as The distribution texture features of pixels, Expressed as The grayscale contrast of each pixel, Expressed as The direction probability of a pixel.
[0093] The grayscale contrast and directional probability are both positively correlated with the distribution texture characteristics through multiplication. In other embodiments of the present invention, other basic mathematical operations can also be used to reflect that the grayscale contrast and directional probability are both positively correlated with the distribution texture characteristics, such as addition, power operation, etc., which are not limited here.
[0094] Furthermore, the distribution of superpixels in the preset window corresponding to the reference pixel is analyzed, and the distribution density feature of the reference pixel is obtained according to the distribution density of the superpixel blocks in the preset detection window corresponding to the reference pixel. In the embodiment of the present invention, the specific expression of the distribution density feature is:
[0095] ;
[0096] In the formula, Expressed as The distribution density characteristics of pixels, It is expressed as the total number of pixels in the grayscale image of the meat to be stirred. Expressed as The pixel points correspond to the side length of the preset detection window. It is represented by the total number of superpixel blocks in the grayscale image of the meat to be blended, Expressed as The total number of superpixel blocks corresponding to the preset detection window.
[0097] in, Expressed as per The size of the preset detection window of pixels is the number of windows that can be obtained when dividing the grayscale image of the stirred meat. and Ratio Indicated in The average number of superpixel blocks in each window corresponding to the preset detection window size is expressed as and The ratio indicates the current The density of the number of superpixel blocks in the preset detection window corresponding to each pixel point relative to the average number can reflect the distribution density characteristics of the superpixel blocks in the preset window corresponding to the pixel point. It should be noted that since the superpixel blocks in the preset window of each pixel point may not all be complete superpixel blocks, in an embodiment of the present invention, only the number of complete superpixel blocks is calculated as the total number of superpixel blocks in the preset detection window corresponding to the pixel point. In other embodiments of the present invention, incomplete superpixel blocks may also be recorded as superpixel blocks in the preset detection window corresponding to the pixel point, and there is no limitation here.
[0098] According to the distribution texture feature and distribution density feature corresponding to the reference pixel, the distribution degree of lean meat in the preset detection window corresponding to the reference pixel can be reflected. Preferably, the product of the distribution texture feature and the distribution density feature of the reference pixel is normalized to obtain the lean meat distribution degree of the reference pixel. When the distribution texture feature of the reference pixel is larger, the lean meat texture feature corresponding to the reference pixel is more obvious and compact. When the distribution density feature of the reference pixel is larger, the distribution of the muscle fiber bundle of the lean meat corresponding to the reference pixel is denser, so the lean meat distribution degree of the reference pixel will also be larger.
[0099] The distribution regularity of lean meat is further characterized by the arrangement regularity of the muscle fiber bundles corresponding to the reference pixel points. The greater the arrangement regularity of the muscle fiber bundles corresponding to the lean meat, the more regular the distribution of the muscle fiber bundles corresponding to the lean meat. Preferably, a reference super-pixel block corresponding to the reference pixel point is obtained. If the reference pixel point is a lean meat pixel point, the super-pixel block where the reference pixel point is located is used as the reference super-pixel block corresponding to the reference pixel point. If the reference pixel point is a fat pixel point, the super-pixel block closest to the reference pixel point is used as the reference super-pixel block corresponding to the reference pixel point.
[0100] According to the arrangement regularity corresponding to the reference superpixel block and the lean meat distribution degree, the lean meat distribution is analyzed and expressed more comprehensively, that is, according to the lean meat distribution degree of the reference pixel point and the arrangement regularity of the corresponding reference superpixel block, the lean meat index of the reference pixel point is obtained. The lean meat distribution degree and the arrangement regularity are both positively correlated with the lean meat index. In the embodiment of the present invention, the specific expression of the lean meat index is:
[0101] ;
[0102] In the formula, Expressed as The lean meat index of each pixel, Expressed as The regularity of the arrangement of the reference superpixel blocks corresponding to the pixels. Expressed as The distribution texture features of pixels, Expressed as The distribution density characteristics of pixels, Expressed as a normalized function.
[0103] in, Expressed as The lean meat distribution degree of each pixel point is reflected by multiplication. The lean meat distribution degree and the arrangement regularity are both positively correlated with the lean meat index. When the lean meat distribution degree is larger, the distribution texture of the lean meat part is more obvious and the texture is denser. When the arrangement regularity is larger, the muscle fibers of the lean meat part are more regular. Then, the larger the lean meat index is, the more regular and dense the distribution of the muscle fibers of the lean meat part is. In other embodiments of the present invention, other basic mathematical operations can also be used to reflect that the lean meat distribution degree and the arrangement regularity are both positively correlated with the lean meat index, such as addition, power operation, etc., which are not limited here.
[0104] After completing the distribution analysis of the lean meat part in the preset detection window of each pixel point, the fat distribution in the preset detection window corresponding to each pixel point is then analyzed. For the segmented fat part, different meat qualities correspond to different fat distributions. For example, beef, which requires a higher degree of stirring, has the least fat content among the three red meats, and the fat distribution is the most dispersed, so high-quality beef will have obvious fat "marbling". Pork has the highest fat content, and its distribution is more concentrated between muscle fibers, with a more obvious combination of fat and lean. The fat content and distribution of mutton are between beef and pork, and are distributed on the surface of muscle fibers. The distribution of fat usually affects the degree of stirring required for stirring. The more and more concentrated the fat is, the less stirring it requires. Therefore, the fat index of each pixel point is obtained according to the distribution characteristics of the fat pixel points in the preset detection window corresponding to each pixel point.
[0105] Any pixel in the grayscale image of the meat to be stirred is used as a detection pixel, and the local fat distribution is analyzed by detecting the pixel. Preferably, the position code of each fat pixel in the preset detection window corresponding to the detection pixel is obtained. In an embodiment of the present invention, the detection pixel corresponding to the preset detection window is segmented by a quadtree segmentation method to obtain the binary code of the fat pixel position. Because the detection pixel corresponds to the preset detection window with an odd side length, when performing quadtree segmentation, the left and upper segmentation areas are increased by one row and one column until each pixel is segmented. Each pixel corresponds to a binary code, and the binary code of each fat pixel is obtained and converted into a decimal as the position code of each fat pixel. It should be noted that the quadtree segmentation method and the conversion of the decimal system are technical means well known to those skilled in the art, and will not be described in detail here. In other embodiments of the present invention, the Cartesian coordinate system can be used to characterize the position of each fat pixel in the preset detection window, and converted into a coding form to obtain the position code of each pixel, or the pixels in the preset detection window can be directly numbered according to the natural number sequence order. The natural number corresponding to each position is used as the position code, and the acquisition of the position code is not limited here.
[0106] In order to more clearly characterize the widespread distribution of fat pixels around the detection pixel, an embodiment of the present invention uses a preset arrangement order to sort the fat pixels to obtain an arrangement sequence, and obtains a more accurate distribution through the arrangement order of the fat pixels, wherein the preset arrangement order is: taking the detection pixel as the starting point, and placing the fat pixels in each circle in the arrangement sequence in order from the starting point to the outside in the order of increasing circles from 1. In the embodiment of the present invention, the order of increasing from 1 is represented as the number of circles starting from 1 and increasing by 1 each time.
[0107] Among them, the number of detection turns is the shortest distance between the detection pixel point and the edge of the corresponding preset detection window. In the embodiment of the present invention, the shortest distance can be calculated using the Euclidean distance. It should be noted that the Euclidean distance is a technical means well known to those skilled in the art and will not be described in detail here. In other embodiments of the present invention, the number of detection turns can also be obtained by counting the number of pixel points on the shortest path from the detection pixel point to the edge of the preset detection window to characterize the shortest distance.
[0108] See also Figure 3, which shows a schematic diagram of the arrangement sequence of fat pixels in the preset detection window corresponding to the obtained pixel points provided by an embodiment of the present invention. Wherein E is the detection pixel point, that is, the starting point, and the preset detection window size corresponding to the detection pixel point is a window size of 7×7. In order to better characterize the number of detection circles, the number of pixels on the shortest path between the detection pixel point and the edge of the preset detection window is counted at this time. The number of pixels is 3, and the number of detection circles is 3. When sorting from the starting point outward, when the number of circles is 1, the fat pixels in the circle are E1, E2, E3, when the number of circles is 2, the fat pixels in the circle are E4, E5, E6, E7, E8, E9, when the number of circles is 3, the fat pixels in the circle are E10, E11, E12, E13, E14, when the number of circles is 4, it is greater than the number of detection circles 3, that is, when the number of circles in the preset detection window is only the number of detection circles, the sorting is stopped. The fat pixels in each circle are sorted, that is, the fat pixels are sorted in order from 1 to 3 according to the circle numbers, and the fat pixels are placed in the arrangement sequence, and the resulting arrangement sequence is [E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14]. It should be noted that the arrangement order of the fat pixels in each circle is consistent, that is, they are all sorted clockwise or counterclockwise to ensure the consistency of pixel distribution calculation. In addition, the starting sorting point of the fat pixels in each circle can be randomly selected, or the fat pixel closest to the last fat pixel in the previous circle can be used as the starting sorting point of the current circle, and there is no restriction here.
[0109] In an embodiment of the present invention, the preset initial number of detection circles is 1, and the implementer can adjust it according to the specific preset situation. When the number of detection circles is less than or equal to the preset initial number of detection circles, it means that the preset detection window size corresponding to the detection pixel point is small, and the local fat pixel point distribution and lean meat pixel point distribution that can be represented are both small. Therefore, the preset fat index is 1. When the number of detection circles is 1, the fat index of the detection pixel point is the preset fat index.
[0110] When the number of detection circles is greater than the preset initial number of detection circles, the fat pixels can be sorted normally to obtain an arrangement sequence, and the fat distribution is analyzed based on the position difference between each fat pixel and the adjacent fat pixel in the arrangement sequence. In an embodiment of the present invention, the preset fat number is set to 1, and the implementer can adjust it according to the specific implementation situation. When the number of fat pixels in the arrangement sequence is less than or equal to 1, the number of fat pixels in the arrangement sequence is too small to meet the analysis of the fat pixel position distribution. Therefore, the fat index corresponding to the detection pixel at this time is set to the preset fat index.
[0111] When the number of fat pixels in the arrangement sequence is greater than the preset fat number, it means that the number of fat pixels in the arrangement sequence is large, which can reflect the distribution of fat pixels. Preferably, the difference in position encoding between each two adjacent fat pixels in the arrangement sequence is calculated to obtain the position difference, and the average value of all position differences in the arrangement sequence is used as the fat index of the detection pixel. The fat index can reflect the aggregation of fat pixels. When the fat pixel is larger, it means that the fat distribution around the detection pixel is more extensive. In the embodiment of the present invention, the specific expression of the fat index is:
[0112] ;
[0113] In the formula, Expressed as The fat index of each pixel, Expressed as The total number of fat pixels in the corresponding arrangement sequence. Indicates the order in which The position encoding of fat pixels, Indicates the order in which The position encoding of fat pixels, Expressed as an absolute value extraction function.
[0114] in, It is expressed as position difference. The larger the overall position difference, the worse the concentration of fat pixels. The wider the distribution of fat pixels, the larger the fat index.
[0115] At this point, the analysis of the distribution of local lean meat and fat at each pixel point is completed. Further, the growth criterion of regional growth can be defined according to the lean meat index and fat index of each pixel point to obtain the meat block area. Preferably, the growth index of each pixel point is obtained according to the lean meat index and fat index of each pixel point. The local characteristics of the meat surface corresponding to each pixel point can be more accurately characterized by the growth index. Both the lean meat index and the fat index are positively correlated with the growth index. In the embodiment of the present invention, the specific expression of the growth index is:
[0116] ;
[0117] In the formula, Expressed as The growth index of each pixel, Expressed as The lean meat index of each pixel, Expressed as The fat index of each pixel, Expressed as a normalized function.
[0118] The multiplication method reflects that both the lean meat index and the fat index are positively correlated with the growth index. When the lean meat index and the fat index are larger, it can reflect the overall characteristics of the tighter distribution of lean meat texture and the wider distribution of fat in the local area of the pixel point, that is, the compactness around the pixel point. In other embodiments of the present invention, other basic mathematical operations can also be used to reflect that both the lean meat index and the fat index are positively correlated with the growth index, such as addition, power operation, etc., which are not limited here.
[0119] Furthermore, any pixel point in the grayscale image of the meat to be stirred is used as a growth point, and regional growth is performed from the growth point according to the growth criterion to obtain a growth area. The production criterion is redefined according to the growth index of the pixel point. Preferably, the growth criterion is: when the difference in growth index between the pixel point to be grown and the growth point is less than or equal to a preset growth threshold, growth can be performed. In the embodiment of the present invention, the setting expression of the growth criterion is:
[0120] ;
[0121] In the formula, Represented as growth point growth indicators, Represented as growth point The growth index of the pixel to be grown, Expressed as an absolute value extraction function, It is represented as a preset growth threshold, which is set to 0.4 in the embodiment of the present invention, and can be adjusted by the implementer according to the specific implementation situation. It is represented by the difference in growth index between the pixel to be grown and the growth point. It should be noted that the pixel to be grown is a pixel in a preset neighborhood range of the corresponding growth point, and four neighborhoods or eight neighborhoods can be selected, which is not limited here.
[0122] According to the growth criterion, the neighborhood is continuously grown until there are no pixels that can be grown in the neighborhood of the growth area, and the growth is stopped to obtain a growth area. After completing one growth, any pixel outside the growth area in the grayscale image of the meat to be stirred is used as a new growth point for iterative regional growth until there are no new growth points for regional growth, and the growth is stopped, so that all growth areas in the grayscale image of the meat to be stirred can be obtained.
[0123] Since different chunks of meat are overlapped or adjacent in the blender, the muscle fiber bundle tightness index and fat pixel distribution around the chunks of meat will mutate at the overlapping or adjacent positions. Therefore, the pixels can be distinguished according to the degree of mutation, and the mutated pixels are considered to be the edge pixels of the meat chunks.
[0124] Therefore, in an embodiment of the present invention, the number of all growth areas in the grayscale image of the meat to be mixed is counted as the number of areas of the grayscale image of the meat to be mixed, and the number of areas reflects the number of meat chunks on the corresponding surface in the grayscale image of the meat to be mixed. Since the number of meat chunks on the surface can analyze the degree of cutting of the meat chunks in the mixing machine from the image perspective to the greatest extent, it has an accurate characterization meaning in the subsequent analysis of the state parameters of the meat. Therefore, in an embodiment of the present invention, the number of areas is directly used as the degree of the number of meat chunks for analysis. In other embodiments of the present invention, the stacking height of the meat in the mixing machine can be added to further characterize the degree of the number of meat chunks. It will not be elaborated here.
[0125] At this point, the distribution of lean meat and fat parts is comprehensively considered to complete the segmentation and acquisition of the number of meat pieces, making the number of meat pieces obtained more accurate and the representation of the meat state more reliable.
[0126] S4: According to the number of regions of the grayscale image of the meat to be blended, the arrangement regularity of all superpixel blocks and the proportion of fat pixels, the state parameters of the meat corresponding to the grayscale image of the meat to be blended are obtained.
[0127] The state of the meat is comprehensively reflected according to the arrangement of the muscle fiber bundle structure of the meat in the grayscale image of the meat to be stirred, the amount of meat pieces and the proportion of fat. Among them, according to the description in S2, the more regular and tight the arrangement of the muscle fiber bundle structure of the meat in the grayscale image of the meat to be stirred is, the more difficult it is to stir the meat. Therefore, preferably, the average value of the arrangement regularity of all superpixel blocks in the grayscale image of the meat to be stirred is taken as the average arrangement regularity of the grayscale image of the meat to be stirred, and the arrangement of the overall muscle fiber bundle structure is reflected by the average arrangement regularity, which characterizes a certain meat condition.
[0128] Furthermore, when the proportion of fat in the meat in the grayscale image of the meat to be stirred is higher, it means that the corresponding meat has more fat areas, and the fat areas make the meat easier to stir. Therefore, preferably, the ratio of the total number of fat pixels in the grayscale image of the meat to be stirred to the total number of all pixels is used as the proportion of fat pixels in the grayscale image of the meat to be stirred, and a certain meat state can be characterized by the proportion.
[0129] Finally, when the number of meat pieces in the grayscale image of the meat to be stirred is smaller, it means that the cutting state of the meat pieces is finer and the number of meat pieces is greater, so the corresponding meat is easier to stir, and the number of regions can represent a certain meat state. According to the number of regions, average arrangement regularity and proportion of the grayscale image of the meat to be stirred, the state parameter of the grayscale image of the meat to be stirred is obtained, wherein the larger the state parameter is, the more difficult it is to stir the meat pieces, so the average arrangement regularity is positively correlated with the state parameter, and the number of regions and proportion are negatively correlated with the state parameter. In the embodiment of the present invention, the specific expression of the state parameter is:
[0130] ;
[0131] In the formula, It is represented as the state parameter of the grayscale image of the meat to be stirred, It is expressed as the average arrangement regularity of the grayscale image of the meat to be stirred, It is expressed as the number of regions in the grayscale image of the meat to be blended, It is expressed as the percentage of fat pixels in the grayscale image of the meat to be blended. Expressed as a normalized function.
[0132] The ratio shows that the average arrangement regularity is positively correlated with the state parameters, and the number of regions and the proportion are negatively correlated with the state parameters. The greater the average arrangement regularity and the smaller the number of regions and the proportion, the tighter the corresponding muscle fiber bundle structure of the meat, the smaller the fat proportion, the larger the number of meat pieces, and the more difficult the meat is to stir. Conversely, it is easier to stir.
[0133] At this point, the detection of the meat status in the crushing and mixing machine is completed.
[0134] In summary, the present invention obtains the arrangement regularity of each superpixel block through the shape and arrangement of the superpixel blocks in the lean meat area in the grayscale image of the meat to be stirred, reflects the arrangement structural characteristics of each muscle fiber bundle, and can characterize the regular tightness of the surface texture of the meat. Further, through the distribution of lean meat and fat in each pixel in the preset detection window, the lean meat index and fat index are obtained, and the local characteristics of each pixel are comprehensively characterized. The growth criteria of the pixel points are defined according to the lean meat index and the fat index to perform regional growth, so that the meat characteristics characterized by the pixels in the obtained growth area are more consistent, and the number of regions obtained is more reliable, which meets the analysis of the number of meat pieces. Finally, the state parameters of the corresponding meat are obtained by combining the number of regions in the grayscale image of the meat to be stirred, the arrangement regularity of the superpixel blocks and the proportion of fat pixels. The state parameters of the meat are comprehensively evaluated from the number of overall meat pieces, the lean muscle fiber analysis of the meat pieces and the fat proportion analysis of the meat pieces, so that the state detection of the overall meat in the crushing and stirring machine is more accurate and the detection results are more reliable.
[0135] The present invention provides a food material detection system for a crushing and mixing machine based on image features, comprising a memory and a processor, wherein the processor executes a computing program stored in the memory to implement a food material detection method for a crushing and mixing machine based on image features as described above.
[0136] Embodiment of the method for adjusting mixing parameters of a crushing and mixing machine based on image features:
[0137] It is difficult for ordinary people to distinguish the state of different ingredients and select appropriate stirring parameters. For meat ingredients, stirring parameters are usually selected only according to the type of meat and the degree of cutting. However, the stirring effect of meat ingredients is usually closely related to the fat and lean content in the meat ingredients. The existing analysis method cannot judge the state of meat according to the fatness and leanness of specific meat, which makes the selection of stirring parameters less suitable and the stirring effect of meat ingredients is not good. In order to solve the problem of poor selection of stirring parameters in the prior art and poor stirring effect of meat ingredients, this embodiment provides a stirring parameter adjustment method for a crushing and stirring machine based on image features. Please refer to Figure 4 , which shows a flow chart of a method for adjusting mixing parameters of a crushing and mixing machine based on image features provided by an embodiment of the present invention, the method comprising the following steps:
[0138] Step S1: Obtain a grayscale image of the meat to be blended, and identify fat pixels and lean meat pixels in the grayscale image of the meat to be blended.
[0139] Step S2: according to the shape characteristics of each superpixel block in the lean meat area and the arrangement of the local superpixel blocks, the arrangement regularity of each superpixel block is obtained; the lean meat area is the area composed of lean meat pixels.
[0140] Step S3: In the preset detection window of each pixel, the lean meat index of each pixel is obtained according to the distribution texture characteristics of the lean meat pixels in the preset detection window, and the distribution characteristics and arrangement regularity of the superpixel blocks in the preset detection window; the fat index of each pixel is obtained according to the distribution characteristics of the fat pixels in the preset detection window corresponding to each pixel; in the grayscale image of the meat to be stirred, the growth criterion is obtained according to the lean meat index and fat index of the pixel to perform regional growth, and the number of regions of the grayscale image of the meat to be stirred is obtained.
[0141] Step S4: According to the number of regions in the grayscale image of the meat to be blended, the arrangement regularity of all superpixel blocks and the proportion of fat pixels, the state parameters of the meat corresponding to the grayscale image of the meat to be blended are obtained.
[0142] Step S5: adjusting the stirring parameters of the stirring machine according to the state parameters of the meat corresponding to the grayscale image of the meat to be stirred.
[0143] Among them, steps S1 to S4 have been described in detail in the above-mentioned method and system embodiment for detecting food materials of a crushing and mixing machine based on image features, and will not be described in detail. Step S5 will be described in detail below.
[0144] Step S5: adjusting the stirring parameters of the stirring machine according to the state parameters of the meat corresponding to the grayscale image of the meat to be stirred.
[0145] In an embodiment of the present invention, the first stirring threshold is set to 0.5, the second stirring threshold is set to 0.8, the first stirring threshold is less than the second stirring threshold, and the specific numerical value can be adjusted by the implementer. When the state parameter is less than the first stirring threshold, it means that the muscle fiber bundles of the meat in the stirring machine are looser, the fat ratio is greater, the number of meat chunks is more, and the meat chunks are smaller, so it is necessary to set the lowest stirring parameter for stirring. When the state parameter is greater than or equal to the second stirring threshold, it means that the muscle fiber bundles of the meat in the stirring machine are tighter, the fat ratio is less, the number of meat chunks is fewer, and the meat chunks are larger, so it is necessary to set the highest stirring parameter for stirring. When the state parameter is greater than or equal to the second stirring threshold, it means that the muscle fiber bundles distribution of the meat chunks, the fat ratio and the number of meat chunks are moderate, so a medium stirring parameter is set for stirring.
[0146] In other embodiments of the present invention, more stirring thresholds may be set according to the actual model and function of the stirrer and the gear position of the stirring parameter to adaptively adjust the stirring parameter.
[0147] The present invention relates to the technical field of mixing parameter adjustment of a blender. The invention obtains the arrangement regularity of each superpixel block through the shape and arrangement of superpixel blocks in the lean meat area in the grayscale image of the meat to be blended, reflects the arrangement structural characteristics of each muscle fiber bundle, and can characterize the regular tightness of the surface texture of the meat. Further, through the distribution of lean meat and fat of each pixel point in the preset detection window, the lean meat index and fat index are obtained, and the local characteristics of each pixel point are comprehensively characterized. The growth criteria of the pixel points are defined according to the lean meat index and the fat index to perform regional growth, so that the meat characteristics characterized between the pixels in the obtained growth area are more consistent, and the number of regions obtained is more reliable, which meets the analysis of the number of meat pieces. Finally, the state parameters of the corresponding meat are obtained by combining the number of regions of the grayscale image of the meat to be blended, the arrangement regularity of the superpixel blocks and the proportion of fat pixels. The state parameters of the meat are comprehensively evaluated from the number of overall meat pieces, the lean muscle fiber analysis of the meat pieces and the fat proportion analysis of the meat pieces, so that the state detection of the overall meat in the crushing and blending machine is more accurate, and then the selection of the blending parameters is more consistent, the blending parameters are more accurate, and the blending effect of the meat ingredients is better.
[0148] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0149] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
Claims
1. A method for detecting food materials of a crushing and mixing machine based on image features, characterized in that: The method comprises: Obtaining a grayscale image of the meat to be blended, and identifying fat pixels and lean meat pixels in the grayscale image of the meat to be blended; According to the shape characteristics of each superpixel block in the lean meat area and the arrangement of the local superpixel blocks, the arrangement regularity of each superpixel block is obtained; the lean meat area is an area composed of lean meat pixels; the SLIC superpixel segmentation algorithm is used in the lean meat area to obtain a preset number of superpixel blocks, and the superpixel blocks cover a muscle fiber bundle structure; In the preset detection window of each pixel, the lean meat index of each pixel is obtained according to the distribution texture characteristics of the lean meat pixel in the preset detection window, and the distribution characteristics and arrangement regularity of the super pixel block in the preset detection window; the fat index of each pixel is obtained according to the distribution characteristics of the fat pixel in the preset detection window corresponding to each pixel; in the grayscale image of the meat to be blended, the growth criterion is obtained according to the lean meat index and the fat index of the pixel to perform regional growth, and the number of regions of the grayscale image of the meat to be blended is obtained; According to the number of regions of the grayscale image of the meat to be blended, the arrangement regularity of all superpixel blocks and the proportion of fat pixels, the state parameters of the meat corresponding to the grayscale image of the meat to be blended are obtained.
2. The method for detecting food materials of a crushing and mixing machine based on image features according to claim 1 is characterized in that: The method for obtaining the arrangement regularity is: Taking any superpixel block as the target superpixel block, normalizing the ratio of the area to the perimeter of the target superpixel block to obtain the shape regularity of the target superpixel block; Taking any pixel point on the edge of the target superpixel block as the target pixel point, obtaining a target straight line along the gradient direction of the target pixel point, and obtaining the intersection point between the target straight line and the edge of other superpixel blocks; on the target straight line, taking the distance between the first intersection points on both sides of the target pixel point as the first distance, and taking the distance between the second intersection points on both sides of the target pixel point as the second distance; When both the first distance and the second distance of the target pixel point exist, the local regularity of the target pixel point is obtained according to the first distance and the second distance of the target pixel point, and if the local regularity is less than zero, the local regularity is set to a preset local regularity; when the first distance and the second distance of the target pixel point cannot exist at the same time, the local regularity of the target pixel point is set to a preset local regularity; Taking the average of the local regularity of all pixels on the edge of the target superpixel block as the distribution regularity of the target superpixel block; The arrangement regularity of each super pixel block is obtained according to the shape regularity and the distribution regularity of each super pixel block, and both the shape regularity and the distribution regularity are positively correlated with the arrangement regularity.
3. The method for detecting food materials of a crushing and mixing machine based on image features according to claim 2 is characterized in that: The specific expression of the local regularity is: ; In the formula, Represented as the first The local regularity of each pixel, Represented as the first The first distance of pixels, Represented as the first The second distance of pixels, Expressed as adjustment coefficient.
4. The method for detecting food materials of a crushing and mixing machine based on image features according to claim 1 is characterized in that: The method for acquiring the distribution texture feature includes: Any pixel in the grayscale image of the meat to be blended is used as a reference pixel; Obtaining a gradient direction histogram of lean meat pixels according to the gradient directions of all lean meat pixels in a preset detection window corresponding to the reference pixel, calculating the proportion of the number of lean meat pixels corresponding to the maximum gradient direction distribution in the gradient direction histogram to the total number of pixels in the preset detection window, and obtaining a direction probability of the reference pixel; The contrast of the grayscale values of all lean meat pixels in the preset detection window is calculated as the grayscale contrast of the reference pixel; the distribution texture characteristics of the reference pixel are obtained according to the grayscale contrast of the reference pixel and the direction probability, and the grayscale contrast and the direction probability are both positively correlated with the distribution texture characteristics.
5. The method for detecting food materials of a crushing and mixing machine based on image features according to claim 4 is characterized in that: The method for obtaining the lean meat index includes: According to the distribution density of the super pixel block in the preset detection window corresponding to the reference pixel, the distribution density feature of the reference pixel is obtained; the product of the distribution texture feature of the reference pixel and the distribution density feature is normalized to obtain the lean meat distribution degree of the reference pixel; If the reference pixel is a lean meat pixel, the superpixel block where the reference pixel is located is used as the reference superpixel block corresponding to the reference pixel; if the reference pixel is a fat pixel, the superpixel block closest to the reference pixel is used as the reference superpixel block corresponding to the reference pixel; According to the lean meat distribution degree of the reference pixel point and the arrangement regularity of the corresponding reference superpixel block, a lean meat index of the reference pixel point is obtained, and both the lean meat distribution degree and the arrangement regularity are positively correlated with the lean meat index.
6. The method for detecting food materials of a crushing and mixing machine based on image features according to claim 5 is characterized in that: The specific expression of the distribution density feature is: ; In the formula, Expressed as The distribution density characteristics of pixels, It is expressed as the total number of pixels in the grayscale image of the meat to be stirred. Expressed as The pixel points correspond to the side length of the preset detection window. It is represented by the total number of superpixel blocks in the grayscale image of the meat to be blended, Expressed as The total number of superpixel blocks corresponding to the preset detection window.
7. The method for detecting food materials of a crushing and mixing machine based on image features according to claim 1 is characterized in that: The method for obtaining the fat index includes: Any pixel in the grayscale image of the meat to be blended is used as a detection pixel; the position code of each fat pixel in the preset detection window corresponding to the detection pixel is obtained; the shortest distance between the detection pixel and the edge of the corresponding preset detection window is used as the number of detection circles; When the number of detection circles is less than or equal to the preset initial number of detection circles, the preset fat index is used as the fat index of the detection pixel point; When the number of detection circles is greater than the preset initial detection circle number, an arrangement sequence of all fat pixels in a preset detection window corresponding to the detection pixel is obtained according to a preset arrangement order; when the number of fat pixels in the arrangement sequence is less than or equal to the preset fat number, the preset fat index is used as the fat index of the detection pixel; when the number of fat pixels in the arrangement sequence is greater than the preset fat number, the difference in the position code between each two adjacent fat pixels in the arrangement sequence is calculated to obtain the position difference, and the average value of all the position differences in the arrangement sequence is used as the fat index of the detection pixel; The preset arrangement order is: taking the detection pixel point as the starting point, and placing the fat pixel points in each circle in the preset detection window in the arrangement sequence in order from the starting point outward in the order of increasing circle numbers from 1.
8. The method for detecting food materials of a crushing and mixing machine based on image features according to claim 1 is characterized in that: The step of acquiring a growth criterion according to the lean meat index and the fat index of the pixel point to perform regional growth and obtain the number of regions of the grayscale image of the meat to be stirred includes: According to the lean meat index and the fat index of each pixel point, a growth index of each pixel point is obtained, wherein the lean meat index and the fat index are both positively correlated with the growth index; Any pixel point in the grayscale image of the meat to be stirred is used as a growth point, and regional growth is performed according to the growth criterion to obtain a growth area; after the growth is completed, any pixel point outside the growth area in the grayscale image of the meat to be stirred is used as a new growth point to perform iterative regional growth until there is no new growth point for regional growth and the growth stops; The growth criterion is: when the difference in growth index between the pixel to be grown and the growth point is less than or equal to a preset growth threshold, growth can be performed; the pixel to be grown is a pixel in a preset neighborhood range of the growth point; The number of all growth regions in the grayscale image of the meat to be stirred is counted as the number of regions of the grayscale image of the meat to be stirred.
9. The method for detecting food materials of a crushing and mixing machine based on image features according to claim 1, characterized in that: The method for obtaining the state parameter includes: The average of the arrangement regularity of all superpixel blocks in the grayscale image of the meat to be blended is taken as the average arrangement regularity of the grayscale image of the meat to be blended; According to the number of regions of the grayscale image of the meat to be stirred, the average arrangement regularity and the proportion of fat pixels, the state parameters of the grayscale image of the meat to be stirred are obtained. The average arrangement regularity is positively correlated with the state parameters, and the number of regions and the proportion are negatively correlated with the state parameters.
10. A food detection system for a crushing and mixing machine based on image features, comprising a memory and a processor; characterized in that: The processor executes the computing program stored in the memory to implement the method for detecting food ingredients of a crushing and mixing machine based on image features as described in any one of claims 1-9.
Citation Information
Patent Citations
Cantonese style sausage hyperspectral image-based lean meat and fat meat adaptive separation method
CN107403181A
Beef cattle intramuscular fat content prediction model and construction method and application thereof
CN110264464A
Pork meat quality intelligent detection method and system
CN117173192A
Method and system for automatically grading beef quality
US20110110563A1
Intelligent identification cooking system for oven
US20210186262A1
