CN116228772A - Quick detection method and system for fresh food spoilage area - Google Patents
Quick detection method and system for fresh food spoilage area Download PDFInfo
- Publication number
- CN116228772A CN116228772A CN202310513288.1A CN202310513288A CN116228772A CN 116228772 A CN116228772 A CN 116228772A CN 202310513288 A CN202310513288 A CN 202310513288A CN 116228772 A CN116228772 A CN 116228772A
- Authority
- CN
- China
- Prior art keywords
- pixel point
- area
- pixel
- fresh food
- hue
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 235000013305 food Nutrition 0.000 title claims abstract description 228
- 238000001514 detection method Methods 0.000 title claims abstract description 40
- 230000006866 deterioration Effects 0.000 claims abstract description 105
- 238000000034 method Methods 0.000 claims abstract description 42
- 238000012545 processing Methods 0.000 claims abstract description 11
- 230000006870 function Effects 0.000 claims description 36
- 238000004364 calculation method Methods 0.000 claims description 33
- 230000008569 process Effects 0.000 claims description 15
- 238000013507 mapping Methods 0.000 claims description 13
- 230000004048 modification Effects 0.000 claims description 13
- 238000012986 modification Methods 0.000 claims description 13
- 238000010606 normalization Methods 0.000 claims description 5
- 230000008859 change Effects 0.000 description 5
- 244000005700 microbiome Species 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 3
- 244000052616 bacterial pathogen Species 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000003708 edge detection Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000001914 filtration Methods 0.000 description 2
- 235000002864 food coloring agent Nutrition 0.000 description 2
- 238000003709 image segmentation Methods 0.000 description 2
- 230000000813 microbial effect Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 230000001580 bacterial effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000018044 dehydration Effects 0.000 description 1
- 238000006297 dehydration reaction Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 238000004321 preservation Methods 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
The invention relates to the technical field of image processing, in particular to a method and a system for rapidly detecting a fresh food spoilage area, which comprise the following steps: acquiring a fresh food area image, and determining the local difference degree of fresh and the joint probability of the edge of a deterioration area of each pixel point according to the image characteristics of a preset window area corresponding to each pixel point in the fresh food area image; according to the local fresh difference degree, the joint probability of the edges of the spoiled areas and the hue, determining the fresh spoiled degree of each pixel point, constructing a weighted undirected graph, and further calculating the side weights of all sides in the weighted undirected graph by using the fresh spoiled degree; based on the side weight, constructing an energy function corresponding to the weighted undirected graph, determining each target side corresponding to the minimum value of the energy function, and obtaining a metamorphic region image based on each target side. The method effectively improves the detection speed of the fresh food deterioration area, and is mainly applied to the field of fresh food quality detection.
Description
Technical Field
The invention relates to the technical field of image data processing, in particular to a method and a system for rapidly detecting a fresh food deterioration area.
Background
With the continuous improvement of the quality of life of people, food safety issues raise a great deal of attention, especially the safety of fresh foods. The fresh food is a necessity in human daily life, but the fresh food has the characteristics of difficult preservation and extremely easy deterioration. Therefore, it is necessary to detect the state of the fresh food in real time, and to avoid the presence of spoiled fresh food in the fresh food, that is, to select fresh food in a spoiled area from a plurality of spoiled and non-spoiled fresh food, that is, to accurately and rapidly identify spoiled fresh food.
The existing fresh food deterioration area detection method is generally that a worker selects fresh food with a deterioration area based on historical experience, and has great human subjectivity, so that the accuracy of the deterioration fresh food detection result is low, the detection speed is low, and a large amount of human resources are wasted. With the continuous development of computer vision technology, the existing optical detection method can detect the deterioration area of fresh food, and has higher detection accuracy, but the existing deterioration fresh food detection method has high operation cost and complex detection process, so that the fresh food detection cost is high and the detection efficiency is low.
Disclosure of Invention
In order to solve the technical problem of low detection efficiency of the conventional fresh food deterioration area, the invention aims to provide a method and a system for rapidly detecting the fresh food deterioration area, and the adopted technical scheme is as follows:
an embodiment of the invention provides a method for rapidly detecting a deterioration area of fresh food, which comprises the following steps:
acquiring a fresh food region image of fresh food to be detected on an HSV three-dimensional color space, and further determining a preset window region corresponding to each pixel point in the fresh food region image;
determining fresh local difference degree of each pixel point according to three channel components corresponding to each window pixel point in a preset window area corresponding to each pixel point; the window pixel points are pixel points in a preset window area corresponding to the pixel points;
determining the joint probability that each pixel point is the edge of the metamorphic region according to the gradient amplitude of the three channel components corresponding to each window pixel point in the preset window region;
determining the freshness and deterioration degree of each pixel point according to the joint probability that each pixel point is the edge of the deterioration area, the freshness and partial difference degree and the hue of each pixel point;
Constructing a weighted undirected graph corresponding to the fresh food area image, and determining the side weight of each side in the weighted undirected graph according to the fresh deterioration degree of each pixel point in the weighted undirected graph;
constructing an energy function corresponding to the weighted undirected graph according to the edge weights of each pixel point and each edge in the weighted undirected graph;
and determining each target side corresponding to the minimum value of the energy function according to the energy function, and cutting off each target side to obtain a deterioration area image in the fresh food area image.
Further, determining the fresh local difference degree of each pixel point according to three channel components corresponding to each window pixel point in the preset window area corresponding to each pixel point, including:
for any pixel point in the fresh food area image, carrying out negative correlation mapping processing on the accumulated sum of the saturation of each window pixel point in a preset window area corresponding to the pixel point, and determining the value after negative correlation mapping as a first difference factor of the corresponding pixel point;
for any one window pixel point in a preset window area corresponding to the pixel point, determining the absolute value of the difference value between the hue of the pixel point and the hue of the corresponding window pixel point as a second difference factor of the corresponding window pixel point; determining the absolute value of the difference value between the brightness of the pixel point and the brightness of the pixel point of the corresponding window as a third difference factor of the pixel point of the corresponding window; the product of the second difference factor and the third difference factor of the corresponding window pixel points is determined to be a fourth difference factor of the corresponding window pixel points; the fourth difference factors of the pixel points of each window in the preset window area corresponding to the pixel points are accumulated and summed to determine a fifth difference factor of the corresponding pixel point;
And determining the product of the first difference factor and the fifth difference factor of the pixel points as the fresh local difference degree of the corresponding pixel points.
Further, determining the joint probability that each pixel point is an edge of the metamorphic region according to the gradient amplitude of the three channel components corresponding to each window pixel point in the preset window region comprises:
for the hue corresponding to each window pixel point in a preset window area corresponding to any pixel point, determining a hue gradient projection value of each row and a hue gradient projection value of each column in the preset window area corresponding to the pixel point according to the hue corresponding to each window pixel point in the preset window area corresponding to the pixel point;
determining hue deterioration edge probability of the pixel points according to the hue degree corresponding to each window pixel point, the hue gradient projection value of each row and the hue gradient projection value of each column in a preset window area corresponding to the pixel points, thereby determining saturation deterioration edge probability and brightness deterioration edge probability of the pixel points;
and determining the value obtained by adding the hue metamorphic edge probability, the saturation metamorphic edge probability and the brightness metamorphic edge probability of the pixel points as the joint probability of the corresponding pixel points as the metamorphic region edge.
Further, the calculation formula of the hue spoilage edge probability is as follows:
wherein, the first image of fresh food areaThe hue of each pixel point deteriorates the edge probability,for the first preset weight to be set,the first image of fresh food areaThe hue gradient projection value of the j-th row in the preset window area corresponding to each pixel point, j is the serial number of the row in the preset window area, m is the number of the row in the preset window area,the first image of fresh food areaThe first pixel point is in a preset window area corresponding to each pixel pointThe hue gradient projection values of the columns,the sequence number of the columns in the preset window area is given, q is the number of the columns in the preset window area,for a second preset weight to be applied,the first image of fresh food areaThe color corresponding to the c-th window pixel point in the preset window area corresponding to the pixel points,the first image of fresh food areaThe hue corresponding to the center pixel in the preset window area corresponding to the pixel, c is the serial number of the window pixel in the preset window area,for the number of window pixel points in a preset window area, a is the serial number of the pixel points in the fresh food area image,Is a normalization function.
Further, determining a hue gradient projection value of each row in the preset window area corresponding to the pixel point according to the hue degree corresponding to each window pixel point in the preset window area corresponding to the pixel point, including:
Determining the gradient amplitude of the hue corresponding to each window pixel in a preset window area corresponding to the pixel, calculating the average value of the gradient amplitude of the hue corresponding to each window pixel in the corresponding row for any row of window pixels in the preset window area corresponding to the pixel, accumulating the difference value between the gradient amplitude of the hue corresponding to each window pixel in the corresponding row and the average value of the hue gradient amplitude corresponding to the row, and further determining the value obtained after the accumulating as the hue gradient projection value of the corresponding row.
Further, determining the freshness and deterioration degree of each pixel point according to the joint probability that each pixel point is an edge of a deterioration area, the freshness and partial difference degree and the hue of each pixel point, including:
for any pixel point in the fresh food area image, determining the product of the joint probability of the pixel point as the edge of the metamorphic area and the hue corresponding to the corresponding pixel point as a first metamorphic factor of the corresponding pixel point; determining the fresh local difference degree of the pixel points as a second modification factor of the corresponding pixel points; and adding the first modification factor and the second modification factor of the pixel point, carrying out upward rounding on the added numerical value, and determining the numerical value after the upward rounding as the fresh modification degree of the corresponding pixel point.
Further, determining the edge weights of the edges in the weighted undirected graph according to the freshness and deterioration degree of each pixel point in the weighted undirected graph, including:
and for any one side in the weighted undirected graph, determining the square of the difference value of the freshness deterioration degree of two pixel points on the corresponding side as the initial side weight of the corresponding side, carrying out negative correlation mapping on the ratio of the initial side weight to the super parameter, and determining the numerical value after the negative correlation mapping as the side weight of the corresponding side.
Further, the calculation formula of the energy function is as follows:
wherein, as a function of the energy,as a balance factor, the balance factor is,the first image of fresh food areaThe number of pixels in a pixel is one,the first image of fresh food areaEach pixel point, Z is a pixel point set corresponding to the fresh food area image,the first image of fresh food areaThe penalty for a foreground or background is given to each pixel,in the case of a region item,the first image of fresh food areaPixel dot and the firstThe pixel points are connected to form the side weight of one side,the first image of fresh food areaPixel dot and the firstAnd the coincidence degree of the pixel points.
The invention also provides a quick detection system for the fresh food spoilage area, which comprises a processor and a memory, wherein the processor is used for processing instructions stored in the memory so as to realize the quick detection method for the fresh food spoilage area.
The invention has the following beneficial effects:
the invention provides a method and a system for rapidly detecting a fresh food deterioration area, which are used for carrying out image processing on an image of the fresh food area by combining image characteristic information of the fresh food deterioration area to obtain a weighted undirected graph corresponding to the image of the fresh food area, and analyzing the weighted undirected graph by utilizing an energy function to obtain the image of the deterioration area. The invention effectively improves the detection efficiency of the fresh food deterioration area and provides technical support for fresh food quality detection. Acquiring a fresh food region image of the fresh food to be detected on the HSV three-dimensional color space, and facilitating the extraction of more accurate fresh food image characteristic information; the method comprises the steps of determining a preset window area, wherein each pixel point in an image of a fresh food area is placed in a local area to determine fresh local difference degree with higher reference value and joint probability of an edge of a deterioration area; in order to facilitate the subsequent determination of the side weight of the weighted undirected graph, three-dimensional data are converted into one-dimensional data, namely, the fresh-keeping metamorphism is determined through the joint probability that each pixel point is the edge of the metamorphic area and the fresh-keeping local difference degree and the hue degree of each pixel point, and the numerical value of the fresh-keeping metamorphism is analyzed from three angles, so that the accuracy of the fresh-keeping metamorphism is effectively improved; and constructing an energy function based on the side weight, further obtaining an image of the spoiled area by using the energy function, and dividing the spoiled area from the image of the fresh food area to finish the rapid detection of the spoiled area of the fresh food. Compared with the existing optical detection method, the method is beneficial to improving the detection speed of the fresh food deterioration area and reducing the quality detection cost of the fresh food, and is mainly applied to the field of fresh food quality detection.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for rapidly detecting the spoiled area of fresh food according to the present invention.
Detailed Description
In order to further describe the technical means and effects adopted by the present invention to achieve the preset purpose, the following detailed description is given below of the specific implementation, structure, features and effects of the technical solution according to the present invention with reference to the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The application scenario aimed at by this embodiment is: when the quality detection is carried out on the fresh food, the surface image of the fresh food in a motion state is shot, the deterioration area detection is carried out on the surface image of the fresh food, and the obvious deterioration area of the fresh food is determined so as to improve the quality detection efficiency of the fresh food, wherein the obvious deterioration area refers to the deterioration area with obvious difference in the image of the fresh food and the non-deterioration area. It should be noted that, when quality detection is performed on raw foods, it is known that raw foods that have deteriorated exist in the raw foods, so the main purpose of this embodiment is to rapidly detect the deteriorated area of the raw foods.
In order to rapidly detect the spoiled area of the fresh food, an image segmentation algorithm is improved according to the image characteristic information of the spoiled area of the fresh food, and the detection of the obvious spoiled area of the fresh food is completed. Specifically, a method for rapidly detecting the deterioration area of fresh food is provided, as shown in fig. 1, comprising the following steps:
s1, acquiring a fresh food region image of fresh food to be detected on an HSV three-dimensional color space, and further determining a preset window region corresponding to each pixel point in the fresh food region image, wherein the steps can comprise:
First, obtaining a surface image of fresh food to be detected on an RGB three-dimensional color space.
In this embodiment, on a fresh food sorting line, a charge coupled device (Charge Coupled Device, CDD) camera is used to perform image shooting on fresh food to be detected, which has quality problems in the motion process, through a top view shooting angle, so as to obtain Red Green Blue (RGB) three-channel images of the fresh food to be detected. In order to keep the image information to the greatest extent, denoising is carried out on the red, green and blue three-channel images of the fresh food to be detected by adopting non-local mean filtering, and the RGB image after denoising is obtained. The implementation of non-local mean filtering is prior art and will not be described in detail here. Of course, there are many methods for implementing image denoising, and an implementer may implement image denoising by using the denoising method. At this time, a surface image of the fresh food to be detected on the RGB three-dimensional color space is obtained.
And secondly, determining the surface image of the fresh food to be detected on the HSV three-dimensional color space.
The characteristic of the spoiled image of the fresh food is more prominent in the HSV three-dimensional color space, in order to improve the accuracy of detection of the subsequent spoiled area, the RGB image after denoising processing corresponding to the fresh food to be detected is converted into the hue saturation brightness (Hue Saturation Value, HSV) three-dimensional color space from the RGB three-way space, so that a color image in the HSV three-dimensional color space is obtained, and the color image is the upper surface image of the HSV three-dimensional color space. The three dimensions of the color image in the HSV space are mutually independent, namely the dimension in the HSV space is a channel, wherein the hue ranges in the three dimensions are [0, 360], and different hue ranges respectively represent different colors. The process of determining a color image on an HSV three-dimensional color space is prior art and will not be described in detail herein. At this time, a surface image of the fresh food to be detected on the HSV three-dimensional color space is obtained.
And thirdly, determining a fresh food area image of the fresh food to be detected on the HSV three-dimensional color space.
In this embodiment, in order to facilitate subsequent analysis of the deterioration area, a feature that the hue of the fresh food has a larger phase difference from the hue of the background may be used, a hue distribution histogram is adopted, a suitable double threshold in the Canny edge detection operator is selected, and segmentation processing is performed on the surface image on the HSV three-dimensional color space, so as to obtain a fresh food area image of the fresh food to be detected on the HSV three-dimensional color space. The implementation process of the Canny edge detection operator is the prior art and is not within the scope of the present invention, and will not be described in detail here. At this time, a fresh food region image of the fresh food to be detected on the HSV three-dimensional color space is obtained.
Taking an orange as an example, acquiring a surface image of the orange on an HSV three-dimensional color space, specifically: and constructing a hue distribution histogram according to the hue of each pixel point in the surface image, further determining the hue range of the orange, and taking the empirical value of [30, 60] degrees from the hue range of the orange. According to the hue range of the orange, two thresholds of 30 degrees and 60 degrees respectively during image segmentation can be obtained, and the two thresholds are utilized to segment the surface image of the orange on the HSV three-dimensional color space, so that the orange region image can be obtained.
In the same way, other fresh foods can also adopt the method for determining the orange region image to obtain the fresh food region image. Common color-corresponding hue ranges include: red [0, 30], yellow [60, 90], green [90, 150], cyan [150, 180], blue [180, 240], violet [240, 300] and magenta [300, 360 ].
Fourth, determining a preset window area corresponding to each pixel point in the fresh food area image.
The edge of the modified area of the fresh food is an irregular edge, and the edge pixel points on the edge correspond to the pixel points in the non-modified area and the pixel points in the modified area in the local area. By analyzing the image characteristic information of the local area corresponding to each pixel point in the fresh food area image, the image characteristic of the edge of the deterioration area in the fresh food area image is convenient to analyze and extract, so that a preset window area corresponding to each pixel point in the fresh food area image is required to be determined.
In this embodiment, each pixel point in the fresh food region image is used as the center to construct a size of Is to be constructed to be of the size ofThe window area of the pixel is determined to be a preset window area corresponding to the corresponding pixel point.
Thus, the preset window area corresponding to each pixel point in the fresh food area image is obtained in the embodiment.
S2, determining the fresh local difference degree of each pixel point according to three channel components corresponding to each window pixel point in a preset window area corresponding to each pixel point.
The color of the fresh food is bright and the moisture is sufficient under normal conditions, but once the fresh food is deteriorated, the color, saturation and brightness of a local area of the deteriorated fresh food are greatly changed, so that the color, saturation and brightness of a preset window area corresponding to a pixel point positioned at the edge of the deteriorated area are different. The method comprises the following steps: firstly, the color of a fresh food deterioration area is changed in terms of color, so that the color of the deterioration area is more prominent, the color is normalized, and the value range of the color can be 0, 1; then, the closer the saturation of the fresh food area is to 1, the purer the fresh food color is to 0, the purer the fresh food color is, the lower the saturation is, the more likely the fresh food is in the deterioration area, and the value range of the saturation can be 0, 1; finally, the brightness indicates the brightness of the color, and the deterioration of fresh food is affected by microorganisms, so that the lower the brightness is, the more likely the fresh food is in the deterioration area, and the range of the brightness can be [0,1]. The step of determining the fresh local difference degree of each pixel point may include:
For any pixel point in the fresh food area image, carrying out negative correlation mapping processing on the accumulated sum of the saturation of each window pixel point in a preset window area corresponding to the pixel point, and determining the value after negative correlation mapping as a first difference factor of the corresponding pixel point; for any one window pixel point in a preset window area corresponding to the pixel point, determining the absolute value of the difference value between the hue of the pixel point and the hue of the corresponding window pixel point as a second difference factor of the corresponding window pixel point; determining the absolute value of the difference value between the brightness of the pixel point and the brightness of the pixel point of the corresponding window as a third difference factor of the pixel point of the corresponding window; the product of the second difference factor and the third difference factor of the corresponding window pixel points is determined to be a fourth difference factor of the corresponding window pixel points; the fourth difference factors of the pixel points of each window in the preset window area corresponding to the pixel points are accumulated and summed to determine a fifth difference factor of the corresponding pixel point; and determining the product of the first difference factor and the fifth difference factor of the pixel points as the fresh local difference degree of the corresponding pixel points.
In this embodiment, taking the a-th pixel point in the fresh food area image as an example, the fresh local difference of the a-th pixel point is calculated. Based on the image characteristic information of the edge of the fresh food deterioration area, a calculation formula of fresh local difference degree is constructed by utilizing three channel components corresponding to each window pixel point in a preset window area corresponding to the a pixel point. The window pixel points are pixel points in a preset window area corresponding to the pixel points, and three channel components are hue, saturation and brightness respectively. The calculation formula of the fresh local difference degree of the a pixel point can be as follows:
Wherein, fresh local difference degree of the a pixel point in the fresh food area image,the saturation corresponding to the ith window pixel point in the preset window area corresponding to the (a) th pixel point in the fresh food area image, a is the serial number of the pixel point in the fresh food area image, i is the serial number of the window pixel point in the preset window area,for presetting the number of window pixel points in the window area,a first difference factor for an a-th pixel point in the fresh food area image,the color corresponding to the ith window pixel point in the preset window area corresponding to the ith pixel point in the fresh food area image,the hue corresponding to the a-th pixel point in the fresh food area image,in order to find the absolute value function,fresh food regionA second difference factor of the ith window pixel point in the preset window area corresponding to the (a) th pixel point in the domain image,the saturation corresponding to the ith window pixel point in the preset window area corresponding to the (a) th pixel point in the fresh food area image,the saturation corresponding to the a pixel point in the fresh food area image,a third difference factor of the ith window pixel point in the preset window area corresponding to the (a) th pixel point in the fresh food area image, A fourth difference factor of the ith window pixel point in the preset window area corresponding to the (a) th pixel point in the fresh food area image,and a fifth difference factor of the ith window pixel point in the preset window area corresponding to the ith pixel point in the fresh food area image.
In a calculation formula of the fresh local difference degree, the hue is the hue after normalization treatment; if the preset window area corresponding to a certain pixel point is deteriorated, the image information of three dimensions in the preset window area corresponding to the corresponding pixel point is changed, and the local difference degree of the corresponding pixel point is larger; if the preset window area corresponding to a certain pixel point is a normal fresh local area, the fact that no dehydration phenomenon occurs in the preset window area corresponding to the pixel point is indicated that the saturation of each pixel point in the preset window area corresponding to the pixel point is approximately 1, and the greater the accumulated saturation of all the pixel points in the preset window area corresponding to the pixel point is, namely the first difference factor of the corresponding pixel point isThe smaller; the smaller the first difference factor is, the fresh local difference degree of the corresponding pixel pointThe smaller the corresponding pixel point is, the less the possibility of the pixel point in the fresh food deterioration area is; The second difference factor can be used for representing the hue difference between the window pixel point and the central pixel point, the greater the hue difference is, the less likely the window pixel point is to be the same as the region property of the central pixel point, the region property is the pixel point which is the same as the spoiled region or the pixel point which is in the non-spoiled region, the less likely the central pixel point is to be the pixel point near the spoiled edge in the fresh food region, and the central pixel point is the (a) th pixel point in the fresh food region image; whileThe third difference factor may be used to characterize the difference in luminance between the window pixel and the center pixel, the greater the difference in luminance, the less likely the window pixel is to be the same as the region property of the center pixel;the fourth difference factor describes the difference condition between the window pixel point and the center pixel point from two dimensions;the fifth difference factor analyzes the difference conditions between all window pixel points and the central pixel point from the whole angle of the local area; the local difference degree of fresh food can be used for representing the local difference degree between a non-spoiled area and a spoiled area in the local area of fresh food where a certain pixel point is located.
The larger the difference between the hue and brightness between the pixel and the surrounding pixels, the larger the change around the corresponding pixel, the more likely the corresponding pixel is to be a pixel near the fresh and deteriorated edge, and the larger the fresh local difference at the corresponding pixel position. Since hue, saturation and brightness are greatly changed at the edge where deterioration occurs, the greater the change in the numerical value of the three dimensions of the pixel, the more characteristic the edge pixel of the deteriorated region is.
S3, determining the joint probability that each pixel point is the edge of the metamorphic region according to the gradient amplitude of the three channel components corresponding to each window pixel point in the preset window region.
The first step, determining a hue gradient projection value of each row and a hue gradient projection value of each column in a preset window area corresponding to each pixel point.
In this embodiment, the raw and fresh foods have different texture characteristics, and the pixel points with large changes may be points with changed textures, and the edge of the modified area of the raw and fresh foods belongs to a random boundary, that is, the boundary between the modified area and the non-modified area of the raw and fresh foods. Therefore, the Sobel operator is utilized to calculate the gradient amplitude of each pixel point in each dimension in the fresh food region image, and the implementation process of the Sobel operator is not in the protection scope of the invention and is not described in detail here; then, a gray projection algorithm is utilized to calculate the gradient projection value of each row and each column in the preset window area through the row sequence and the column sequence of each dimension in the preset window, and the implementation process of the gray projection algorithm is the prior art and is not described in detail here. The gradient amplitude of the normal area in the fresh food image is smaller, and the obtained gradient projection is smaller; the gradient amplitude of the obvious spoiled edge area in the fresh food image is larger, and the obtained gradient projection is larger, so that the size of the gradient projection value can measure the probability that the central pixel point is the pixel point on the edge of the spoiled area to a certain extent. Taking hue as an example, determining a hue gradient projection value of each row and a hue gradient projection value of each column may include:
And determining the hue gradient projection value of each row and the hue gradient projection value of each column in the preset window area corresponding to the pixel point according to the hue degree corresponding to each window pixel point in the preset window area corresponding to the pixel point for the hue degree corresponding to each window pixel point in the preset window area corresponding to any pixel point. Since the calculation process of the hue gradient projection value of each row is consistent with that of each column, the calculation process of determining the hue gradient projection of each row in this embodiment may be:
determining the gradient amplitude of the hue corresponding to each window pixel in a preset window area corresponding to the pixel, calculating the average value of the gradient amplitude of the hue corresponding to each window pixel in the corresponding row for any row of window pixels in the preset window area corresponding to the pixel, accumulating the difference value between the gradient amplitude of the hue corresponding to each window pixel in the corresponding row and the average value of the hue gradient amplitude corresponding to the row, and further determining the value obtained after the accumulating as the hue gradient projection value of the corresponding row. In this embodiment, the calculation formula of the hue gradient projection value of the corresponding row may be:
Wherein, for the hue gradient projection value of the j-th row in the preset window area corresponding to each pixel point,for the gradient amplitude of the color corresponding to the pixel point of the p-th window on the j-th row in the preset window area corresponding to each pixel point, p is the serial number of the pixel point of the window on the j-th row in the preset window area, l is the number of the pixel points of the window on the j-th row in the preset window area,and (3) averaging the hue gradient amplitude values corresponding to the j-th row in the preset window area corresponding to each pixel point.
In the calculation formula of the hue gradient projection value, the hue gradient projection value can reflect the standard difference degree of gradient amplitude values of one row or one column, and the hue gradient amplitude value of the j-th row in a preset window area corresponding to the pixel pointThe larger the gradient projection is, the larger the preset window area corresponding to the pixel point is, the more likely the pixel point is located in the edge range of the metamorphic area, and the larger the probability that the pixel point is located at the edge of the metamorphic area is; on the contrary, the method comprises the steps of,the smaller the gradient projection is, and the more likely the preset window area corresponding to the pixel point is in the non-deterioration area; average value of hue gradient amplitudeThe average level of the hue gradient of the j-th row of pixel points in the preset window area can be measured, and the average level is changed along with the change of the hue gradient amplitude, so that The average value of the gradient amplitude values of the hue is subtracted to ensure that the obtained gray projection values are in the same range as much as possible so as to reflect the standard difference degree of the gradient amplitude values of the j-th row in the preset window area.
It should be noted that, by using a gray projection algorithm and combining the pixel point characteristics of the preset window area corresponding to the pixel point, the hue gradient projection value of each column in the preset window area corresponding to the pixel point can be obtained, and the first column in the preset window areaThe projection value of the hue gradient of the column is recorded as. At this time, the hue gradient projection value of each row and the hue gradient projection value of each column in the preset window area corresponding to the pixel point are obtained.
And secondly, determining hue deterioration edge probability of the pixel point according to the hue degree corresponding to each window pixel point, the hue gradient projection value of each row and the hue gradient projection value of each column in a preset window area corresponding to the pixel point, thereby determining saturation deterioration edge probability and brightness deterioration edge probability of the pixel point.
In this embodiment, the hue corresponding to each window pixel in the preset window area corresponding to the pixel is obtained to determine the gradient magnitude of the hue corresponding to each window pixel in the preset window area corresponding to the pixel. Based on gradient amplitude of hue degree corresponding to each window pixel point in a preset window area corresponding to the pixel point, hue gradient projection value of each row and hue gradient projection value of each column, constructing a calculation formula of hue metamorphic edge probability of the pixel point by using related knowledge of mathematical modeling, wherein the calculation formula of hue metamorphic edge probability can be as follows:
Wherein, the first image of fresh food areaThe hue of each pixel point deteriorates the edge probability,for the first preset weight to be set,the first image of fresh food areaThe hue gradient projection value of the j-th row in the preset window area corresponding to each pixel point, j is the serial number of the row in the preset window area, m is the number of the row in the preset window area,the first image of fresh food areaThe first pixel point is in a preset window area corresponding to each pixel pointThe hue gradient projection values of the columns,the sequence number of the columns in the preset window area is given, q is the number of the columns in the preset window area,for a second preset weight to be applied,the first image of fresh food areaThe color corresponding to the c-th window pixel point in the preset window area corresponding to the pixel points,the first image of fresh food areaThe hue corresponding to the center pixel in the preset window area corresponding to the pixel, c is the serial number of the window pixel in the preset window area,for presetting the number of window pixel points in a window area, a is the serial number of the pixel points in the fresh food area image,is a normalization function.
In the calculation formula of hue deterioration edge probability, the firstHue deterioration edge probability of each pixel point The method comprises the steps of giving different weight calculations to the gradient characteristic value of the whole preset window and the difference degree between the central pixel point and the surrounding pixel points, and carrying out normalization treatment to obtain the gradient characteristic value;the probability of the pixel point being the edge of the metamorphic region can be analyzed from the angle of the preset window region corresponding to the pixel pointThe probability that the pixel point is an edge of the metamorphic region can be analyzed from the angle of the difference of the hue gradient amplitude between the pixel point and each window pixel point in the preset window region corresponding to the pixel point, and particularly, the analysis result of the difference condition between the pixel point and the surrounding pixel points is more accurate, so that the first preset weightCan be set to 0.3, and the second preset weightMay be set to 0.7; the gradient amplitude value on the edge of the fresh food deterioration area is larger, so that the color phase gradient projection value is obtainedSum column color gradient projection valuesThe larger the gradient change in the preset window area corresponding to the pixel point is, the larger the gradient change can represent the characteristic that the gradient of the edge of the metamorphic area is larger, and the probability of the hue metamorphic edge is higherThe larger will be; gradient of window pixel pointAnd the center pixel pointThe larger the difference of the hue gradient amplitude values, the more the characteristic information that the central pixel point is positioned at the edge of the metamorphic area can be reflected, and the hue metamorphic edge probability is improved The greater the likelihood that the pixel will be at the edge of the modified region.
Note that, referring to the determination process of the hue deterioration edge probability, the saturation deterioration edge probability and the brightness deterioration edge probability of the pixel point can be obtained, and a description thereof will not be repeated here. At this time, the hue deterioration edge probability, saturation deterioration edge probability, and brightness deterioration edge probability of each pixel point in the fresh food region image are obtained.
And thirdly, determining the joint probability that each pixel point is the edge of the metamorphic area according to the hue metamorphic edge probability, the saturation metamorphic edge probability and the brightness metamorphic edge probability of each pixel point.
In this embodiment, in order to combine three dimensions and reflect edge probability information of a pixel in the three dimensions, a value obtained by adding hue metamorphic edge probability, saturation metamorphic edge probability and brightness metamorphic edge probability of the pixel is determined as a joint probability that the corresponding pixel is an edge of a metamorphic region, and a calculation formula of the joint probability that the pixel is an edge of the metamorphic region may be:
wherein, the first image of fresh food areaThe joint probability that a pixel is an edge of a modified region, The first image of fresh food areaThe hue of each pixel point deteriorates the edge probability,the first image of fresh food areaThe saturation deterioration edge probability of each pixel point,the first image of fresh food areaThe brightness deterioration edge probability of each pixel point, a is the serial number of the pixel point in the fresh food area image.
It should be noted that, three dimensions, namely hue, saturation and brightness, are combined, and the accuracy of the joint probability that the calculated pixel points are the edges of the deterioration area is higher, so that the subsequent calculation of fresh and deterioration degree is facilitated.
Thus, the embodiment obtains the joint probability that each pixel point in the fresh food region image is the edge of the spoiled region.
S4, determining the fresh and modified degree of each pixel point according to the joint probability that each pixel point is the edge of the modified region, the fresh local difference degree and the color of each pixel point.
In this embodiment, in order to facilitate the subsequent implementation of Graph Cut Graph, the three-dimensional space of each pixel point in the fresh food region image needs to be converted into a one-dimensional space, that is, the fresh and modified degree of each pixel point is calculated based on the joint probability of the modified region edge, the fresh local difference degree and the hue degree of each pixel point, which may include the steps of:
For any pixel point in the fresh food area image, determining the product of the joint probability of the pixel point as the edge of the metamorphic area and the hue corresponding to the corresponding pixel point as a first metamorphic factor of the corresponding pixel point; determining the fresh local difference degree of the pixel points as a second modification factor of the corresponding pixel points; and adding the first modification factor and the second modification factor of the pixel point, carrying out upward rounding on the added numerical value, and determining the numerical value after the upward rounding as the fresh modification degree of the corresponding pixel point.
In the present embodiment, a fresh food region map is determinedImage of the firstFresh and modified degree of each pixel is taken as an example to construct the firstThe calculation formula of the freshness and deterioration degree of each pixel point can be:
wherein, the first image of fresh food areaThe freshness and deterioration degree of each pixel point,the first image of fresh food areaThe joint probability that a pixel is an edge of a modified region,the hue corresponding to the a-th pixel point in the fresh food area image,fresh local difference degree of the a pixel point in the fresh food area image,a is the serial number of the pixel point in the fresh food area image for the upward rounding function.
In the calculation formula of fresh deterioration degree, the joint probabilityCan be of hueGain degree coefficient of (2), joint probabilityIs to the hue of the metamorphic regionExpanding when joint probabilitiesThe smaller, the description of the firstThe less likely that each pixel point is the edge of the deterioration area, the fresh degree of deteriorationThe smaller will be; when joint probabilitiesThe larger the description of the firstThe greater the possibility that each pixel point is the edge of the deterioration area, the fresh degree of deteriorationThe larger will be. Fresh local degree of differenceDegree of deterioration with freshnessThe local difference of fresh and freshThe greater the degree of deterioration of freshThe larger the firstThe more likely that each pixel is a pixel in the modified regionLarge; fresh local degree of differenceThe smaller the fresh degree of deteriorationThe smaller the firstThe less likely a pixel is within a modified region. To improve the accuracy of the subsequent determined spoiled area, the method is convenient for calculation and analysis, and is suitable forAnd performing upward rounding treatment.
Reference to the first image of fresh food regionThe calculation process of the freshness and deterioration degree of each pixel point can obtain the freshness and deterioration degree of each pixel point in the image of the reference fresh food area, and the realization process is not repeated here.
Thus, the embodiment obtains the freshness deterioration degree of each pixel point in the fresh food area image.
S5, constructing a weighted undirected graph corresponding to the fresh food area image, and determining the side weight of each side in the weighted undirected graph according to the fresh deterioration degree of each pixel point in the weighted undirected graph.
In this embodiment, first, a weighted undirected graph is constructed using a conventional manner, specifically: and taking each pixel point in the fresh food area image as a vertex, and taking a connecting line between each pixel point and each pixel point in the four adjacent areas as an edge to obtain a weighted undirected graph corresponding to the fresh food area image. The construction process of the weighted undirected graph is prior art and is not within the scope of the present invention and will not be described in detail herein. Then, based on the freshness deterioration degree of each pixel point in the weighted undirected graph, calculating the edge weight of each edge in the weighted undirected graph, which can include the following steps:
for any one side in the weighted undirected graph, determining the square of the difference value of the freshness deterioration degree of two pixel points on the corresponding side as the initial side weight of the corresponding side, carrying out negative correlation mapping on the ratio of the initial side weight to the super parameter, and determining the numerical value after the negative correlation mapping as the side weight of the corresponding side.
To determine the first in the fresh food region imagePixel dot and the firstThe edge weight of one edge formed by connecting the pixel points is taken as an example, based on the freshness and deterioration degree of each pixel point in the weighted undirected graph, the calculation formula of the edge weight can be obtained by utilizing the related prior knowledge of the edge weight calculation, and the calculation formula can be as follows:
wherein, the first image of fresh food areaPixel dot and the firstThe pixel points are connected to form the side weight of one side,the first image of fresh food areaThe number of pixels in a pixel is one,the first image of fresh food areaThe number of pixels in a pixel is one,the first image of fresh food areaThe freshness and deterioration degree of each pixel point,the first image of fresh food areaThe freshness and deterioration degree of each pixel point,the first image of fresh food areaPixel dot and the firstThe initial side weight of one side formed by connecting pixel points, e is a natural constant,is the parameter of the ultrasonic wave to be used as the ultrasonic wave,is a non-negative constant, takes a checked value of 1,the first image of fresh food areaPixel dot and the firstThe distance between the individual pixel points is such that,as a function of the distance,is natural constantTo the power of the two,also is a pair ofNegative correlation mapping is performed.
In the calculation formula of the side weight, Can be characterized as the firstPixel dot and the firstThe distance between the pixel points is due to the firstPixel dot and the firstThe positional relationship of the pixel points is adjacent to each other, so1, i.e. can be used toConversion toThe method comprises the steps of carrying out a first treatment on the surface of the Initial side weightCan be characterized as the first in the fresh food region imageFresh and spoilage degree and first pixel pointInitial side weight of difference condition between freshness and deterioration degree of each pixel pointThe bigger the edge pixel point is, the more the difference characteristic between the fresh and modified degree of the pixel point at the edge of the modified region and the fresh and modified degree of the adjacent pixel point is embodied, and the side weight is realizedThe smaller; initial side weightThe smaller the pixel point is, the more the difference characteristic between the fresh and modified degree of the pixel point at the edge of the non-modified region and the fresh and modified degree of the adjacent pixel point is embodied, and the side weight is realizedThe larger.
Thus far, the present embodiment obtains the edge weights of the edges in the weighted undirected graph.
S6, constructing an energy function corresponding to the weighted undirected graph according to the edge weights of each pixel point and each edge in the weighted undirected graph.
In this embodiment, first, the number of connection sides of each pixel point is determined according to each pixel point in the weighted undirected graph, in this embodiment, the number of connection sides of each pixel point is 4, based on the number of connection sides of each pixel point, the balance factor of the energy function corresponding to the weighted undirected graph can be obtained by using the related content of the existing calculation balance factor, and the calculation process of the balance factor is in the prior art and will not be described in detail herein. Then, by weighting the probability that each pixel point in the undirected graph is foreground or background, the penalty of each pixel point for being foreground or background can be obtained by utilizing the related content of the existing calculation information entropy. Therefore, based on the balance factor, the penalty of the pixel point being the foreground or the background, the edge weight and the coincidence ratio of the two pixel points corresponding to the edge weight, the energy function corresponding to the weighted undirected graph can be obtained by utilizing the related prior knowledge constructed by the energy function, and the calculation formula can be as follows:
Wherein, as a function of the energy,as a balance factor, the balance factor is,the first image of fresh food areaThe number of pixels in a pixel is one,the first image of fresh food areaEach pixel point, Z is a pixel point set corresponding to the fresh food area image,the first image of fresh food areaThe penalty for a foreground or background is given to each pixel,in the case of a region item,the first image of fresh food areaPixel dot and the firstThe pixel points are connected to form the side weight of one side,the first image of fresh food areaPixel dot and the firstAnd the coincidence degree of the pixel points.
In the calculation formula of the energy function,can be obtained by calculation by the prior known techniqueIs the cost of each pixel point as foreground or background, can be approximated as a "loss function", region termThe smaller the energy function value is, the smaller the detail of the original image can be presented to the greatest extent;may be obtained by weighting the side weight information of each side in the undirected graph. Wherein, the smaller the pixel point is, the more the difference characteristic of the fresh and modified degree of the pixel point at the edge of the modified region and the fresh and modified degree of the adjacent pixel point is reflected, the firstPixel dot and the firstThe larger the difference value between the freshness and the deterioration degree of each pixel point is, the smaller the energy function value is; side weight The larger the pixel is, the more the difference characteristic of the freshness and deterioration degree of the pixel in the non-deterioration area or the deterioration area and the freshness and deterioration degree of the adjacent pixel is reflected, the firstPixel dot and the firstThe smaller the difference value between the freshness and the deterioration degree of each pixel point is, the larger the energy function value is; when the first isPixel dot and the firstWhen the positions of the pixel points are the same, the contact ratio1, otherwise, the contact ratioIs 0.
S7, determining each target side corresponding to the minimum value of the energy function according to the energy function, and cutting off each target side to obtain a deterioration area image in the fresh food area image.
In this embodiment, the difference between the freshness and the deterioration degree of the pixel points in the deterioration area and the freshness and deterioration degree of the pixel points in the non-deterioration area is large, that is, the edge weight of the edge formed by connecting the pixel points in the two areas is small, so when the energy function in step S6 is minimum, the edges corresponding to the pixel points in the deterioration area and the pixel points in the non-deterioration area in the weighted undirected graph can be selected, that is, each target edge corresponding to the minimum value of the energy function is determined. Specifically, based on an energy function, the minimum value of the energy function can be determined through the existing calculation method of the minimum Cut in the Graph Cut Graph cutting algorithm, each corresponding edge when the energy function is the minimum value is determined to be a target edge, the target edge is disconnected, namely the edge connecting the metamorphic area and the non-metamorphic area is Cut off, a weighted undirected Graph after the disconnection of the target edge is obtained, and the weighted undirected Graph after the disconnection of the target edge is determined to be an metamorphic area image in the fresh food area image. The calculation process of the minimum Cut in the Graph Cut algorithm is the prior art, and is not in the scope of the present invention, and will not be described in detail here.
It is worth to say that after the spoilage area image in the fresh food area image is obtained, in order to improve the accuracy of detecting the spoilage area of the fresh food, fresh food samples are adopted for other areas without obvious spoilage in the fresh food area image, and the items such as the total number of bacterial colonies, pathogenic bacteria and the like in the fresh food are detected through a microorganism detection technology, so that an index result of microorganism detection is obtained. And comparing the microbial detection index result corresponding to the fresh food region with the normal fresh food index, and judging that the corresponding region belongs to the spoiled region when the microbial detection index corresponding to the fresh food region exceeds the normal fresh food index.
So far, the embodiment obtains the obvious spoilage area through Graph Cut Graph cutting algorithm and obtains the unobvious spoilage area through microorganism detection, thereby completing the rapid detection of all spoilage areas of fresh food.
The invention also provides a quick detection system for the fresh food spoilage area, which comprises a processor and a memory, wherein the project devices for processing the total number of colonies, the total number of project colonies such as pathogenic bacteria and the like and the project devices for processing instructions stored in the memory are used for realizing the quick detection method for the fresh food spoilage area.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the invention and are intended to be included within the scope of the invention.
Claims (9)
1. The quick detection method for the spoiled area of the fresh food is characterized by comprising the following steps of:
acquiring a fresh food region image of fresh food to be detected on an HSV three-dimensional color space, and further determining a preset window region corresponding to each pixel point in the fresh food region image;
determining fresh local difference degree of each pixel point according to three channel components corresponding to each window pixel point in a preset window area corresponding to each pixel point; the window pixel points are pixel points in a preset window area corresponding to the pixel points;
determining the joint probability that each pixel point is the edge of the metamorphic region according to the gradient amplitude of the three channel components corresponding to each window pixel point in the preset window region;
Determining the freshness and deterioration degree of each pixel point according to the joint probability that each pixel point is the edge of the deterioration area, the freshness and partial difference degree and the hue of each pixel point;
constructing a weighted undirected graph corresponding to the fresh food area image, and determining the side weight of each side in the weighted undirected graph according to the fresh deterioration degree of each pixel point in the weighted undirected graph;
constructing an energy function corresponding to the weighted undirected graph according to the edge weights of each pixel point and each edge in the weighted undirected graph;
and determining each target side corresponding to the minimum value of the energy function according to the energy function, and cutting off each target side to obtain a deterioration area image in the fresh food area image.
2. The method for rapidly detecting a deterioration area of fresh food according to claim 1, wherein determining the local difference of freshness of each pixel according to three channel components corresponding to each window pixel in a preset window area corresponding to each pixel comprises:
for any pixel point in the fresh food area image, carrying out negative correlation mapping processing on the accumulated sum of the saturation of each window pixel point in a preset window area corresponding to the pixel point, and determining the value after negative correlation mapping as a first difference factor of the corresponding pixel point;
For any one window pixel point in a preset window area corresponding to the pixel point, determining the absolute value of the difference value between the hue of the pixel point and the hue of the corresponding window pixel point as a second difference factor of the corresponding window pixel point; determining the absolute value of the difference value between the brightness of the pixel point and the brightness of the pixel point of the corresponding window as a third difference factor of the pixel point of the corresponding window; the product of the second difference factor and the third difference factor of the corresponding window pixel points is determined to be a fourth difference factor of the corresponding window pixel points; the fourth difference factors of the pixel points of each window in the preset window area corresponding to the pixel points are accumulated and summed to determine a fifth difference factor of the corresponding pixel point;
and determining the product of the first difference factor and the fifth difference factor of the pixel points as the fresh local difference degree of the corresponding pixel points.
3. The method for rapidly detecting a spoiled area of fresh food according to claim 1, wherein determining the joint probability that each pixel is an edge of the spoiled area according to the gradient amplitude of the three channel components corresponding to each pixel in the preset window area comprises:
for the hue corresponding to each window pixel point in a preset window area corresponding to any pixel point, determining a hue gradient projection value of each row and a hue gradient projection value of each column in the preset window area corresponding to the pixel point according to the hue corresponding to each window pixel point in the preset window area corresponding to the pixel point;
Determining hue deterioration edge probability of the pixel points according to the hue degree corresponding to each window pixel point, the hue gradient projection value of each row and the hue gradient projection value of each column in a preset window area corresponding to the pixel points, thereby determining saturation deterioration edge probability and brightness deterioration edge probability of the pixel points;
and determining the value obtained by adding the hue metamorphic edge probability, the saturation metamorphic edge probability and the brightness metamorphic edge probability of the pixel points as the joint probability of the corresponding pixel points as the metamorphic region edge.
4. The method for rapidly detecting a spoiled area of fresh food according to claim 3, wherein the calculation formula of the hue spoiled edge probability is:
wherein, no. I in fresh food region image>Hue deterioration edge probability of each pixel point, < ->For a first preset weight, +.>No. I in fresh food region image>Hue gradient projection values of the j-th row in a preset window area corresponding to each pixel point, wherein j is the serial number of the row in the preset window area, m is the number of the row in the preset window area, and>no. I in fresh food region image>The first part of the preset window area corresponding to each pixel point>Color gradient projection values of columns,/- >For the sequence number of the columns in the preset window area, q is the number of the columns in the preset window area,/-for the sequence number of the columns in the preset window area>For a second preset weight, +.>No. I in fresh food region image>Color corresponding to the c-th window pixel point in the preset window area corresponding to each pixel point, < ->No. I in fresh food region image>The hue corresponding to the central pixel point in the preset window area corresponding to each pixel point, c is the serial number of the window pixel point in the preset window area, < ->For the number of window pixel points in a preset window area, a is the serial number of the pixel points in the fresh food area image,/for the number of the pixel points in the fresh food area image>Is a normalization function.
5. The method for rapidly detecting a deterioration area of fresh food according to claim 3, wherein determining a hue gradient projection value of each row in a preset window area corresponding to a pixel point according to a hue degree corresponding to each window pixel point in the preset window area corresponding to the pixel point comprises:
determining the gradient amplitude of the hue corresponding to each window pixel in a preset window area corresponding to the pixel, calculating the average value of the gradient amplitude of the hue corresponding to each window pixel in the corresponding row for any row of window pixels in the preset window area corresponding to the pixel, accumulating the difference value between the gradient amplitude of the hue corresponding to each window pixel in the corresponding row and the average value of the hue gradient amplitude corresponding to the row, and further determining the value obtained after the accumulating as the hue gradient projection value of the corresponding row.
6. The method for rapidly detecting a spoiled area of fresh food according to claim 1, wherein determining the spoiled degree of fresh of each pixel according to the joint probability that each pixel is an edge of the spoiled area, the local difference degree and the hue degree of fresh of each pixel, comprises:
for any pixel point in the fresh food area image, determining the product of the joint probability of the pixel point as the edge of the metamorphic area and the hue corresponding to the corresponding pixel point as a first metamorphic factor of the corresponding pixel point; determining the fresh local difference degree of the pixel points as a second modification factor of the corresponding pixel points; and adding the first modification factor and the second modification factor of the pixel point, carrying out upward rounding on the added numerical value, and determining the numerical value after the upward rounding as the fresh modification degree of the corresponding pixel point.
7. The method for rapidly detecting a deterioration area of fresh food according to claim 1, wherein determining the edge weights of the edges in the weighted undirected graph according to the freshness deterioration degree of each pixel in the weighted undirected graph comprises:
and for any one side in the weighted undirected graph, determining the square of the difference value of the freshness deterioration degree of two pixel points on the corresponding side as the initial side weight of the corresponding side, carrying out negative correlation mapping on the ratio of the initial side weight to the super parameter, and determining the numerical value after the negative correlation mapping as the side weight of the corresponding side.
8. The method for rapidly detecting a spoiled area of fresh food according to claim 1, wherein the energy function has a calculation formula as follows:
wherein, as a function of energy>Is a balance factor (L)>No. I in fresh food region image>Pixels>No. I in fresh food region image>Each pixel point, Z is a pixel point set corresponding to the fresh food area image, and +.>No. I in fresh food region image>Penalty of individual pixels for foreground or background, < +.>Is regional item->No. I in fresh food region image>Pixel dot and +.>The side right of one side formed by connecting pixel points, < ->No. I in fresh food region image>Pixel dot and +.>And the coincidence degree of the pixel points.
9. A system for rapid detection of a spoiled area of fresh food, comprising a processor and a memory, the processor being configured to process instructions stored in the memory to implement a method for rapid detection of a spoiled area of fresh food according to any one of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310513288.1A CN116228772B (en) | 2023-05-09 | 2023-05-09 | Quick detection method and system for fresh food spoilage area |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310513288.1A CN116228772B (en) | 2023-05-09 | 2023-05-09 | Quick detection method and system for fresh food spoilage area |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116228772A true CN116228772A (en) | 2023-06-06 |
CN116228772B CN116228772B (en) | 2023-07-21 |
Family
ID=86584678
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310513288.1A Active CN116228772B (en) | 2023-05-09 | 2023-05-09 | Quick detection method and system for fresh food spoilage area |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116228772B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116645368A (en) * | 2023-07-27 | 2023-08-25 | 青岛伟东包装有限公司 | Online visual detection method for edge curl of casting film |
CN116952785A (en) * | 2023-09-20 | 2023-10-27 | 深圳市华加生物科技有限公司 | Electronic tobacco tar deterioration detection method based on image data |
CN117557569A (en) * | 2024-01-12 | 2024-02-13 | 吉林交通职业技术学院 | Road pavement construction quality detection method and system |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005117980A (en) * | 2003-10-17 | 2005-05-12 | Food Safety Innovation Gijutsu Kenkyu Kumiai | Pcr primer for detecting food-deteriorating lactic acid bacterium |
CN108982782A (en) * | 2018-06-26 | 2018-12-11 | 广州视源电子科技股份有限公司 | Food deterioration detection method and device, mobile terminal and storage medium |
CN109668852A (en) * | 2018-12-25 | 2019-04-23 | Oppo广东移动通信有限公司 | Electronic equipment, information-pushing method and Related product |
CN109886926A (en) * | 2019-01-22 | 2019-06-14 | 东喜和仪(珠海市)数据科技有限公司 | Fresh food quality determining method and device based on image recognition |
WO2020051746A1 (en) * | 2018-09-10 | 2020-03-19 | 深圳配天智能技术研究院有限公司 | Image edge detection method, image processing device, and computer storage medium |
CN115311310A (en) * | 2022-10-10 | 2022-11-08 | 江苏欧罗曼家纺有限公司 | Method for extracting printed patterns of textiles through graph cutting |
CN115994907A (en) * | 2023-03-22 | 2023-04-21 | 济南市莱芜区综合检验检测中心 | Intelligent processing system and method for comprehensive information of food detection mechanism |
-
2023
- 2023-05-09 CN CN202310513288.1A patent/CN116228772B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005117980A (en) * | 2003-10-17 | 2005-05-12 | Food Safety Innovation Gijutsu Kenkyu Kumiai | Pcr primer for detecting food-deteriorating lactic acid bacterium |
CN108982782A (en) * | 2018-06-26 | 2018-12-11 | 广州视源电子科技股份有限公司 | Food deterioration detection method and device, mobile terminal and storage medium |
WO2020051746A1 (en) * | 2018-09-10 | 2020-03-19 | 深圳配天智能技术研究院有限公司 | Image edge detection method, image processing device, and computer storage medium |
CN109668852A (en) * | 2018-12-25 | 2019-04-23 | Oppo广东移动通信有限公司 | Electronic equipment, information-pushing method and Related product |
CN109886926A (en) * | 2019-01-22 | 2019-06-14 | 东喜和仪(珠海市)数据科技有限公司 | Fresh food quality determining method and device based on image recognition |
CN115311310A (en) * | 2022-10-10 | 2022-11-08 | 江苏欧罗曼家纺有限公司 | Method for extracting printed patterns of textiles through graph cutting |
CN115994907A (en) * | 2023-03-22 | 2023-04-21 | 济南市莱芜区综合检验检测中心 | Intelligent processing system and method for comprehensive information of food detection mechanism |
Non-Patent Citations (3)
Title |
---|
GEORGE TERZAKIS,ET AL: "Fitting multiple projective models using clustering-based Markov chain Monte Carlo inference", 《IMAGE AND VISION COMPUTING》, vol. 33, pages 15 - 25, XP029119325, DOI: 10.1016/j.imavis.2014.10.009 * |
WEI JU,ET AL: "Random walk and graph cut for co-segmentation of lung tumor on PET-CT images", 《IEEE TRANSACTIONS ON IMAGE PROCESSING》, vol. 24, no. 12, XP011588571, DOI: 10.1109/TIP.2015.2488902 * |
刘庆烽: "基于图论的医学图像分割关键技术研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》, vol. 2019, no. 05, pages 138 - 1230 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116645368A (en) * | 2023-07-27 | 2023-08-25 | 青岛伟东包装有限公司 | Online visual detection method for edge curl of casting film |
CN116645368B (en) * | 2023-07-27 | 2023-10-03 | 青岛伟东包装有限公司 | Online visual detection method for edge curl of casting film |
CN116952785A (en) * | 2023-09-20 | 2023-10-27 | 深圳市华加生物科技有限公司 | Electronic tobacco tar deterioration detection method based on image data |
CN116952785B (en) * | 2023-09-20 | 2023-12-12 | 深圳市华加生物科技有限公司 | Electronic tobacco tar deterioration detection method based on image data |
CN117557569A (en) * | 2024-01-12 | 2024-02-13 | 吉林交通职业技术学院 | Road pavement construction quality detection method and system |
CN117557569B (en) * | 2024-01-12 | 2024-04-02 | 吉林交通职业技术学院 | Road pavement construction quality detection method and system |
Also Published As
Publication number | Publication date |
---|---|
CN116228772B (en) | 2023-07-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN116228772B (en) | Quick detection method and system for fresh food spoilage area | |
CN105046700B (en) | Fruit surface defect detection method and system based on gamma correction and color classification | |
CN107610114B (en) | optical satellite remote sensing image cloud and snow fog detection method based on support vector machine | |
CN108564124A (en) | A kind of magnaporthe grisea spore microimage detection recognition methods based on support vector machines | |
US9971944B2 (en) | Unstructured road boundary detection | |
CN103914708B (en) | Food kind detection method based on machine vision and system | |
US11238301B2 (en) | Computer-implemented method of detecting foreign object on background object in an image, apparatus for detecting foreign object on background object in an image, and computer-program product | |
CN104318262A (en) | Method and system for replacing skin through human face photos | |
CN111753577A (en) | Apple identification and positioning method in automatic picking robot | |
CN112232138A (en) | Channel slope damage intelligent identification method based on superpixel characteristics | |
CN105427274A (en) | Image detection method for rotting oranges caused by penicillium infection | |
CN107657619A (en) | A kind of low-light (level) Forest fire image dividing method | |
CN110675400B (en) | Mutton quality index rapid intelligent detection method based on mobile phone APP | |
CN111415339B (en) | Image defect detection method for complex texture industrial product | |
CN102201120A (en) | Multifeature-based target object contour detection method | |
CN114387273A (en) | Environmental dust concentration detection method and system based on computer image recognition | |
CN115330645A (en) | Welding image enhancement method | |
CN103185609A (en) | Image detecting method for grading of tomatoes | |
CN114549441A (en) | Sucker defect detection method based on image processing | |
CN107590816A (en) | A kind of Water-Body Information approximating method based on remote sensing images | |
CN105787912A (en) | Classification-based step type edge sub pixel localization method | |
CN102509414B (en) | Smog detection method based on computer vision | |
CN106407975B (en) | Multiple dimensioned layering object detection method based on space-optical spectrum structural constraint | |
CN114092456A (en) | Cell fluorescence image distinguishing method and system | |
CN102542304B (en) | Region segmentation skin-color algorithm for identifying WAP (Wireless Application Protocol) mobile porn image |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |