Food material evaluation method, device, computer device, and storage medium

By setting threshold conditions for multiple color channels in food ingredient images and adjusting the thresholds to improve the degree of overlap, and combining the evaluation results with sample thresholds, the problem of accuracy and objectivity in food ingredient quality evaluation is solved, and automated and accurate food ingredient evaluation is achieved.

CN122265987APending Publication Date: 2026-06-23KANGSHI (SHANGHAI) FOOD SCIENCE & TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
KANGSHI (SHANGHAI) FOOD SCIENCE & TECHNOLOGY CO LTD
Filing Date
2026-02-06
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing technologies cannot accurately assess the quality of food ingredients. Subjective grading methods are greatly affected by individual differences, and colorimeter measurement methods are difficult to reflect the overall color of food ingredients, resulting in low assessment accuracy.

Method used

By acquiring multiple color channel values ​​from food ingredient sample images, setting threshold conditions to identify target regions, and adjusting the threshold conditions to improve the degree of overlap, the evaluation results are calculated in combination with the sample thresholds to achieve objective and accurate food ingredient evaluation.

Benefits of technology

It improves the accuracy and objectivity of food ingredient evaluation, enabling automated and accurate quality assessment of food ingredients and solving the problems of evaluation errors and inaccuracies in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122265987A_ABST
    Figure CN122265987A_ABST
Patent Text Reader

Abstract

The application relates to a food raw material evaluation method and device, computer equipment and a storage medium. The method comprises the following steps: acquiring channel values of pixels in a first image containing a food raw material sample in each color channel; acquiring target identification region threshold conditions corresponding to each color channel and used for identifying the food raw material sample; confirming a target pixel when the channel values of the pixels in each color channel simultaneously satisfy the corresponding threshold conditions, and obtaining an actual identification region according to the target pixel; adjusting the threshold conditions so that the coincidence degree between the actual identification region obtained based on the threshold conditions and the target identification region is greater than or equal to a preset degree; acquiring a second image containing a food raw material to be evaluated, sample threshold values used for constituting the threshold conditions, and obtaining an evaluation result of the food raw material to be evaluated according to the difference between the channel values of each pixel in the second image in the color channel and the corresponding sample threshold values. The method can accurately evaluate the quality of the food raw material.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of food evaluation, and in particular to methods, apparatus, computer equipment and storage media for evaluating food ingredients. Background Technology

[0002] Color is a key attribute influencing the quality assessment of food ingredients. Traditional methods for judging food ingredient quality include subjective grading and colorimeter measurement. Subjective grading primarily relies on human visual evaluation and classification of the apparent color of food ingredients. This method does not use instruments; standard reference objects and products are placed under a uniform light source, and sensory evaluators grade the products based on different degrees of color change according to the reference object. Colorimeter measurement uses a colorimeter to obtain the color of measured points on the surface of the food ingredient, thereby achieving quality judgment. However, subjective grading is susceptible to individual differences and subjective judgment, resulting in significant errors. Colorimeter measurement is limited to point-to-point testing and cannot reflect the overall color of the food ingredient, leading to low assessment accuracy.

[0003] There is currently no effective solution to the problem that related technologies cannot accurately assess the quality of food ingredients. Summary of the Invention

[0004] Therefore, it is necessary to provide a food ingredient evaluation method, apparatus, computer equipment, and storage medium that can solve the problem of inaccurate evaluation of food ingredient quality, in response to the above-mentioned technical problems.

[0005] Firstly, this embodiment provides a method for evaluating food raw materials, the method comprising:

[0006] Obtain the channel values ​​of pixels in multiple color channels from a first image containing food ingredient samples;

[0007] Obtain preset threshold conditions corresponding to each of the color channels; the threshold conditions are used to identify the target recognition region of the food raw material sample;

[0008] When the channel values ​​of the pixel in each of the color channels simultaneously meet the corresponding threshold conditions, the pixel is confirmed as a target pixel, and the actual recognition area is obtained based on the target pixel.

[0009] The threshold condition is adjusted so that the degree of overlap between the actual recognition area identified based on the adjusted threshold condition and the target recognition area is greater than or equal to a preset degree.

[0010] A second image containing the food ingredient to be evaluated and a sample threshold used to constitute the adjusted threshold conditions are obtained. The evaluation result of the food ingredient to be evaluated is obtained based on the difference between the channel value of each pixel in the second image in the color channel and the corresponding sample threshold in the color channel.

[0011] In some embodiments, the target recognition region includes a non-overlapping first recognition region and a second recognition region; the threshold conditions include a first threshold condition corresponding to the first recognition region and a second threshold condition corresponding to the second recognition region; the actual recognition region includes a first sub-region and a second sub-region; the step of confirming the pixel as a target pixel when the channel values ​​of each color channel simultaneously satisfy the corresponding threshold conditions, and obtaining the actual recognition region based on the target pixel, includes:

[0012] When the channel values ​​of the pixel in each of the color channels simultaneously meet the corresponding first threshold conditions, the pixel is confirmed as the first target pixel, and the first sub-region is obtained based on the first target pixel;

[0013] When the channel values ​​of the pixel in each of the color channels simultaneously meet the corresponding second threshold conditions, the pixel is confirmed as the second target pixel, and the second sub-region is obtained based on the second target pixel;

[0014] If there are overlapping pixels in the first sub-region and the second sub-region, delete the overlapping pixels in the first sub-region and delete the overlapping pixels in the second sub-region.

[0015] In some embodiments, adjusting the threshold condition so that the overlap between the actual recognition region identified based on the adjusted threshold condition and the target recognition region is greater than or equal to a preset degree includes:

[0016] Adjust the first threshold condition until the degree of overlap between the first identification region and the first sub-region identified based on the adjusted first threshold condition is greater than or equal to a preset degree.

[0017] Adjust the second threshold condition until the degree of overlap between the second identification region and the second sub-region identified based on the adjusted second threshold condition is greater than or equal to the preset degree.

[0018] In some embodiments, adjusting the threshold condition includes:

[0019] Obtain the pixel differences between the actual recognition area and the target recognition area;

[0020] When the difference pixel is a pixel within the actual recognition area, the value range corresponding to the threshold condition is narrowed;

[0021] When the difference pixel is a pixel within the target recognition area, the range of values ​​corresponding to the threshold condition is expanded.

[0022] In some embodiments, before acquiring the pixel values ​​in the plurality of color channels of a first image containing a food ingredient sample, the method further includes:

[0023] If noise exists in the first image, perform an opening operation on the first image;

[0024] If there are holes and / or gaps in the area where the food ingredient sample in the first image is located, the first image undergoes a closing operation.

[0025] In some embodiments, obtaining the evaluation result of the food ingredient to be evaluated based on the difference between the channel value of each pixel in the second image in the color channel and the corresponding sample threshold in the color channel includes:

[0026] In the second image, the evaluation region is identified by recognizing the pixels whose channel values ​​of each color channel simultaneously satisfy the corresponding adjusted threshold conditions.

[0027] The evaluation result of the food ingredient to be evaluated is obtained based on the difference between the channel value of each pixel in the evaluation area in the color channel and the corresponding sample threshold in the color channel.

[0028] In some embodiments, obtaining the channel values ​​of pixels in a first image containing food ingredient samples across multiple color channels includes:

[0029] Obtain the channel values ​​of each color channel in the Lab color space for the pixels in the first image.

[0030] Secondly, this embodiment provides a food ingredient evaluation device, the device comprising:

[0031] The image acquisition module is used to acquire the channel values ​​of pixels in multiple color channels in a first image containing food raw material samples.

[0032] A threshold acquisition module is used to acquire preset threshold conditions corresponding to each of the color channels; the threshold conditions are used to identify the target recognition region of the food raw material sample.

[0033] The recognition module is used to identify a pixel as a target pixel when the channel values ​​of the pixel in each of the color channels simultaneously meet the corresponding threshold conditions, and to obtain the actual recognition area based on the target pixel.

[0034] A threshold adjustment module is used to adjust the threshold conditions so that the degree of overlap between the actual recognition area identified based on the adjusted threshold conditions and the target recognition area is greater than or equal to a preset degree.

[0035] The evaluation module is used to acquire a second image containing the food ingredient to be evaluated, a sample threshold for constituting the adjusted threshold conditions, and to obtain the evaluation result of the food ingredient to be evaluated based on the difference between the channel value of each pixel in the second image in the color channel and the corresponding sample threshold in the color channel.

[0036] Thirdly, this embodiment provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the food raw material evaluation method described in the first aspect above.

[0037] Fourthly, this embodiment provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the food ingredient evaluation method described in the first aspect above.

[0038] The aforementioned food ingredient evaluation method, apparatus, computer equipment, and storage medium, based on threshold conditions corresponding to multiple color channels, perform multi-condition judgments on each pixel in a first image containing food ingredient samples to filter out the actual recognition area. The threshold conditions are adjusted according to the comparison results between the actual recognition area and the food ingredient sample, improving the accuracy of the threshold conditions used for screening food ingredient samples. Using the sample threshold corresponding to the threshold conditions as the evaluation benchmark, and based on the difference between the channel values ​​of each pixel in the second image and the corresponding sample threshold, the food ingredient to be evaluated is objectively and accurately evaluated, solving the problem of inaccurate evaluation of food ingredient quality. Attached Figure Description

[0039] Figure 1 This is a hardware structure block diagram of the terminal of a food raw material evaluation method in one embodiment;

[0040] Figure 2 This is a flowchart illustrating a food ingredient evaluation method in one embodiment;

[0041] Figure 3 This is a flowchart illustrating a food ingredient evaluation method applied to freeze-dried cabbage in one embodiment.

[0042] Figure 4This is a structural block diagram of a food ingredient evaluation device in one embodiment;

[0043] Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0045] When evaluating food raw materials, relevant technologies primarily employ subjective grading and colorimeter measurement methods. Subjective grading mainly involves evaluating and classifying the product's apparent color using human visual perception. This method does not rely on instruments; standard reference objects and products are placed under a uniform light source, and sensory evaluators grade the products based on different degrees of color change according to the reference objects. However, subjective evaluation methods require highly qualified evaluators, who need professional training before participating. Furthermore, individual experience and judgment standards differ, making it difficult to obtain unified results and lacking quantifiable evaluation outcomes. Moreover, in large-scale production or testing scenarios, manual evaluation is inefficient.

[0046] Compared to traditional subjective evaluation methods, colorimeter measurement can obtain pixel values ​​of food raw materials through both contact and non-contact detection modes, enabling rapid and non-destructive product testing. However, colorimeter measurement can only obtain the average value of a portion of the sample area, and the shape and area of ​​the sample are also limited, making it impossible to fully reflect the apparent color distribution and degree of color change of the sample.

[0047] To address the problem that related technologies cannot accurately assess the quality of food ingredients, one embodiment provides a method for assessing food ingredients.

[0048] The method embodiments provided in this example can be executed on a terminal, computer, or similar computing device. For example, it can run on a terminal. Figure 1 This is a hardware structure block diagram of a terminal for a food raw material evaluation method according to an embodiment of this application. Figure 1 As shown, a terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 and a memory 104 for storing data are also included. The processor 102 may be, but is not limited to, a microprocessor (MCU) or a programmable logic device (FPGA). The terminal may also include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that… Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the terminal described above. For example, the terminal may also include components that are larger than...Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown are illustrated.

[0049] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the food raw material evaluation method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thereby implementing the aforementioned method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0050] The transmission device 106 is used to receive or send data via a network. This network includes a wireless network provided by the terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 can be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0051] This embodiment provides a method for evaluating food raw materials. Figure 2 This is a flowchart of the food ingredient evaluation method in this embodiment, such as... Figure 2 As shown, the process includes the following steps:

[0052] Step 202: Obtain the channel values ​​of pixels in multiple color channels in the first image containing the food ingredient sample.

[0053] The food ingredient sample is a pre-prepared sample of food ingredients. Optionally, the food ingredient sample may include fresh food ingredients and / or spoiled food ingredients.

[0054] The first image includes multiple color channels, each corresponding to a color component or a luminance component. The channel value is used to represent the component value of a pixel in the corresponding color channel. If the first image uses the RGB color space, the color channels include the R channel, G channel, and B channel; if the first image samples the Lab color space, the color channels include the L channel, a channel, and b channel.

[0055] Step 204: Obtain the preset threshold conditions corresponding to each color channel; the threshold conditions are used to identify the target recognition area of ​​the food raw material sample.

[0056] The threshold condition is used to indicate the range of channel values ​​in the corresponding color channel for the target recognition area of ​​the food raw material sample; different color channels have their own corresponding threshold conditions.

[0057] The target identification region is determined based on the area to be evaluated in the food ingredient. Taking leafy greens as an example, the target identification region can be set as the leaf area of ​​the leafy greens, the root area of ​​the leafy greens, or the whole leafy greens; it should be understood that the food ingredient can also be other ingredients besides leafy greens.

[0058] Step 206: When the channel values ​​of a pixel in each color channel simultaneously meet the corresponding threshold conditions, the pixel is confirmed as the target pixel, and the actual recognition area is obtained based on the target pixel.

[0059] Optionally, when the channel values ​​of a pixel in each color channel are all within the range indicated by the corresponding threshold condition, the pixel is determined to belong to the target pixel within the target recognition region. Based on the set of target pixels, a first recognition region segmented according to the threshold condition is obtained.

[0060] Step 208: Adjust the threshold conditions so that the overlap between the actual recognition area and the target recognition area obtained based on the adjusted threshold conditions is greater than or equal to the preset degree.

[0061] The preset degree is a pre-defined difference threshold, which indicates the lower limit of acceptable deviation in the overlap between the actual recognition area and the target recognition area. The preset degree can be set according to requirements. For example, the preset degree can be a threshold for the number of overlapping pixels between the actual recognition area and the target recognition area; the preset degree can also be a threshold for the overlap rate of overlapping pixels between the actual recognition area and the target recognition area, etc.

[0062] Optionally, it can be determined whether the degree of overlap between the actual recognition area and the target recognition area is greater than or equal to a preset degree: if not, the threshold condition is adjusted; if yes, the threshold condition is not adjusted.

[0063] Optionally, the actual recognition area obtained based on the adjusted threshold conditions includes: when a pixel in the first image simultaneously meets the corresponding threshold conditions in each color channel, the pixel is confirmed as a target pixel, and the actual recognition area is obtained based on the target pixel.

[0064] When the threshold condition is inaccurate, the overlap between the target recognition area and the first recognition area is low. By adjusting the range of channel values ​​indicated by the threshold condition, the first recognition area can be made to continuously approach the target recognition area, thereby improving the accuracy of the threshold condition.

[0065] Step 210: Obtain a second image containing the food ingredient to be evaluated and a sample threshold for constituting the adjusted threshold conditions. Based on the difference between the channel value of each pixel in the second image in the color channel and the sample threshold in the corresponding color channel, obtain the evaluation result of the food ingredient to be evaluated.

[0066] Wherein, the sample threshold is the upper limit and / or lower limit of the adjusted threshold condition.

[0067] When the food ingredient sample is spoiled, the channel value distribution of pixels in the color channels of the second image is obtained. The smaller the difference between the channel value and the corresponding sample threshold in the color channel, the higher the quality of the food ingredient to be evaluated; conversely, the lower the quality of the food ingredient to be evaluated.

[0068] When the food ingredient sample is a fresh food ingredient, the channel value distribution of pixels in the color channel of the second image is obtained. The larger the difference between the channel value and the corresponding sample threshold in the color channel, the lower the quality of the food ingredient to be evaluated; conversely, the higher the quality of the food ingredient to be evaluated.

[0069] When the food ingredient sample includes both spoiled and fresh food ingredients, the quality assessment result of the food ingredient to be evaluated can be obtained by combining the difference between the pixel channel value and the sample threshold corresponding to the spoiled food ingredient, and the difference between the pixel channel value and the sample threshold corresponding to the fresh food ingredient.

[0070] In the aforementioned food ingredient evaluation method, multiple threshold conditions corresponding to various color channels are used to perform multi-condition judgments on each pixel in the first image containing the food ingredient sample, thus filtering out the first recognition region. By comparing the actual recognition region obtained and the target recognition region of the food ingredient sample, the threshold conditions are adjusted to obtain accurate threshold conditions for filtering food ingredient samples. By comparing the sample threshold corresponding to the adjusted threshold conditions with the channel value of each pixel in the corresponding color channel in the second image, the similarity between the food ingredient to be evaluated and the food ingredient sample is obtained. Therefore, the food ingredient sample can be used as a benchmark to objectively and accurately evaluate the food ingredient to be evaluated, solving the problem of inaccurately evaluating the quality of food ingredients.

[0071] In one embodiment, the target recognition region includes a first recognition region and a second recognition region that do not overlap, the threshold conditions include a first threshold condition corresponding to the first recognition region and a second threshold condition corresponding to the second recognition region, and the actual recognition region includes a first sub-region and a second sub-region.

