CN116228772B - Quick detection method and system for fresh food spoilage area - Google Patents

Quick detection method and system for fresh food spoilage area Download PDF

Info

Publication number
CN116228772B
CN116228772B CN202310513288.1A CN202310513288A CN116228772B CN 116228772 B CN116228772 B CN 116228772B CN 202310513288 A CN202310513288 A CN 202310513288A CN 116228772 B CN116228772 B CN 116228772B
Authority
CN
China
Prior art keywords
pixel point
area
fresh food
pixel
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.)
Active
Application number
CN202310513288.1A
Other languages
Chinese (zh)
Other versions
CN116228772A (en
Inventor
杜兴兰
王书红
吴慧
霍静
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Liaocheng Inspection And Testing Center
Original Assignee
Liaocheng Inspection And Testing Center
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Liaocheng Inspection And Testing Center filed Critical Liaocheng Inspection And Testing Center
Priority to CN202310513288.1A priority Critical patent/CN116228772B/en
Publication of CN116228772A publication Critical patent/CN116228772A/en
Application granted granted Critical
Publication of CN116228772B publication Critical patent/CN116228772B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination 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

Quick detection method and system for fresh food spoilage area
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,,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.
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 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.
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 with a size of +.>The 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) th pixel point in fresh food area image, and (f)>The saturation corresponding to the ith window pixel point in the preset window area corresponding to the ith pixel point in the fresh food area image, wherein 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, and a is the saturation corresponding to the ith window pixel point in the preset window area>For the number of window pixel points in the preset window area, < +.>A first difference factor of an a-th pixel point in a fresh food area image, and +_>Color corresponding to the ith window pixel point in a preset window area corresponding to the (a) th pixel point in a fresh food area image>Hue corresponding to the (a) th pixel point in the fresh food area image, < + >>In order to find the absolute value function,second difference factors of pixel points of an ith window in a preset window area corresponding to the pixel point a in the fresh food area image, < +.>Brightness corresponding to the ith window pixel point in a preset window area corresponding to the (a) th pixel point in a fresh food area image,/for example>Brightness corresponding to the (a) th pixel point in the fresh food area image>Fresh foodThird difference factor of ith window pixel point in preset window area corresponding to the (a) th pixel point in food area image,/third difference factor of ith window pixel point in preset window area corresponding to the (a) th pixel point in food area image >Fourth difference factor of ith window pixel point in preset window area corresponding to the (a) th pixel point in 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 point is +.>The 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 may be used to characterize the hue difference between the window pixel and the center pixel, the greater the hue difference, the less likely the window pixel is to be the same as the region property of the center pixel, which refers to either the same metamorphic region or the same invariant regionThe more likely the center pixel is a pixel near the deteriorated edge in the fresh food area, the center pixel is the (a) th pixel in the image of the fresh food area; 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, < >>Gradient amplitude values corresponding to the pixel points of the p-th window in the j-th row in the preset window area corresponding to each pixel point, wherein p is the serial number of the pixel points of the window in the j-th row in the preset window area, and l is the number of the pixel points of the window in 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, let(s)>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 amplitude ∈>The 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 marked +.>. 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,,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, +.>Fresh foodFood 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.
In the calculation formula of hue deterioration edge probability, the firstHue deterioration edge probability of individual pixel points +. >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 modified area can be analyzed from the angle of the preset window area corresponding to the pixel point, and +.>The pixel point can be analyzed to be the outline of the edge of the metamorphic region from the angle of the difference of the hue gradient amplitude between the pixel point and each window pixel point in the corresponding preset window regionThe rate, in particular, the result of the analysis of the difference between the pixel point and the surrounding pixel points is more accurate, so the first preset weight +.>Can be set to 0.3, a second preset weight +.>May be set to 0.7; since the gradient amplitude is larger at the edge of the fresh food spoilage area, the gradient projection value of the line color phase is +.>Sum 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->The larger will be; gradient of window pixels->And center pixel->The 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, the hue metamorphic edge probability is +. >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,,no. I in fresh food region image>Joint probability that each pixel is an edge of a modified region, < > >No. I in fresh food region image>Hue deterioration edge probability of each pixel point, < ->No. I in fresh food region image>Saturation deterioration edge probability of individual pixel points, < ->No. I in fresh food region image>The 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, the first image of the fresh food region is determinedFresh deterioration degree of each pixel is exemplified, and the +.>The calculation formula of the freshness and deterioration degree of each pixel point can be:
wherein,,no. I in fresh food region image>Fresh degree of deterioration of each pixel point, < ->No. I in fresh food region image>Joint probability that each pixel is an edge of a modified region, < >>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 hue +.>Gain degree coefficient of (2), joint probability->Is the hue of the spoiled area +.>Expansion is performed when the joint probability +.>The smaller the time, the description of +.>The less likely that each pixel is the edge of the modified region, the fresh degree of modification +.>The smaller will be; when joint probabilitiesThe greater the instruction +.>The greater the possibility that each pixel is the edge of the modified region, the fresh modification degree +.>The larger will be. Fresh local differentiation degree->Degree of deterioration with fresh>For positive correlation, fresh local difference degree->The greater the fresh degree of deterioration>The larger the->The greater the likelihood that each pixel is a pixel within the modified region; fresh local differentiation degree->The smaller the fresh degree of deterioration>Smaller, no->The less likely a pixel is within a modified region. In order to increase the accuracy of the subsequently determined deterioration zone, a computational analysis is facilitated for +.>And 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 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,,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>Pixels>No. I in fresh food region image>Pixels>No. I in fresh food region image>Fresh degree of deterioration of each pixel point, < ->No. I in fresh food region image>Fresh degree of deterioration of each pixel point, < ->No. I in fresh food region image>Pixel dot and +.>Initial side weight of one side formed by connecting pixel points, e is a natural constant, and +.>Is super-parameter (herba Cinchi Oleracei)>Is a non-negative constant, and the checked value is 1, < >>No. I in fresh food region image>Pixel dot and +.>Distance between pixels, +.>As a function of distance>Is a natural constant +.>Power of the th order, ->Is also for->Negative correlation mapping is performed.
In the calculation formula of the side weight, Can be characterized as->Pixel dot and +.>The distance between the pixel points is due to the +.>Pixel dot and +.>The positional relationship of the individual pixels is adjacent, so +.>1, i.e. can be used toConversion to->The method comprises the steps of carrying out a first treatment on the surface of the Initial side rights->Can be characterized as +.f in fresh food area image>Fresh deterioration degree and +.>The difference between the freshness and deterioration degree of each pixel point, initial side weight +.>The 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, the side weight +.>The smaller; initial side rights->The 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, the side weight is ≡>The 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 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.
In the calculation formula of the energy function,can be obtained by calculation by the prior known technique, region term->Is 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 (1)>The smaller the pixel is, the more the difference characteristic of the fresh and modified degree of the pixel at the edge of the modified region and the fresh and modified degree of the adjacent pixel is embodied, the +.>Pixel dot and +.>The 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 the deterioration degree of the pixel in the non-deterioration area or the deterioration area and the freshness and the deterioration degree of the adjacent pixel is reflected>Pixel dot and +.>The smaller the difference value between the freshness and the deterioration degree of each pixel point is, the larger the energy function value is; when->Pixel dot and +.>When the positions of the pixel points are the same, the coincidence degree is->1, otherwise, the contact ratio->Is 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 (5)

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;
determining each target edge corresponding to the minimum value of the energy function according to the energy function, and cutting off each target edge to obtain a deterioration area image in the fresh food area image;
according to three channel components corresponding to each window pixel point in a preset window area corresponding to each pixel point, determining the fresh local difference degree of each pixel point comprises the following steps:
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;
Determining the product of the first difference factor and the fifth difference factor of the pixel points as fresh local difference degrees of the corresponding pixel points;
according to the gradient amplitude of the three channel components corresponding to each window pixel point in the preset window area, determining the joint probability that each pixel point is the edge of the metamorphic area comprises the following steps:
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;
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 is determined to be the joint probability of the corresponding pixel points as the metamorphic area edge;
According to the joint probability that each pixel point is an edge of a metamorphic region, the freshness local difference degree and the hue of each pixel point, the freshness metamorphic degree of each pixel point is determined, and the method comprises the following steps:
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; 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;
determining the edge weight of each edge in the weighted undirected graph according to the freshness 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.
2. The method for rapidly detecting a spoiled area of fresh food according to claim 1, 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>Color gradient projection values of j rows in a preset window area corresponding to each pixel point, wherein j is the preset window areaThe sequence number of the lines in the domain, m is the number of the lines 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.
3. The method for rapidly detecting a deterioration area of fresh food according to claim 1, 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.
4. 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.
5. 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-4.
CN202310513288.1A 2023-05-09 2023-05-09 Quick detection method and system for fresh food spoilage area Active CN116228772B (en)

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 CN116228772A (en) 2023-06-06
CN116228772B true 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)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116645368B (en) * 2023-07-27 2023-10-03 青岛伟东包装有限公司 Online visual detection method for edge curl of casting film
CN116952785B (en) * 2023-09-20 2023-12-12 深圳市华加生物科技有限公司 Electronic tobacco tar deterioration detection method based on image data
CN117557569B (en) * 2024-01-12 2024-04-02 吉林交通职业技术学院 Road pavement construction quality detection method and system

Citations (3)

* Cited by examiner, † Cited by third party
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
CN109886926A (en) * 2019-01-22 2019-06-14 东喜和仪(珠海市)数据科技有限公司 Fresh food quality determining method and device based on image recognition
CN115994907A (en) * 2023-03-22 2023-04-21 济南市莱芜区综合检验检测中心 Intelligent processing system and method for comprehensive information of food detection mechanism

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108982782B (en) * 2018-06-26 2021-03-02 广州视源电子科技股份有限公司 Food deterioration detection method and device, mobile terminal and storage medium
CN111630563B (en) * 2018-09-10 2022-02-18 深圳配天智能技术研究院有限公司 Edge detection method of image, image processing apparatus, and computer storage medium
CN109668852B (en) * 2018-12-25 2021-11-02 Oppo广东移动通信有限公司 Electronic equipment, information pushing method and related product
CN115311310B (en) * 2022-10-10 2023-04-07 江苏欧罗曼家纺有限公司 Method for extracting printed patterns of textiles through graph cutting

Patent Citations (3)

* Cited by examiner, † Cited by third party
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
CN109886926A (en) * 2019-01-22 2019-06-14 东喜和仪(珠海市)数据科技有限公司 Fresh food quality determining method and device based on image recognition
CN115994907A (en) * 2023-03-22 2023-04-21 济南市莱芜区综合检验检测中心 Intelligent processing system and method for comprehensive information of food detection mechanism

