A monitoring method and system for turmeric saponin fermentation process based on image processing
By adjusting the frequency threshold of the gray value according to the local texture complexity and fermentation change in the turmeric fermentation image, the problem of sedimentation and bubble features being swallowed up by the histogram equalization algorithm is solved, and the accuracy of monitoring the degree of turmeric fermentation is improved.
Patent Information
- Application Number
- CN202411046753.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-08-01
AI Technical Summary
When the existing histogram equalization algorithm enhances turmeric fermentation images, it may cause sedimentation and bubble features to be swallowed up, affecting the accuracy of monitoring the degree of turmeric fermentation.
By determining the necessity of enhancement based on the local texture complexity and fermentation change of the target pixel in the turmeric fermentation image, setting the frequency threshold of the gray value, correcting the frequency of the gray value to ensure that the frequency of sedimentation and bubble features remains large, Avoid being swallowed and improve the contrast of turmeric syrup water.
It effectively enhances the sedimentation and bubble characteristics in fermentation images, improves the accuracy of monitoring the degree of turmeric fermentation, and avoids excessive enhancement of turmeric slurry water.
Smart Images

Figure CN118570113B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to a method and system for monitoring a turmeric saponin fermentation process based on image processing. Background Art
[0002] Curcumin is a natural compound extracted from turmeric rhizomes. It has strong antioxidant and anti-inflammatory properties and is widely used in medicine, food and cosmetics. Curcumin can be produced by fermenting turmeric slurry. Traditional determination of turmeric fermentation degree usually relies on chemical analysis, which is cumbersome, time-consuming and inefficient.
[0003] Since turmeric fermentation produces precipitation and bubbles, the state of precipitation and bubbles can reflect the degree of turmeric fermentation. Therefore, the fermentation of turmeric can be monitored by identifying the precipitation and bubbles in the fermentation image of turmeric. However, since bubbles and precipitation may be close to the color characteristics of turmeric slurry itself, the precipitation and bubbles in the fermentation image are not obvious, so the fermentation image needs to be enhanced.
[0004] The patent document with publication number "CN105894481A" discloses a histogram equalization method and device for video surveillance equipment, the method comprising: obtaining an inverse transformation curve of the grayscale transformation curve used for the current input image; calculating the cumulative distribution function CDF0 of the current output image based on the histogram of the current output image; obtaining the cumulative distribution function CDF1 after inverse transformation of the cumulative distribution function CDF0 through the inverse transformation curve; performing an inverse calculation process on the cumulative distribution function CDF1 to obtain the histogram of the current input image; calculating the grayscale transformation curve of the current input image according to the histogram of the current input image for histogram equalization of the next input image.
[0005] Although the above methods can achieve the enhancement effect to a certain extent, the histogram equalization enhancement algorithm used may over-enhance the grayscale values with higher frequencies and may swallow up the grayscale values with lower frequencies. During the fermentation process of turmeric, the frequency of the grayscale values corresponding to the color features of the turmeric slurry itself in the fermentation image is relatively large, while the frequency of the grayscale values corresponding to features such as precipitation and bubbles may be relatively small. Directly enhancing the fermentation image using the histogram equalization algorithm may cause features such as precipitation and bubbles to be swallowed up, thereby affecting the accuracy of monitoring the fermentation degree of turmeric. Summary of the invention
[0006] In order to solve the problem that enhancement of fermentation images by using a histogram equalization algorithm may cause features such as precipitation and bubbles to be swallowed up, thereby affecting the accuracy of monitoring the fermentation degree of turmeric, the present invention provides a turmeric saponin fermentation process monitoring method and system based on image processing.
[0007] In the first aspect, the present invention provides a method for monitoring the fermentation process of turmeric saponin based on image processing, which adopts the following technical scheme:
[0008] A method for monitoring the fermentation process of turmeric saponin based on image processing comprises the following steps:
[0009] Determine the local texture complexity of the target pixel point according to the grayscale distribution of the pixel points in the neighborhood of the target pixel point in the fermentation image at the current moment; The grayscale value of the pixel point at the same position as the target pixel point in the fermentation image at each moment and the serial number of the corresponding moment constitute the data point at each moment; Cluster the data points at all moments, and determine the fermentation change degree of the target pixel point according to the clustering results : ,in represents the number of clusters, Indicates the number of data points in the cluster to which the data point at the current moment belongs. Indicates the number of data points in the cluster to which the data point at the current moment belongs that have consecutive serial numbers with the data point at the current moment. Represents a piecewise function: ; Determine the necessity of enhancing the target pixel point, and the necessity of enhancement is positively correlated with the local texture complexity and fermentation change degree of the target pixel point; Determine the frequency threshold of each gray value in the fermentation image at the current moment, and the frequency threshold is positively correlated with the mean value of the necessity of enhancement of all pixels corresponding to each gray value; Correct the frequency of each gray value according to the frequency threshold of each gray value, and enhance the fermentation image at the current moment based on the corrected frequency of each gray value to obtain an enhanced image; Identify the fermentation degree of turmeric according to the enhanced image.
[0010] The present invention obtains the necessity of enhancing the target pixel through the local texture complexity of the target pixel and the fermentation variation, so that the necessity of enhancing the pixel corresponding to the features such as precipitation and bubbles in the fermentation process of yellow ginger is relatively large, and the necessity of enhancing the pixel corresponding to the yellow ginger slurry is relatively small. The frequency threshold of each gray value is obtained according to the necessity of enhancement, and the frequency of each gray value is corrected, so that the gray value corresponding to the features such as precipitation and bubbles is kept at a larger frequency as much as possible, and the features such as precipitation and bubbles are prevented from being swallowed up during the enhancement process, so that the gray value corresponding to the yellow ginger slurry is reduced as much as possible, and the gray value corresponding to the yellow ginger slurry itself is prevented from being excessively enhanced. The present invention has a good enhancement effect on the features such as precipitation and bubbles in the fermentation image, and improves the accuracy of fermentation degree monitoring.
[0011] Preferably, the local texture complexity satisfies the expression: ;in, Indicates the fermentation image at the current moment The local texture complexity of each pixel; Indicates the fermentation image at the current moment The pixel in the neighborhood The gray value of each pixel; Indicates the fermentation image at the current moment The mean gray value of all pixels in the neighborhood of a pixel; Indicates the fermentation image at the current moment The number of pixels contained in the neighborhood of a pixel; represents a hyperparameter; represents the hyperbolic tangent function.
[0012] Preferably, the method for obtaining the hyperparameter is as follows: constructing a grayscale histogram of the fermentation image at the current moment, performing mixed Gaussian fitting on the grayscale histogram of the fermentation image at the current moment, and obtaining a mixed Gaussian model, wherein the number of sub-Gaussian models included in the mixed Gaussian model is the number of maximum points in the grayscale histogram of the fermentation image at the current moment; and taking the mean of the standard deviation parameters of all sub-Gaussian models included in the mixed Gaussian model as the hyperparameter. .
[0013] The present invention uses the mean of the standard deviation parameters of all sub-Gaussian models as a hyperparameter to measure the local texture complexity of pixels. Since the standard deviation of the sub-Gaussian model reflects the grayscale distribution fluctuation of the corresponding image feature, when the local grayscale fluctuation of the pixel exceeds the average level of the grayscale distribution fluctuation of each image feature in the fermentation image at the current moment, it means that the local part of the pixel is more likely to contain multiple image features. Otherwise, it means that the local part of the pixel is more likely to contain only one image feature. The local texture complexity of the pixel obtained based on the standard deviation of the sub-Gaussian model is more accurate.
[0014] Preferably, the clustering adopts a mean shift clustering algorithm.
[0015] Preferably, the enhancement necessity satisfies the expression: ;in, Indicates the fermentation image at the current moment Necessity of pixel enhancement; Indicates the fermentation image at the current moment The local texture complexity of each pixel; Indicates the fermentation image at the current moment The fermentation change degree of each pixel.
[0016] The present invention reflects the possibility that a pixel point is a feature such as a precipitate or a bubble generated in the turmeric fermentation process through local texture complexity and fermentation variation, and obtains the necessity of enhancement according to the local texture complexity and fermentation variation, so that the necessity of enhancing the pixel points corresponding to the features such as the precipitate or the bubble is greater, and the grayscale values corresponding to the features such as the precipitate or the bubble can be enhanced during subsequent enhancement, so that the features such as the precipitate or the bubble generated in the turmeric fermentation process can enhance the contrast with the turmeric slurry itself, thereby improving the accuracy of identifying the fermentation degree of turmeric.
[0017] Preferably, the enhancement necessity satisfies the expression: ;in, Indicates the fermentation image at the current moment Necessity of pixel enhancement; Indicates the fermentation image at the current moment The local texture complexity of each pixel; Indicates the fermentation image at the current moment The fermentation change degree of each pixel; Represents the maximum value function.
[0018] Preferably, the frequency threshold of each gray value satisfies the expression: ;in, Represents the grayscale value in the fermentation image at the current moment The frequency threshold of Indicates that the gray value in the fermentation image at the current moment is No. Necessity of pixel enhancement; Indicates that the gray value in the fermentation image at the current moment is The number of pixels.
[0019] The present invention sets a larger frequency threshold for the grayscale value of the pixel point with a large enhancement necessity corresponding to features such as precipitation and bubbles, so as to avoid the frequency of the grayscale value being clipped, so that the grayscale value maintains a larger frequency as much as possible, so as to improve the enhancement effect of features such as precipitation and bubbles, and avoid the precipitation, bubbles and other features being swallowed up during the enhancement process. A smaller frequency threshold is set for the grayscale value of the pixel point with a small enhancement necessity corresponding to the turmeric slurry itself, and the frequency of the grayscale value is reduced by the frequency threshold to avoid the grayscale value corresponding to the turmeric slurry itself from being excessively enhanced, thereby affecting the enhancement effect of features such as precipitation and bubbles.
[0020] Preferably, the frequency of each grayscale value is corrected according to the frequency threshold of each grayscale value, including: in response to the frequency of the grayscale value in the fermentation image at the current moment being greater than the frequency threshold of the grayscale value, cropping the part of the grayscale value whose frequency is greater than the frequency threshold, and evenly distributing the cropped part to all grayscale values, thereby achieving correction of the frequency of the grayscale value.
[0021] The present invention cuts the frequency of the gray value whose frequency is greater than the frequency threshold, thereby avoiding the situation that the frequency of the gray value corresponding to the turmeric slurry itself is large, so that the turmeric slurry is over-enhanced, resulting in the gray corresponding to features such as precipitation and bubbles being swallowed up. Enhancement is performed based on the corrected gray value, which improves the contrast between features such as precipitation and bubbles and the turmeric slurry, thereby improving the accuracy of identifying the fermentation degree of turmeric.
[0022] Preferably, the enhancement adopts a histogram equalization enhancement algorithm.
[0023] In a second aspect, the present invention provides a turmeric saponin fermentation process monitoring system based on image processing, which adopts the following technical scheme:
[0024] A turmeric saponin fermentation process monitoring system based on image processing comprises: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned turmeric saponin fermentation process monitoring method based on image processing is implemented.
[0025] By adopting the above technical solution, the above-mentioned image processing-based turmeric saponin fermentation process monitoring method is generated into a computer program and stored in a memory so as to be loaded and executed by a processor, thereby making a terminal device based on the memory and the processor for easy use.
[0026] The present invention has the following technical effects:
[0027] The present invention performs frequency correction on each grayscale value, so that the grayscale value corresponding to features such as precipitation and bubbles can maintain a larger frequency as much as possible, avoiding the precipitation, bubbles and other features from being swallowed up during the enhancement process, and reducing the grayscale value corresponding to the turmeric slurry as much as possible, avoiding the grayscale value corresponding to the turmeric slurry itself from being over-enhanced. The enhancement effect of features such as precipitation and bubbles in the fermentation image is good, and the accuracy of fermentation degree monitoring is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-restrictive manner, and the same or corresponding reference numerals represent the same or corresponding parts.
[0029] Figure 1 The present invention is a flowchart of a method for monitoring the fermentation process of turmeric saponin based on image processing according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0031] It should be understood that when the terms "first", "second", etc. are used in the claims, descriptions, and drawings of the present invention, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the description and claims of the present invention indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their collections.
[0032] The embodiment of the present invention discloses a method for monitoring the fermentation process of turmeric saponin based on image processing, referring to Figure 1 , comprising steps S1 to S6:
[0033] S1: Collect fermentation images of turmeric at different times.
[0034] Fermentation images at various times during the fermentation of turmeric are collected. In the present invention, the images are collected every 10 minutes. In other embodiments, the implementation personnel can set the collection interval according to the actual implementation situation. In order to facilitate subsequent processing, the fermentation images collected in the present invention are all grayscale images.
[0035] S2: Determine the local texture complexity of each pixel point according to the grayscale distribution of the pixel points in the neighborhood of each pixel point in the fermentation image at the current moment.
[0036] It should be noted that in the early stage of yellow turmeric fermentation, no precipitation, bubbles and other changes have been produced, and the fermentation image shows the characteristics of yellow turmeric slurry, and the grayscale of yellow turmeric slurry is relatively uniform. As the fermentation process proceeds, precipitation, bubbles and other changes are continuously produced, and the fermentation image contains features such as yellow turmeric slurry, precipitation, and bubbles, so that the local grayscale of the pixel changes. Therefore, the present invention measures the local grayscale distribution of the pixel, obtains the local texture complexity of the pixel, so that the necessity of enhancing the pixel is determined according to the local texture complexity of the pixel, and the features such as precipitation and bubbles are enhanced.
[0037] In one embodiment, the local texture complexity of each pixel is determined according to the grayscale distribution of the pixel in the neighborhood of each pixel in the fermentation image at the current moment:
[0038] ;
[0039] in, Indicates the fermentation image at the current moment The local texture complexity of each pixel; Indicates the fermentation image at the current moment The pixel in the neighborhood The gray value of each pixel; Indicates the fermentation image at the current moment The mean gray value of all pixels in the neighborhood of a pixel; Indicates the fermentation image at the current moment The number of pixels contained in the neighborhood of a pixel; represents the hyperbolic tangent function. Indicates the fermentation image at the current moment The standard deviation of the grayscale values of all pixels in the neighborhood of a pixel reflects the current moment of the fermentation image. The fluctuation of the local grayscale of each pixel point. Due to the precipitation and bubbles produced during the fermentation of turmeric, there are differences between the grayscale of the precipitation and bubbles and the turmeric slurry itself. When the standard deviation The larger the The greater the local texture complexity of the pixel, the The area where the pixel is located is more likely to have precipitation, bubbles and other changes produced during the fermentation of turmeric. The gray value corresponding to each pixel is enhanced to improve the The contrast between the precipitation and bubbles contained in the pixel and the turmeric water itself. The more hours, the The smaller the local texture complexity of the pixel, the The grayscale of the area where the pixels are located is relatively uniform, which is more likely to be the early stage of turmeric fermentation, and no precipitation, bubbles, etc. have occurred. This is to prevent the standard deviation from being too large, resulting in The denominator is always close to 1. The present invention is described by taking 10 as an example. In other embodiments, the implementer can set the value of the denominator according to the actual implementation situation.
[0040] In another embodiment, the local texture complexity of each pixel is determined according to the grayscale distribution of the pixel in the neighborhood of each pixel in the fermentation image at the current moment, specifically:
[0041] Count all grayscale values and grayscale value frequencies that appear in the fermentation image at the current moment, with the grayscale value as the horizontal axis and the grayscale value frequency as the vertical axis, to construct a grayscale histogram of the fermentation image at the current moment. Count the number of maximum value points in the grayscale histogram of the fermentation image at the current moment.
[0042] A mixed Gaussian fitting is performed on the grayscale histogram of the fermentation image at the current moment to obtain a mixed Gaussian model. The number of sub-Gaussian models included in the mixed Gaussian model is the number of maximum value points in the grayscale histogram of the fermentation image at the current moment.
[0043] Determine the local texture complexity of each pixel in the fermentation image at the current moment:
[0044] ;
[0045] in, Indicates the fermentation image at the current moment The local texture complexity of each pixel; Indicates the fermentation image at the current moment The pixel in the neighborhood The gray value of each pixel; Indicates the fermentation image at the current moment The mean gray value of all pixels in the neighborhood of a pixel; Indicates the fermentation image at the current moment The number of pixels contained in the neighborhood of a pixel; The mixed Gaussian model of the grayscale histogram of the fermentation image at the current moment The standard deviation parameter of the sub-Gaussian model; The number of sub-Gaussian models included in the mixed Gaussian model representing the grayscale histogram of the fermentation image at the current moment is, that is, the number of maximum value points in the grayscale histogram of the fermentation image at the current moment.
[0046] Indicates the fermentation image at the current moment The standard deviation of the grayscale values of all pixels in the neighborhood of a pixel reflects the current moment of the fermentation image. The fluctuation of the local grayscale of each pixel; each sub-Gaussian model contained in the mixed Gaussian model of the grayscale histogram of the fermentation image at the current moment represents an image feature in the fermentation image at the current moment, such as the turmeric slurry itself, the precipitation produced during the fermentation process, the bubbles produced during the fermentation process, etc. The standard deviation of the sub-Gaussian model reflects the fluctuation of the grayscale distribution of the corresponding image feature, then It reflects the average level of grayscale distribution fluctuation of each image feature in the fermentation image at the current moment. When the fluctuation of the local grayscale of the pixel exceeds the average level of the grayscale distribution fluctuation of each image feature in the fermentation image at the current moment, it means that the The local area of the pixel is more likely to contain multiple image features. The local texture complexity of the pixel is relatively large, and the The gray value corresponding to each pixel is enhanced to improve the The contrast between multiple local image features at each pixel. When the fluctuation of the local grayscale of the pixel does not exceed the average level of the grayscale distribution fluctuation of each image feature in the fermentation image at the current moment, it means that the The local area of the pixel is more likely to contain only one image feature. The local texture complexity of each pixel is small.
[0047] It should be noted that the neighborhood size in the present invention is 24 neighborhoods. In other embodiments, the implementer can set the neighborhood size according to the actual implementation situation.
[0048] At this point, the local texture complexity of each pixel in the fermentation image at the current moment is obtained.
[0049] S3: The grayscale value of the pixel at the same position as the target pixel in the fermentation image at each moment and the serial number of the corresponding moment constitute the data point at each moment, cluster the data points at all moments, and determine the fermentation change degree of the target pixel according to the clustering result.
[0050] It should be noted that during the fermentation process of turmeric, precipitation, bubbles, etc. are continuously generated, which causes the features corresponding to the pixels at the same position in the fermentation images at different times to change. Therefore, the present invention obtains the fermentation change degree of the pixels according to the grayscale changes of the pixels at the same position in the fermentation images at different times, so as to subsequently determine the necessity of pixel enhancement according to the fermentation change degree of the pixels, and focus on enhancing features such as precipitation and bubbles.
[0051] Specifically, any pixel in the fermentation image at the current moment is taken as the target pixel. For any moment, the grayscale value of the pixel in the fermentation image at the moment with the same position as the target pixel and the sequence number of the moment constitute the data point of the moment. The data points of all moments constitute the data sample. For example, the grayscale value of the pixel in the fermentation image at the first moment is the target pixel. The gray value of the pixel is 80. The gray value of the pixel is 81. The grayscale value of a pixel is 176, and the corresponding data points are (1,80), (2,81), and (3,176).
[0052] Perform mean shift clustering on the data samples to divide them into multiple clusters. According to the number of clusters and the cluster to which the data point at the current moment belongs, determine the fermentation change degree of the target pixel point in the fermentation image at the current moment:
[0053] ;
[0054] in, Indicates the fermentation change degree of the target pixel; Indicates the number of clusters; Indicates the number of data points in the cluster to which the data point at the current moment belongs; Indicates the number of data points in the cluster to which the data point at the current moment belongs whose serial numbers are continuous with the data point at the current moment. For example, if the current moment is the 8th moment, the serial number of the data point at the current moment is 8. If the cluster to which the data point at the current moment belongs includes the data points at the 3rd, 6th, 7th, and 8th moments, and the serial numbers of these data points are 3, 6, 7, and 8 respectively, then the data points with serial numbers 6 and 7 are continuous with the data point at the current moment (that is, the data point with serial number 8). At this time, ; Represents an exponential function with a natural constant as its base.
[0055] Represent a piecewise function of the number of clusters: When the number of clusters is 1, it means that the grayscale values of each data point in the data sample are basically the same, which further indicates that as of the current moment, no fermentation change has occurred in the turmeric fermentation process, and the fermentation change degree is 0 at this time; when the number of clusters is greater than 1, it means that the grayscale value of each data point in the data sample has changed, that is, during the turmeric fermentation process, the grayscale of the target pixel has changed. The grayscale change of this process may be caused by precipitation, bubbles, etc. produced by turmeric fermentation, or by noise during the fermentation image acquisition process. Therefore, further analysis is needed. The present invention adopts Conduct analysis, It reflects the continuity of the grayscale change of the data point at the current moment. If the data point at the current moment is not continuous with other data points in the cluster to which it belongs in time series, then the difference between the grayscale value of the data point at the current moment and the grayscale value of the data points in the remaining clusters is more likely to be a change caused by noise. If the current data point is continuous with some data points in the cluster to which it belongs, the gray value of the current data point is more likely to be the gray value of the precipitation, bubbles, etc. generated during the fermentation of turmeric. If the corresponding target data point has a larger fermentation change, then the corresponding target data point has a larger fermentation change; if the cluster to which the data point at the current moment belongs does not contain other data points, is also large, but the grayscale difference between the current data point and the other data points may be caused by noise. As The index of Make corrections. If the number of data points in the cluster to which the data point at the current moment belongs is smaller, The bigger, yes The greater the degree of reduction, the smaller the fermentation change. If the number of data points in the cluster to which the data point at the current moment belongs is larger, The closer it is to 1, the The smaller the reduction, the more the fermentation variability depends on .
[0056] Similarly, the fermentation change degree of all pixels in the fermentation image at the current moment is obtained.
[0057] S4: Determine the necessity of enhancing each pixel point according to the local texture complexity and fermentation variation of each pixel point in the fermentation image at the current moment, and determine the frequency threshold of each grayscale value in the fermentation image at the current moment according to the necessity of enhancing each pixel point.
[0058] It should be noted that, since precipitation and bubbles are produced less in the early stage of fermentation, the frequency of the corresponding grayscale values is small. In order to avoid precipitation, bubbles and other features being swallowed up during the enhancement process, it is necessary to focus on enhancing precipitation, bubbles and other features. Therefore, the present invention combines the local texture complexity of the pixel points and the fermentation variation to determine the necessity of enhancing the pixel points, so that the necessity of enhancing the pixel points corresponding to precipitation and bubbles is greater, and they can be focused on in the future.
[0059] In one embodiment, the necessity of enhancing each pixel is determined according to the local texture complexity and fermentation variation of each pixel in the fermentation image at the current moment:
[0060] ;
[0061] in, Indicates the fermentation image at the current moment Necessity of pixel enhancement; Indicates the fermentation image at the current moment The local texture complexity of each pixel; Indicates the fermentation image at the current moment The fermentation change of each pixel; when the local texture complexity The larger the fermentation, the greater the degree of change. The larger the The pixel point is more likely to be the precipitation, bubbles and other features produced during the fermentation process of turmeric. The greater the necessity of enhancing the pixel point, the more The grayscale value corresponding to each pixel point is enhanced, so that the features such as precipitation and bubbles produced during the fermentation process of turmeric can be enhanced in contrast with the turmeric slurry itself, thereby improving the accuracy of identifying the fermentation degree of turmeric.
[0062] In another embodiment, the necessity of enhancing each pixel is determined according to the local texture complexity and fermentation variation of each pixel in the fermentation image at the current moment:
[0063] ;
[0064] in, Indicates the fermentation image at the current moment Necessity of pixel enhancement; Indicates the fermentation image at the current moment The local texture complexity of each pixel; Indicates the fermentation image at the current moment The fermentation change degree of each pixel; represents the maximum value function, which is used to prevent the denominator of the exponent from being 0; if the fermentation image at the current moment There is obvious noise in the neighborhood of the pixel point, which will also cause the fermentation image at the current moment to The local texture complexity of each pixel is relatively large. Therefore, in order to avoid the deviation of the necessity of pixel enhancement caused by noise, the present invention uses the fermentation variation degree Correction of local texture complexity, due to The value range of is (0,1), so is a number greater than 1, then according to the principle of gamma transformation, As When the index is When no fermentation change occurs up to the current moment, the fermentation change degree The smaller, The bigger, yes The greater the reduction of The less the enhancement of each pixel point is necessary; when the first When the position corresponding to each pixel point has precipitation, bubbles, etc., the fermentation change degree The bigger, The smaller and closer to 1, the The smaller the reduction of The necessity of pixel enhancement depends more on the local texture complexity. The result is. Then when the local texture complexity The larger the fermentation, the greater the degree of change. The larger the The pixel point is more likely to be the precipitation, bubbles and other features produced during the fermentation process of turmeric. The greater the need for pixel enhancement.
[0065] According to the necessity of enhancing each pixel, the frequency threshold of each gray value is obtained:
[0066] ;
[0067] in, Represents the grayscale value in the fermentation image at the current moment The frequency threshold of Indicates that the gray value in the fermentation image at the current moment is No. Necessity of pixel enhancement; Indicates that the gray value in the fermentation image at the current moment is The number of pixels; if the gray value in the fermentation image at the current moment is The greater the need for enhancement of all pixels, the gray value The larger the frequency threshold is, the gray value will be adjusted according to the frequency threshold. When making corrections, avoid gray values The frequency is reduced, thus ensuring the gray value If the gray value in the fermentation image at the current moment is The smaller the enhancement necessity of all pixels, the gray value The smaller the frequency threshold is, the smaller the gray value will be. When making corrections, the gray value The frequency is reduced, thus avoiding the gray value Over-enhancement affects the enhancement effect of other grayscale values.
[0068] At this point, the frequency threshold of each grayscale value in the fermentation image at the current moment is obtained.
[0069] S5: correcting the frequency of each gray value in the fermentation image at the current moment according to the frequency threshold of each gray value, and enhancing the fermentation image at the current moment based on the corrected frequency of each gray value to obtain an enhanced image.
[0070] It should be noted that the frequency threshold of the grayscale value corresponding to the pixel point with less necessity for enhancement is smaller, and the frequency of the grayscale value needs to be reduced during subsequent enhancement. The frequency threshold of the grayscale value corresponding to the pixel point with less necessity for enhancement is larger, and the frequency of the grayscale value needs to be avoided from being reduced during subsequent enhancement. Therefore, for each grayscale value in the fermentation image at the current moment, if the frequency of the grayscale value is greater than the frequency threshold of the grayscale value, the part of the grayscale value whose frequency is greater than the frequency threshold is cropped, and the cropped part is evenly distributed to all grayscale values; if the frequency of the grayscale value is less than or equal to the frequency threshold of the grayscale value, the frequency of the grayscale value is not cropped, thereby realizing the correction of the frequency of each grayscale value.
[0071] Specifically, the frequency of each gray value is corrected according to the frequency threshold of each gray value in the fermentation image at the current moment, and the corrected frequency of each gray value is obtained:
[0072] ;
[0073] ;
[0074] in, Represents the grayscale value in the fermentation image at the current moment The frequency of correction; Represents the grayscale value in the fermentation image at the current moment The frequency threshold of Represents the grayscale value in the fermentation image at the current moment frequency; Represents the grayscale value in the fermentation image at the current moment The clipping frequency, when the gray value Frequency Greater than gray value Frequency threshold When the frequency of gray value Greater than the frequency threshold The part is cropped, then the cropping frequency is , when the gray value Frequency Not greater than gray value Frequency threshold When the gray value is not The frequency is clipped, then the gray value The clipping frequency is 0.
[0075] According to the correction frequency of each gray value in the fermentation image at the current moment, the fermentation image at the current moment is histogram equalized to obtain the enhanced image at the current moment.
[0076] It should be noted that the necessity of enhancing the grayscale values of the pixels corresponding to the features such as precipitation and bubbles produced during the fermentation of yellow ginger is relatively large, and the necessity of enhancing the grayscale values of the yellow ginger slurry itself is relatively small. The present invention sets the frequency threshold of the grayscale value according to the necessity of enhancement, and sets a larger frequency threshold for the grayscale values of the pixels corresponding to the features such as precipitation and bubbles with large necessity of enhancement, so as to avoid the frequency of the grayscale value being clipped, so that the grayscale value is kept at a larger frequency as much as possible, so as to improve the enhancement effect of the features such as precipitation and bubbles, and avoid the features such as precipitation and bubbles being swallowed up during the enhancement process. For the grayscale values of the pixels corresponding to the yellow ginger slurry itself with small necessity of enhancement, a smaller frequency threshold is set, and the frequency of the grayscale value is reduced by the frequency threshold to avoid the grayscale value corresponding to the yellow ginger slurry itself being excessively enhanced, thereby causing the features such as precipitation and bubbles to be swallowed up during the enhancement process.
[0077] S6: Identify the fermentation degree of turmeric based on the enhanced image.
[0078] The present invention adopts a long short-term memory network (LSTM) to identify the fermentation degree at the current moment. The specific content of the LSTM model is as follows:
[0079] The input of the LSTM model is the enhanced image corresponding to the fermentation image at each moment, and the output is the fermentation degree at each moment. The training set of the model is the enhanced image of the fermentation image at each moment during the historical yellow turmeric fermentation, and the label is the fermentation degree at each moment. In the present invention, the fermentation degree is divided into 0-10 levels, and the higher the level, the higher the fermentation completion degree. The fermentation degree is artificially set according to the saponin content at each moment in the historical yellow turmeric fermentation process; the loss function of the model is the cross entropy loss.
[0080] The enhanced images at each moment are input into the trained LSTM model, and the fermentation degree at each moment is output.
[0081] It should be noted that the present invention is described only by taking the LSTM model as an example, and the implementer can select a neural network model according to the actual implementation situation, such as a recurrent neural network (RNN), a gated recurrent unit network (GRU), etc. In the present invention, the features of the precipitation, bubbles, etc. produced by fermentation in the enhanced image have a large contrast with the features of the turmeric slurry itself. The present invention uses the enhanced image to identify the degree of fermentation, which can make the neural network faster and the results obtained more accurate.
[0082] An embodiment of the present invention also discloses a turmeric saponin fermentation process monitoring system based on image processing, comprising a processor and a memory, wherein the memory stores computer program instructions. When the computer program instructions are executed by the processor, a turmeric saponin fermentation process monitoring method based on image processing according to the present invention is implemented.
[0083] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, and their configuration and functions are known in the art, so they will not be described in detail here.
[0084] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
[0085] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for monitoring the fermentation process of turmeric saponin based on image processing, characterized in that: include: The local texture complexity of the target pixel is determined according to the grayscale distribution of the pixels in the neighborhood of the target pixel in the fermentation image at the current moment: , Indicates the fermentation image at the current moment The local texture complexity of each pixel; Indicates the fermentation image at the current moment The pixel in the neighborhood The gray value of each pixel; Indicates the fermentation image at the current moment The mean gray value of all pixels in the neighborhood of a pixel; Indicates the fermentation image at the current moment The number of pixels contained in the neighborhood of a pixel; represents a hyperparameter; represents the hyperbolic tangent function; The grayscale value of the pixel at the same position as the target pixel in the fermentation image at each moment and the serial number of the corresponding moment constitute the data point at each moment; cluster the data points at all moments, and determine the fermentation change degree of the target pixel according to the clustering results : ,in represents the number of clusters, Indicates the number of data points in the cluster to which the data point at the current moment belongs. Indicates the number of data points in the cluster to which the data point at the current moment belongs that have consecutive serial numbers with the data point at the current moment. Represents a piecewise function: ; Determine the necessity of enhancing the target pixel, and the necessity of enhancing satisfies the expression: or , Indicates the fermentation image at the current moment Necessity of pixel enhancement; Indicates the fermentation image at the current moment The fermentation change degree of each pixel; represents the maximum value function; Determine the frequency threshold of each gray value in the fermentation image at the current moment: , Represents the grayscale value in the fermentation image at the current moment The frequency threshold of Indicates that the gray value in the fermentation image at the current moment is No. Necessity of pixel enhancement; Indicates that the gray value in the fermentation image at the current moment is The number of pixels; Correcting the frequency of each gray value according to the frequency threshold of each gray value, and enhancing the fermentation image at the current moment based on the corrected frequency of each gray value to obtain an enhanced image; The fermentation degree of turmeric is identified according to the enhanced image.
2. The method for monitoring the fermentation process of turmeric saponin based on image processing according to claim 1, characterized in that: The method for obtaining the hyperparameters is: Constructing a grayscale histogram of the fermentation image at the current moment, performing mixed Gaussian fitting on the grayscale histogram of the fermentation image at the current moment, and obtaining a mixed Gaussian model, wherein the number of sub-Gaussian models included in the mixed Gaussian model is the number of maximum value points in the grayscale histogram of the fermentation image at the current moment; The mean of the standard deviation parameters of all sub-Gaussian models contained in the mixed Gaussian model is used as a hyperparameter .
3. The method for monitoring the fermentation process of turmeric saponin based on image processing according to claim 1, characterized in that: The clustering adopts the mean shift clustering algorithm.
4. The method for monitoring the fermentation process of turmeric saponin based on image processing according to claim 1, characterized in that: The step of correcting the frequency of each gray value according to the frequency threshold of each gray value includes: In response to the fact that the frequency of the grayscale value in the fermentation image at the current moment is greater than the frequency threshold of the grayscale value, the part of the grayscale value whose frequency is greater than the frequency threshold is cropped, and the cropped part is evenly distributed to all grayscale values to achieve the correction of the grayscale value frequency.
5. The method for monitoring the fermentation process of turmeric saponin based on image processing according to claim 1, characterized in that: The enhancement adopts a histogram equalization enhancement algorithm.
6. A turmeric saponin fermentation process monitoring system based on image processing, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a method for monitoring the fermentation process of turmeric saponin based on image processing according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Histogram equalization method and apparatus for video monitoring equipment
CN105894481A
Peanut aflatoxin detection method and system based on machine vision
CN114240807A
Intelligent monitoring system for sewage treatment
CN116310845A
Image processing method, electronic device, and readable storage medium
WO2022161145A1