[0072] The first threshold condition is used to indicate the range of channel values ​​in each color channel for the first identification region of the food ingredient sample. The first sub-region is the region segmented based on the first threshold condition.

[0073] The second threshold condition is used to indicate the range of channel values ​​for the second identification region of the food ingredient sample in each color channel. The second sub-region is the region segmented based on the second threshold condition.

[0074] Specifically, when the channel values ​​of a pixel in each color channel simultaneously meet the corresponding threshold conditions, the pixel is identified as a target pixel, and the actual recognition area is obtained based on the target pixel, including: when the channel values ​​of a pixel in each color channel simultaneously meet the corresponding first threshold conditions, the pixel is identified as a first target pixel, and a first sub-region is obtained based on the first target pixel; when the channel values ​​of a pixel in each color channel simultaneously meet the corresponding second threshold conditions, the pixel is identified as a second target pixel, and a second sub-region is obtained based on the second target pixel; if there are overlapping pixels in the first sub-region and the second sub-region, the overlapping pixels are deleted in the first sub-region and in the second sub-region.

[0075] Optionally, when the channel values ​​of a pixel in each color channel are within the range of channel values ​​indicated by the first threshold condition, the pixel is determined to belong to the first target pixel; and a first recognition region segmented based on the set of first target pixels is obtained. Similarly, when the channel values ​​of a pixel in each color channel are within the range of channel values ​​indicated by the second threshold condition, the pixel is determined to belong to the second target pixel; and a second recognition region segmented based on the set of second target pixels is obtained.

[0076] Since the first and second identification regions do not overlap, and assuming the channel value ranges specified by the first and second threshold conditions are accurate, the first and second sub-regions should not overlap. In this embodiment, when overlapping pixels exist between the first and second sub-regions, an overlapping pixel removal mechanism is added to prevent the same pixel from being classified as both the first and second sub-regions simultaneously. By ensuring the uniqueness of the segmentation, accurate adjusted threshold conditions are obtained, thereby improving the accuracy of raw material evaluation.

[0077] Further, in one embodiment, adjusting the threshold conditions to make the degree of overlap between the actual recognition area and the target recognition area identified based on the adjusted threshold conditions greater than or equal to a preset degree includes: adjusting the first threshold conditions until the degree of overlap between the first recognition area and the first sub-region identified based on the adjusted first threshold conditions is greater than or equal to a preset degree; and adjusting the second threshold conditions until the degree of overlap between the second recognition area and the second sub-region identified based on the adjusted second threshold conditions is greater than or equal to a preset degree.

[0078] It is understandable that if the degree of overlap between the initial first recognition region and the first sub-region is greater than or equal to a preset degree, then there is no need to adjust the first threshold condition; similarly, if the degree of overlap between the initial second recognition region and the second sub-region is greater than or equal to a preset degree, then there is no need to adjust the second threshold condition.

[0079] In this embodiment, by adjusting the first threshold condition and the second threshold condition respectively, accurate segmentation of the first recognition region and the second recognition region can be achieved respectively.

[0080] Based on the same principle, the target recognition region can also be divided into three or more non-overlapping regions, which will not be elaborated here.

[0081] In one embodiment, adjusting the threshold condition includes: obtaining the difference pixels between the actual recognition area and the target recognition area; when the difference pixels are pixels within the actual recognition area, narrowing the value range of the threshold condition; and when the difference pixels are pixels within the target recognition area, expanding the value range of the threshold condition.

[0082] Among them, the difference pixels are the pixels in the part that do not overlap between the actual recognition area and the target recognition area.

[0083] The difference pixel is a pixel within the actual recognition area; that is, the difference pixel exists within the actual recognition area but not within the target recognition area. This indicates that a false pixel detection occurred when performing image recognition based on the original threshold conditions. Optionally, the range of threshold conditions can be narrowed by adjusting the upper and / or lower threshold limits until the difference pixel cannot be recognized based on the adjusted threshold conditions. Optionally, the range of threshold conditions can be narrowed by a preset step size; alternatively, the range of threshold conditions can be narrowed based on the channel value of the difference pixel in the actual recognition area until the range does not contain the difference pixel.

[0084] The difference pixel is a pixel within the target recognition area, meaning it exists within the target recognition area but not within the actual recognition area. This indicates that pixel detection was missed when performing image recognition based on the original threshold conditions. Optionally, the range of threshold conditions can be expanded by adjusting the upper and / or lower threshold limits until the difference pixel can be identified based on the adjusted threshold conditions. Optionally, the range of threshold conditions can be expanded by a preset step size; alternatively, the range of threshold conditions can be expanded based on the channel value of the difference pixel in the actual recognition area until the range includes the difference pixel.

[0085] In this embodiment, the adjustment direction of the threshold condition value range is changed according to different recognition results, thereby improving the adjustment efficiency of the threshold condition.

[0086] In one embodiment, the evaluation result of the food ingredient to be evaluated is obtained based on the difference between the channel value of each pixel in the color channel and the corresponding sample threshold in the color channel. This includes: acquiring pixels in the second image that simultaneously satisfy the corresponding adjusted threshold conditions based on the channel values ​​of each color channel, identifying the obtained evaluation region; and obtaining the evaluation result of the food ingredient to be evaluated based on the difference between the channel value of each pixel in the evaluation region and the corresponding sample threshold in the color channel.

[0087] If the food ingredient sample is spoiled, and there are pixels in the second image whose channel values ​​of each color channel simultaneously meet the corresponding adjusted threshold conditions, then the evaluation area corresponds to the spoiled area in the food ingredient to be evaluated. The quality of the food ingredient to be evaluated can be evaluated based on the difference between the channel value of each pixel in the evaluation area and the corresponding sample threshold in the color channel. Otherwise, it is determined that the quality of the food ingredient to be evaluated is not spoiled.