Also Published As

Publication number Publication date
CN116228772A (en) 2023-06-06

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
CN107578035B (en) Human body contour extraction method based on super-pixel-multi-color space
CN107610114B (en) optical satellite remote sensing image cloud and snow fog detection method based on support vector machine
CN109740460B (en) Optical remote sensing image ship detection method based on depth residual error dense network
CN103186904B (en) Picture contour extraction method and device
EP3036714B1 (en) Unstructured road boundary detection
CN112232138A (en) Channel slope damage intelligent identification method based on superpixel characteristics
CN111753577A (en) Apple identification and positioning method in automatic picking robot
CN102385753A (en) Illumination-classification-based adaptive image segmentation method
CN107657619A (en) A kind of low-light (level) Forest fire image dividing method
CN102201120A (en) Multifeature-based target object contour detection method
CN108181316A (en) A kind of bamboo strip defect detection method based on machine vision
CN115330645A (en) Welding image enhancement method
CN113256624A (en) Continuous casting round billet defect detection method and device, electronic equipment and readable storage medium
CN103185609A (en) Image detecting method for grading of tomatoes
CN102509414B (en) Smog detection method based on computer vision
CN114549441A (en) Sucker defect detection method based on image processing
CN105787912A (en) Classification-based step type edge sub pixel localization method
CN113205494B (en) Infrared small target detection method and system based on adaptive scale image block weighting difference measurement
CN114092456A (en) Cell fluorescence image distinguishing method and system
CN114820597B (en) Smelting product defect detection method, device and system based on artificial intelligence
CN116051539A (en) Diagnosis method for heating fault of power transformation equipment
CN116228659A (en) Visual detection method for oil leakage of EMS trolley
CN115187790A (en) Image contour extraction method based on reference region binarization result

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