[0088] If the food ingredient sample is a fresh food ingredient, and there are pixels in the second image whose channel values ​​of each color channel simultaneously meet the corresponding adjusted threshold conditions, then the evaluation area corresponds to a fresh area in the food ingredient to be evaluated. The freshness of the food ingredient to be evaluated can be assessed based on the difference between the channel value of each pixel in the evaluation area and the corresponding sample threshold in the color channel. Otherwise, it is determined that the food ingredient to be evaluated does not have a fresh area and is completely spoiled.

[0089] Optionally, when obtaining the evaluation result of the food ingredient to be evaluated based on the difference between the channel value of each pixel in the evaluation area in the color channel and the corresponding sample threshold in the color channel, the evaluation result can be obtained based on the channel value distribution of pixels that meet the adjusted threshold conditions. For example, taking a target recognition area including green vegetable leaves as an example, if the distribution of the a-value of a pixel in the a-channel that meets the adjusted threshold conditions shifts towards 0 or a positive value compared to the a-value in the sample threshold, then an evaluation result of quality degradation is obtained. The correspondence between the channel value distribution of pixels and the evaluation result can also be set according to application requirements, raw material type, and other factors, and is not limited here.

[0090] In this embodiment, the adjusted threshold conditions are used to identify the food raw materials to be evaluated, focusing on specific evaluation areas in the second image, and accurately and automatically generating the evaluation results of the food raw materials to be evaluated.

[0091] In one embodiment, before acquiring the channel values ​​of pixels in a first image containing a food ingredient sample in multiple color channels, the method further includes: performing an opening operation on the first image if noise exists in the first image; and performing a closing operation on the first image if holes and / or gaps exist in the area where the food ingredient sample is located in the first image.

[0092] The noise in the first image includes speckles and / or noise. Specifically, when photographing food ingredient samples, if there is stacking of the food ingredient samples, shadow areas caused by occlusion will be formed in the first image. Due to insufficient lighting, these shadow areas generate noise due to their low signal-to-noise ratio, which manifests as noise speckles in the first image. When photographing food ingredient samples, due to external environmental interference, noise may also exist in the background of the first image other than the food ingredient samples, which manifests as background noise in the first image.

[0093] Holes and / or gaps are unfilled voids that appear in the area where the food ingredient is located. Specifically, when photographing a food ingredient sample, due to the irregular shape of the food ingredient sample, gaps may appear in the area where the food ingredient sample is located in the first image. These gaps appear as holes and / or gaps in the first image.

[0094] Optionally, performing an opening operation on the first image includes: performing a morphological operation of erosion followed by dilation on the first image. Performing a closing operation on the first image includes: performing a morphological operation of dilation followed by erosion on the first image.

[0095] For example, opening and closing operations can be performed directly on the first image without determining whether there is noise, holes or gaps in the first image.

[0096] In this embodiment, by performing an opening operation on the first image containing noise, tiny noise spots in the mask are removed. By performing a closing operation on the first image containing holes and / or gaps, the small gaps inside the area where the food raw material sample of the first image is located are filled, thereby improving the image quality of the first image.

[0097] Because Lab space has good perceived uniformity, to improve the accuracy of food ingredient evaluation, in one embodiment, the channel values ​​of pixels in a first image containing a food ingredient sample in multiple color channels are obtained, including: obtaining the channel values ​​of pixels in the first image in each color channel of Lab space. The color channels of Lab space include L channel, a channel, and b channel.

[0098] Optionally, the camera vertically captures the food ingredient sample from top to bottom to obtain a first image; the RGB values ​​of the first image are mapped to the Lab color space to obtain the channel values ​​of the pixels in the first image in multiple color channels.

[0099] In one embodiment, the food ingredient can be set as a freeze-dried food ingredient. Since freeze-dried food ingredients are often sheared and broken, setting threshold conditions for identifying such ingredients is difficult, and quality assessment is challenging. Adjusting the threshold conditions based on the degree of overlap between the actual identification area and the target identification area can achieve accurate evaluation of freeze-dried foods. Optionally, considering the sheared and broken nature of freeze-dried food ingredients, performing opening and / or closing operations on the first image further significantly improves the accuracy of identifying such food ingredient samples.

[0100] In one embodiment, Figure 3 A method for evaluating food ingredients applied to freeze-dried cabbage is provided, such as... Figure 3 As shown, it includes:

[0101] Step 301: Obtain images of fresh food raw material samples and spoiled food raw material samples.

[0102] Optionally, a camera can be used to capture surface images of the entire freeze-dried cabbage, covering the entire visible area of ​​the fruit and vegetable, thereby capturing the continuous spatial distribution of the color of the food raw material sample.

[0103] When capturing multiple images, the shooting mode needs to be fixed. Alternatively, parameters such as shooting distance, shutter speed, ISO, and aperture can be adjusted and then fixed according to the image sharpness to ensure that the shooting conditions are the same each time.

[0104] Optionally, an image capturing system can be set up to photograph fresh and spoiled food ingredient samples. The food ingredient samples can be placed in a lightbox containing a standard D65 light source, and the parameters of the lightbox are as follows: Under fixed camera shooting conditions and lightbox light source intensity, a color image of the vegetable leaf is acquired vertically using the camera. The shooting device can be a digital camera; the specific camera model is not fixed, and different digital cameras can be used. Other devices with video recording capabilities can also be used, without limitation. When capturing multiple images, a lightbox with the same light intensity and a standard D65 light source should be selected, and the size of the lightbox must be sufficient to accommodate the sample. For example, the dimensions of the lightbox are approximately... Ensure that the shooting distance is the same.

[0105] After acquiring images of fresh and spoiled food raw material samples, computational software can be used to read the images captured by the digital camera and analyze their RGB channel data. Using a color space algorithm—specifically the CIELAB color space conversion method defined in the international standard ISO 11664-4—the RGB values ​​are mapped to the Lab space, ultimately yielding the values ​​(channel values) of the L, a, and b channels. Compared to the RGB space, the Lab space better aligns with human visual perception in its color differentiation, is less affected by lighting conditions, and provides more stable segmentation results when subsequent segmentation is performed based on threshold conditions.

[0106] Furthermore, after acquiring the image, a small noise spot in the mask can be removed first by opening (erosion followed by dilation), such as background noise. Then, a closing operation (dilation followed by erosion) can be used to fill the small holes inside the target area, such as the small holes on the leaves of freeze-dried cabbage or the gaps on the roots.

[0107] Optionally, after acquiring images of fresh food ingredient samples and spoiled food ingredient samples, the images can be imported into a Matlab processing program to perform the following steps.

[0108] Step 302: Set the L, a, and b values ​​for identifying vegetable roots and leaves, and obtain the threshold conditions corresponding to the L, a, and b channels respectively.

[0109] Alternatively, a specific method for setting the values ​​of L, a, and b is provided below.

[0110] Table 1 shows that, based on the set values ​​of L, a, and b, two threshold arrays can be obtained. These two threshold arrays directly serve the segmentation of green leaves and yellow roots, and the setting logic is as follows:

[0111] Table 1

[0112]

[0113] In this embodiment, the L, a, and b values ​​used to identify vegetable roots and leaves are set as the sample thresholds, and the threshold array is the threshold condition in the above embodiment; the threshold condition can be constructed based on the sample thresholds.

[0114] For leafy greens: setting the upper limit of the L value to infinity allows for no restriction on the bright areas of the leaf; setting the upper limit of the a value to -2 allows for the retention of only the green area and the exclusion of red; setting the lower limit of the b value to 2 allows for the exclusion of blue and the retention of greenish or yellowish-green colors.

[0115] For vegetable roots: setting the lower limit of the L value to infinity will not restrict the dark areas of the vegetable roots; setting the lower limit of the a value to -2 will retain pixels with weak green and no red, which will match the color of the vegetable roots; setting the lower limit of the b value to 15 will only retain areas with a high proportion of yellow.

[0116] Step 303: Segment the vegetable leaves and roots in the image according to the threshold conditions, remove overlapping areas, and highlight the identified samples.

[0117] Optionally, by setting a threshold array and using Boolean logic operations, "multi-condition judgment" is performed on each pixel to filter the area mask where the channel value in each channel simultaneously meets the threshold condition of the threshold array, thereby accurately capturing the edge features of the vegetable leaves and roots, as well as the transition structure of the two towards the central area.

[0118] Removing overlapping regions can avoid classification conflicts, including: identifying overlapping pixels between vegetable leaves and roots. Overlapping pixels are pixels that simultaneously satisfy two threshold arrays. Overlapping pixels are removed from the two masks to prevent the same pixel from being classified as both vegetable leaves and roots, thus ensuring the uniqueness of the segmentation.

[0119] Step 304: Display the distribution of the a value of the vegetable leaves and the distribution of the b value of the vegetable roots.

[0120] Step 305: Determine if almost all samples have been identified. If not, proceed to step 306; if yes, proceed to step 307.

[0121] Optionally, determine whether almost all vegetable leaves in the sample are identified; if not, adjust the threshold array corresponding to the vegetable leaves. Determine whether almost all vegetable roots in the sample are identified; if not, adjust the threshold array corresponding to the vegetable roots. If both vegetable leaves and vegetable roots in the sample are basically identified, proceed to step 307.

[0122] Step 306: Adjust the L, a, and b values ​​used to identify vegetable roots and leaves.

[0123] Optionally, for the image of the sample obtained in step 301, an initial value can be set in step 302. The value. Further, the distribution of the a and b channels of the image can be obtained through program processing. In step 306, the image used for recognition can be readjusted based on the distribution of the a and b channels. The thresholds for channels a and b are adjusted according to the actual recognition results, resulting in flexible optimization and better segmentation stability.

[0124] Optionally, the adjustment methods for L, a, and b include:

[0125] If the leaf segmentation misses a detection, it indicates that a green area has not been identified. The upper limit of the a value and the lower limit of the b value can be appropriately increased to expand the detection range of the green area. If the leaf segmentation misdetects a detection, it indicates that yellow and / or red areas are mixed in within the identified area. The upper limit of the a value and the lower limit of the b value can be appropriately decreased to narrow the detection range of the green area.

[0126] If the vegetable root segmentation misses a detection, it indicates that the yellow area has not been identified. The lower limit of the a value and the lower limit of the b value can be appropriately lowered to expand the detection range of the yellow area. If the vegetable root segmentation is falsely detected, it indicates that the green area is mixed in with the identified area. The lower limit of the a value and the lower limit of the b value can be appropriately raised to narrow the detection range of the yellow area.

[0127] Understandably, the L value can be adjusted according to actual needs, and no restrictions are imposed here.

[0128] Step 307: Complete program debugging and measure the change in the blue color of freeze-dried vegetables.

[0129] Optionally, the actual a value and actual b value of freeze-dried cabbage are compared with the a and b values ​​obtained by setting up a values ​​for identifying the roots and leaves of the cabbage, and the core visual indicators for quality evaluation are obtained based on the comparison results.

[0130] Taking the distribution of the actual a value of vegetable leaves relative to the preset a value as a basis for quality assessment, for example:

[0131] The distribution of a-values ​​in vegetable leaves reflects the "greenness" and "redness" of the leaves. The more the actual a-value distribution of the leaves is biased towards negative values ​​compared to the preset a-value distribution, such as a-values ​​concentrated between -10 and -5, it indicates that the green color of the leaves is more intense and vibrant. If the a-value distribution shifts towards 0 or positive values, such as a-values ​​concentrated between -2 and 5, it indicates that the leaves are turning yellow or brown, the green color is fading, and the quality is declining.

[0132] Taking the distribution of the b-value of vegetable leaves relative to the preset b-value as a basis for quality assessment, for example:

[0133] The distribution of b-values ​​in vegetable leaves is used to reflect the "yellowness" of the leaves. The more the actual b-value distribution of the leaves is biased towards lower positive values ​​compared to the preset b-value distribution, such as b-values ​​concentrated between 2 and 10, it indicates that the yellow content of the leaves is low and the green is pure. If the b-value distribution shifts towards higher positive values, such as b-values ​​concentrated between 10 and 20, it indicates that the leaves are severely yellowed, which may be due to spoilage before dehydration or excessive heating during the dehydration process.

[0134] This embodiment uses image capture technology combined with computational processing to convert the RGB values ​​of an image into... Value, based on preset The threshold condition is determined, image recognition is performed based on the threshold condition, and the preset parameters are adjusted based on the image recognition results. Value; based on adjusted The value in the image of the freeze-dried cabbage to be evaluated This method uses color assessment to accurately, objectively, and efficiently quantify the color changes of cabbage. It has no morphological limitations on the shape and size of the sample, is highly efficient, and has a wide range of applications. It should be understood that the food ingredient assessment method in this embodiment can also be applied to other freeze-dried ingredients besides freeze-dried cabbage, including but not limited to freeze-dried fruits, freeze-dried meats, and other freeze-dried vegetables such as scallions and cilantro. Different threshold conditions, threshold adjustment methods, and target recognition areas need to be set for different freeze-dried ingredients.

[0135] Based on the same inventive concept, this application also provides a food ingredient evaluation apparatus for implementing the food ingredient evaluation method described above. The solution provided by this apparatus is similar to the solution described in the above method; therefore, the specific limitations in one or more embodiments of the food ingredient evaluation apparatus provided below can be found in the limitations of the food ingredient evaluation method described above, and will not be repeated here.

[0136] In one embodiment, such as Figure 4 As shown, a food ingredient evaluation device 400 is provided, comprising:

[0137] Image acquisition module 401 is used to acquire the channel values ​​of pixels in multiple color channels in a first image containing food raw material samples.

[0138] The threshold acquisition module 402 is used to acquire preset threshold conditions corresponding to each color channel; the threshold conditions are used to identify the target recognition area of ​​the food raw material sample.

[0139] The recognition module 403 is used to identify a pixel as a target pixel when the channel values ​​of a pixel in each color channel simultaneously meet the corresponding threshold conditions, and to obtain the actual recognition area based on the target pixel.

[0140] The threshold adjustment module 404 is used to adjust the threshold conditions so that the degree of overlap between the actual recognition area and the target recognition area obtained based on the adjusted threshold conditions is greater than or equal to a preset degree.

[0141] The evaluation module 405 is used to acquire a second image containing the food raw material to be evaluated and a sample threshold for constituting the adjusted threshold conditions. Based on the difference between the channel value of each pixel in the color channel in the second image and the sample threshold in the corresponding color channel, the evaluation result of the food raw material to be evaluated is obtained.

[0142] In one embodiment, the recognition module 403 confirms a pixel as a target pixel when the channel values ​​of a pixel in each color channel simultaneously meet the corresponding threshold conditions, and obtains an actual recognition region based on the target pixel. This includes: when the channel values ​​of a pixel in each color channel simultaneously meet the corresponding first threshold conditions, confirming the pixel as a first target pixel, and obtaining a first sub-region based on the first target pixel; when the channel values ​​of a pixel in each color channel simultaneously meet the corresponding second threshold conditions, confirming the pixel as a second target pixel, and obtaining a second sub-region based on the second target pixel; if there are overlapping pixels in the first sub-region and the second sub-region, deleting the overlapping pixels in the first sub-region and deleting the overlapping pixels in the second sub-region. The target recognition region includes a non-overlapping first recognition region and a second recognition region; the threshold conditions include a first threshold condition corresponding to the first recognition region and a second threshold condition corresponding to the second recognition region; and the actual recognition region includes the first sub-region and the second sub-region.

[0143] Further, the threshold adjustment module 404 adjusts the threshold conditions so that the degree of overlap between the actual recognition area and the target recognition area identified based on the adjusted threshold conditions is greater than or equal to a preset degree, including: adjusting the first threshold condition until the degree of overlap between the first recognition area and the first sub-region identified based on the adjusted first threshold condition is greater than or equal to a preset degree; adjusting the second threshold condition until the degree of overlap between the second recognition area and the second sub-region identified based on the adjusted second threshold condition is greater than or equal to a preset degree.

[0144] In one embodiment, the threshold adjustment module 404 adjusts the threshold conditions, including: acquiring the difference pixels between the actual recognition area and the target recognition area; when the difference pixels are pixels within the actual recognition area, narrowing the value range corresponding to the threshold conditions; and when the difference pixels are pixels within the target recognition area, expanding the value range corresponding to the threshold conditions.

[0145] In one embodiment, before acquiring the pixel values ​​in a first image containing a food ingredient sample and the channel values ​​in multiple color channels, the image acquisition module 401 is further configured to: perform an opening operation on the first image if noise exists in the first image; and perform a closing operation on the first image if holes and / or gaps exist in the area where the food ingredient sample is located in the first image.

[0146] In one embodiment, the evaluation module 405 obtains the evaluation result of the food ingredient to be evaluated based on the difference between the channel value of each pixel in the color channel and the corresponding sample threshold in the color channel in the second image. This includes: acquiring pixels in the second image that simultaneously satisfy the corresponding adjusted threshold conditions based on the channel value of each color channel, identifying the obtained evaluation area; and obtaining the evaluation result of the food ingredient to be evaluated based on the difference between the channel value of each pixel in the evaluation area and the corresponding sample threshold in the color channel.

[0147] In one embodiment, the image acquisition module 401 acquires the channel values ​​of pixels in a first image containing food ingredient samples in multiple color channels, including: acquiring the channel values ​​of pixels in the first image in each color channel of the Lab color space.

[0148] Each module in the aforementioned food ingredient evaluation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0149] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a method for evaluating food ingredients. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0150] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0151] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0152] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0153] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0154] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0155] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0156] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for evaluating food raw materials, characterized in that, The method includes: Obtain the channel values ​​of pixels in multiple color channels from a first image containing food ingredient samples; Obtain preset threshold conditions corresponding to each of the color channels; the threshold conditions are used to identify the target recognition region of the food raw material sample; When the channel values ​​of the pixel in each of the color channels simultaneously meet the corresponding threshold conditions, the pixel is confirmed as a target pixel, and the actual recognition area is obtained based on the target pixel. The threshold condition is adjusted so that the degree of overlap between the actual recognition area identified based on the adjusted threshold condition and the target recognition area is greater than or equal to a preset degree. A second image containing the food ingredient to be evaluated and a sample threshold used to constitute the adjusted threshold conditions are obtained. The evaluation result of the food ingredient to be evaluated is obtained based on the difference between the channel value of each pixel in the second image in the color channel and the corresponding sample threshold in the color channel.

2. The method according to claim 1, characterized in that, The target recognition region includes a first recognition region and a second recognition region that do not overlap; the threshold conditions include a first threshold condition corresponding to the first recognition region and a second threshold condition corresponding to the second recognition region; and the actual recognition region includes a first sub-region and a second sub-region. When the pixel simultaneously satisfies the corresponding threshold condition in each of the color channels, the pixel is confirmed as a target pixel, and the actual recognition area is obtained based on the target pixel, including: When the channel values ​​of the pixel in each of the color channels simultaneously meet the corresponding first threshold conditions, the pixel is confirmed as the first target pixel, and the first sub-region is obtained based on the first target pixel; When the channel values ​​of the pixel in each of the color channels simultaneously meet the corresponding second threshold conditions, the pixel is confirmed as the second target pixel, and the second sub-region is obtained based on the second target pixel; If there are overlapping pixels in the first sub-region and the second sub-region, delete the overlapping pixels in the first sub-region and delete the overlapping pixels in the second sub-region.

3. The method according to claim 2, characterized in that, The adjustment of the threshold condition, such that the overlap between the actual recognition region identified based on the adjusted threshold condition and the target recognition region is greater than or equal to a preset degree, includes: Adjust the first threshold condition until the degree of overlap between the first identification region and the first sub-region identified based on the adjusted first threshold condition is greater than or equal to a preset degree. Adjust the second threshold condition until the degree of overlap between the second identification region and the second sub-region identified based on the adjusted second threshold condition is greater than or equal to the preset degree.

4. The method according to claim 1, characterized in that, The adjustment of the threshold condition includes: Obtain the pixel differences between the actual recognition area and the target recognition area; When the difference pixel is a pixel within the actual recognition area, the value range corresponding to the threshold condition is narrowed; When the difference pixel is a pixel within the target recognition area, the range of values ​​corresponding to the threshold condition is expanded.

5. The method according to claim 1, characterized in that, Before acquiring the pixel values ​​in multiple color channels of a first image containing food ingredient samples, the method further includes: If noise exists in the first image, perform an opening operation on the first image; If there are holes and / or gaps in the area where the food ingredient sample in the first image is located, the first image undergoes a closing operation.

6. The method according to claim 1, characterized in that, The step of obtaining the evaluation result of the food raw material to be evaluated based on the difference between the channel value of each pixel in the second image in the color channel and the corresponding sample threshold in the color channel includes: In the second image, the evaluation region is identified by recognizing the pixels whose channel values ​​of each color channel simultaneously satisfy the corresponding adjusted threshold conditions. The evaluation result of the food ingredient to be evaluated is obtained based on the difference between the channel value of each pixel in the evaluation area in the color channel and the corresponding sample threshold in the color channel.

7. The method according to claim 1, characterized in that, The step of obtaining the channel values ​​of pixels in multiple color channels in a first image containing food ingredient samples includes: Obtain the channel values ​​of each color channel in the Lab color space for the pixels in the first image.

8. A food ingredient evaluation device, characterized in that, The device includes: The image acquisition module is used to acquire the channel values ​​of pixels in multiple color channels in a first image containing food raw material samples. A threshold acquisition module is used to acquire preset threshold conditions corresponding to each of the color channels; the threshold conditions are used to identify the target recognition region of the food raw material sample. The recognition module is used to identify a pixel as a target pixel when the channel values ​​of the pixel in each of the color channels simultaneously meet the corresponding threshold conditions, and to obtain the actual recognition area based on the target pixel. A threshold adjustment module is used to adjust the threshold conditions so that the degree of overlap between the actual recognition area identified based on the adjusted threshold conditions and the target recognition area is greater than or equal to a preset degree. The evaluation module is used to acquire a second image containing the food ingredient to be evaluated, a sample threshold for constituting the adjusted threshold conditions, and to obtain the evaluation result of the food ingredient to be evaluated based on the difference between the channel value of each pixel in the second image in the color channel and the corresponding sample threshold in the color channel.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.