Image segmentation and extraction system for jujube pulp and pit based on image processing

By using image processing techniques and region growing algorithms, and utilizing grayscale distribution features and clustering algorithms to segment the pulp and pit of jujube fruit, the problem of low segmentation accuracy in existing technologies is solved, and more efficient identification of pit regions and assessment of stirring degree are achieved.

CN120525902BActive Publication Date: 2026-01-06DONGYING GUANGYUAN BIOTECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510700975.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2026-01-06
Estimated Expiration
2045-05-28

AI Technical Summary

Technical Problem

In existing technologies, the methods for separating jujube pulp and pit rely on manual judgment, which is inefficient and costly. The region growing algorithm is affected by the similarity of gray values ​​between pulp and pit and the holes in the pit, resulting in low segmentation accuracy and inability to accurately judge the degree of stirring.

Method used

Image processing techniques are used to obtain seed points in jujube images. Gray-scale distribution features and clustering algorithms are used to segment suspected fruit pit regions. Target regions are selected based on fruit pit confidence. Region growing algorithms are applied to obtain fruit pit regions. The degree of stirring is determined based on the fruit pit area.

Benefits of technology

It improves the accuracy of fruit pit segmentation, enables more accurate assessment of the stirring degree of jujubes, and reduces manual intervention and costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120525902B_ABST
    Figure CN120525902B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of computer vision, and more particularly to a jujube pulp and kernel image segmentation and extraction system based on image processing, which comprises a processor and a memory, and the processor executes the computer program of the memory to realize the following steps: image acquisition of the stirred jujube to obtain a target image; obtaining a suspected kernel region according to the gray value distribution characteristics of the pixel points in the target image; obtaining kernel credibility according to the gray value distribution characteristics of the pixel points in the suspected kernel region, and screening the target region according to the kernel credibility; regarding any target region as a to-be-dropped region, obtaining a seed point according to the gray value distribution characteristics of the pixel points in the to-be-dropped region, and obtaining a kernel region according to a region growing algorithm; obtaining the area of the kernel region in each to-be-dropped region, and judging the stirring degree of the jujube according to the areas of all kernel regions, so that the accuracy of the kernel region segmented by the region growing algorithm is higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, and in particular to an image segmentation and extraction system for jujube pulp and pit based on image processing. Background Technology

[0002] As a fruit with both medicinal and edible properties, the pulp and pit of the jujube have significant medicinal and economic value. Therefore, separating the pulp and pit of the jujube helps to better utilize their value. Current technology typically uses a stirring device to separate the pulp and pit of the jujube. The degree of separation is judged by the degree of stirring; thorough stirring indicates that the pit has been completely separated from the pulp. Traditionally, the degree of stirring relies mainly on manual judgment, which is inefficient and costly. With the development of computer vision technology, image processing technology can be used to automatically segment the pulp and pit of the jujube, thus providing a better basis for judging the degree of stirring.

[0003] Existing technologies typically use region growing algorithms to automatically segment the pulp and pit of jujubes. These algorithms involve planting seed points, each of which grows a region, which is then identified as the pit region. However, because the pulp and pit overlap, and the shadowed areas in the jujube image share similar local features with the pulp-covered pit, the grayscale values ​​across different regions are similar. This interferes with seed point placement in the region growing algorithm, reducing its accuracy and resulting in the grown region not always being the pit region. Furthermore, the presence of pitting cavities within the pit creates grayscale differences, potentially leading to incomplete region growth. These issues all reduce the accuracy of pit and pulp segmentation, making it difficult to accurately determine the degree of stirring in the jujube.

[0004] Therefore, how to accurately obtain the seed points in the jujube image so that the fruit kernel region obtained by the region growing algorithm is more accurate has become an urgent problem to be solved. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide an image processing-based system for segmenting and extracting jujube pulp and pit images to solve the problem of how to accurately obtain seed points in jujube images, so as to improve the accuracy of the pit region segmented by the region growing algorithm.

[0006] This invention provides an image processing-based system for segmenting and extracting the pulp and pit of jujube fruit, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the following method:

[0007] The stirred jujubes are imaged to obtain jujube images, and the jujube images are then processed into grayscale to obtain the target image;

[0008] Based on the grayscale value distribution characteristics of the pixels in the target image, the target image is segmented to obtain at least two suspected kernel regions;

[0009] For any suspected core region, the core confidence of the suspected core region is obtained based on the grayscale change characteristics of the pixels in the suspected core region. The core confidence of each suspected core region is obtained. Based on the core confidence of each suspected core region, at least one target region is selected from all suspected core regions.

[0010] Any target area is designated as the area to be delivered. Based on the grayscale value distribution characteristics of the pixels in the area to be delivered, seed points in the area to be delivered are obtained. The growth area of ​​each seed point is obtained according to the region growth algorithm to form the core area in the area to be delivered.

[0011] Obtain the area of ​​the fruit pit region in each area to be placed. Based on the area of ​​all fruit pit regions, determine the degree of stirring of the jujube and use it to evaluate the fruit pit segmentation status of the jujube.

[0012] Preferably, the step of segmenting the target image based on the grayscale distribution characteristics of pixels in the target image to obtain at least two suspected kernel regions includes:

[0013] A two-dimensional rectangular coordinate system is constructed in the target image. The coordinates of each pixel in the target image are obtained according to the two-dimensional rectangular coordinate system. The coordinates of each pixel and its gray value are combined to form a three-dimensional feature vector. Based on the three-dimensional feature vector of each pixel, the pixels in the target image are clustered to obtain at least two clusters. Based on the pixels corresponding to each cluster, at least two cluster regions are obtained.

[0014] Construct a grayscale histogram of the target image, where the horizontal axis of the grayscale histogram represents the grayscale level and the vertical axis represents the number of pixels corresponding to the grayscale level. Obtain the cumulative distribution function of each grayscale level in the grayscale histogram except for the maximum and minimum grayscale levels, and use the grayscale level corresponding to the minimum cumulative distribution function as the grayscale level threshold.

[0015] For any cluster region, the gray level of the average gray value of the pixels in the gray level histogram is obtained and recorded as the gray level of the any cluster region. If the gray level of the any cluster region is less than or equal to the gray level threshold, then the any cluster region is recorded as a suspected kernel region.

[0016] Obtain the gray level of each cluster region, and based on the gray level of each cluster region, obtain at least two suspected kernel regions.

[0017] Preferably, the step of obtaining the fruit pit confidence level of any suspected fruit pit region based on the grayscale change features of pixels in any suspected fruit pit region includes:

[0018] The credibility of the first fruit core is obtained based on the difference in grayscale value between each pixel in any suspected fruit core region and its pixels in the horizontal and vertical directions.

[0019] Construct a grayscale curve of any suspected fruit pit region, where the horizontal axis of the grayscale curve is the grayscale value and the vertical axis is the number of pixels corresponding to the grayscale value. Based on the fluctuation characteristics of the data in the grayscale curve, obtain the credibility of the second fruit pit.

[0020] Obtain the maximum value between the first fruit pit confidence score and the second fruit pit confidence score, and use the maximum value as the fruit pit confidence score of any suspected fruit pit region.

[0021] Preferably, the step of obtaining the first fruit core confidence level based on the difference in grayscale values ​​between each pixel in any suspected fruit core region and its pixels in the horizontal and vertical directions includes:

[0022] For any pixel in any suspected fruit core region, in any suspected fruit core region, the gray values ​​of the pixel and all pixels in the horizontal direction are combined to form a horizontal gray value sequence, and the gray values ​​of the pixel and all pixels in the vertical direction are combined to form a vertical gray value sequence.

[0023] Obtain the standard deviation of the horizontal grayscale value sequence, obtain the rate of change of each grayscale value in the horizontal grayscale value sequence, filter out target rates of change that are not zero, record the mean of all target rates of change as the mean of rates of change, and obtain the product of the standard deviation and the mean of rates of change to obtain the degree of grayscale change of the horizontal grayscale value sequence.

[0024] Obtain the grayscale change degree of the vertical grayscale value sequence, calculate the average value between the grayscale change degree of the horizontal grayscale value sequence and the grayscale change degree of the vertical grayscale value sequence, and obtain the change degree of any pixel.

[0025] The mean value of the degree of change of all pixels in any suspected kernel region is normalized to obtain the first kernel confidence level.

[0026] Preferably, obtaining the credibility of the second kernel based on the fluctuation characteristics of the data in the grayscale curve includes:

[0027] Obtain the valley point in the grayscale curve. If there is only one valley point in the grayscale curve, obtain the pixel corresponding to each data point to the right of the valley point in the grayscale curve, and record it as the covered pixel. Obtain the average grayscale value of all covered pixels to obtain the average covered grayscale value.

[0028] Clusters with gray levels greater than the gray level threshold are categorized as pulp regions. The average gray value of all pulp regions is obtained to get the average gray value of the region. The absolute value of the difference between the average gray value of the coverage and the average gray value of the region is calculated to obtain the degree of difference.

[0029] Construct a gray-level co-occurrence matrix for any suspected kernel region, obtain gray-level feature values ​​based on the gray-level uniformity of the gray-level co-occurrence matrix, obtain the product of the degree of difference and the gray-level feature values, and perform inverse proportional normalization on the product to obtain the second kernel confidence level.

[0030] If there are no valley points in the grayscale curve, then the credibility of the second kernel is confirmed to be a constant of 0.

[0031] Preferably, the step of filtering at least one target region among all suspected fruit pit regions based on the fruit pit confidence level of each suspected fruit pit region includes:

[0032] Set a kernel confidence threshold, and filter out suspected kernel regions with a kernel confidence level greater than or equal to the kernel confidence threshold from all suspected kernel regions. These regions are then recorded as target regions.

[0033] Preferably, obtaining seed points in the region to be deployed based on the grayscale value distribution characteristics of pixels in the region to be deployed includes:

[0034] Construct a grayscale change curve for the area to be deployed, where the horizontal axis of the grayscale change curve represents the grayscale value and the vertical axis represents the number of pixels corresponding to the grayscale value. Obtain the peak and valley points of the grayscale change curve.

[0035] The peak point, valley point, first data point and last data point of the grayscale change curve are recorded as key points, and the pixel point corresponding to the grayscale value of each key point is the initial seed point in the area to be deployed.

[0036] Obtain the global region growing threshold for region segmentation of the target image using the region growing algorithm. For any key point, based on the gray value difference between the key point and its right adjacent key point and the global region growing threshold, obtain S target key points corresponding to the key point.

[0037] For any one of the S target key points, the gray value of the target key point is obtained based on the difference between the global region growth threshold and the gray value corresponding to the target key point. The gray value of each target key point is obtained, and the pixel corresponding to the gray value of each target key point is the seed point to be added corresponding to the target key point.

[0038] Obtain the seed point to be added corresponding to each key point, and use all the initial seed points and all the seed points to be added as seed points in the area to be deployed.

[0039] Preferably, obtaining S target key points corresponding to any key point based on the grayscale value difference between any key point, its right adjacent key point, and the global region growth threshold includes:

[0040] Obtain the difference in grayscale value between the right adjacent key point of any key point and any key point, and record it as grayscale difference. Calculate the ratio of the grayscale difference to the global growth region threshold of a preset multiple, and round down the ratio to obtain S target key points corresponding to any key point.

[0041] Preferably, obtaining the grayscale value of any target key point based on the difference between the global region growth threshold and the grayscale value corresponding to any key point includes:

[0042] Number the S target key points corresponding to any key point, obtain the product of the number of any target key point by a preset multiple and the global region growth threshold to obtain the value to be increased, obtain the gray value of any key point and the value to be increased to obtain the gray value of any target key point.

[0043] Preferably, determining the degree of stirring of the jujube based on the area of ​​all pit regions includes:

[0044] For any given kernel region, obtain the area of ​​the circumscribed ellipse of that kernel region, and denote it as the actual kernel region;

[0045] Obtain the cumulative area of ​​all fruit pit regions to get the total fruit pit area. Obtain the cumulative area of ​​all actual fruit pit regions to get the total actual fruit pit area. Calculate the ratio of the total fruit pit area to the total actual fruit pit area to get the jujube separation ratio.

[0046] If the jujube separation ratio is greater than the preset separation ratio threshold, it is confirmed that the jujube has been stirred sufficiently. If the jujube separation ratio is less than or equal to the preset separation ratio threshold, it is confirmed that the jujube has not been stirred sufficiently.

[0047] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows:

[0048] This invention acquires images of stirred jujubes to obtain jujube images, performs grayscale processing on the jujube images to obtain target images; based on the grayscale value distribution characteristics of the pixels in the target image, the target image is segmented to obtain at least two suspected pit regions; for any suspected pit region, the pit confidence of the suspected pit region is obtained based on the grayscale change characteristics of the pixels in the suspected pit region, the pit confidence of each suspected pit region is obtained, and based on the pit confidence of each suspected pit region, at least one target region is selected from all suspected pit regions; any target region is recorded as a region to be placed, and seed points in the region to be placed are obtained based on the grayscale value distribution characteristics of the pixels in the region to be placed, and the growth region of each seed point is obtained according to the region growing algorithm to form the pit region in the region to be placed; the area of ​​the pit region in each region to be placed is obtained, and the degree of stirring of the jujube is determined based on the area of ​​all pit regions to evaluate the pit segmentation status of the jujube. Specifically, based on the grayscale distribution characteristics of pixels in the target image, the pulp region in the target image can be identified, eliminating interference from the pulp region. Then, based on the kernel confidence of the suspected kernel region, it can be identified whether the suspected kernel region is the shadow region between the pulp and the kernel in the target image, eliminating interference from the shadow region in the target image. Finally, based on the grayscale distribution characteristics of pixels in the region to be distributed, the seed points in the region to be distributed can be obtained more accurately, thus obtaining the kernel region. This makes the kernel region segmented by the region growing algorithm more accurate. Attached Figure Description

[0049] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0050] Figure 1 This is a flowchart of a method for segmenting and extracting images of jujube pulp and pit based on image processing, provided in Embodiment 1 of the present invention.

[0051] Figure 2 This is an example image of jujube provided in Embodiment 1 of the present invention;

[0052] Figure 3 This is an example diagram of a jujube seed provided in Embodiment 1 of the present invention. Detailed Implementation

[0053] Embodiments of this disclosure are described in detail below, with examples of these embodiments illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting it.

[0054] It should be noted that the terms "first," "second," etc., used in this disclosure and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure.

[0055] To illustrate the technical solution of the present invention, specific embodiments are described below.

[0056] This invention provides an image processing-based system for segmenting and extracting images of jujube pulp and pits, including a processor and a memory. The processor executes a computer program in the memory to implement an image processing-based method for segmenting and extracting images of jujube pulp and pits. Figure 1 As shown, the method includes the following steps:

[0057] Step S101: Acquire an image of the stirred jujube to obtain a jujube image, and perform grayscale processing on the jujube image to obtain a target image.

[0058] As a fruit with both medicinal and edible properties, the pulp and pit of the jujube have significant medicinal and economic value. Therefore, separating the pulp and pit of the jujube helps to better utilize their value. Current technology typically uses a stirring device to separate the pulp and pit of the jujube. The degree of separation is judged by the degree of stirring; thorough stirring indicates that the pit has been completely separated from the pulp.

[0059] In this embodiment, after the jujubes are collected and cleaned, they are first steamed in a steamer over high heat for 30-40 minutes (this is not a fixed timeframe and can be adjusted according to the specific implementation scenario). Then, they are cooled, peeled, and placed in a container for stirring. The stirring device is located above the conveyor device, and the container of jujubes is placed on the conveyor device. A high-definition camera is installed directly above the conveyor device. To prevent over-stirring and subsequent cracking of the jujube pits, the jujubes need to be stirred for varying durations. The initial stirring is set to 5 minutes, followed by a 1-minute interval between stirring sessions (this is not a fixed timeframe and can be adjusted according to the specific implementation scenario). After each stirring session reaches its designated duration, stirring is stopped, and the jujubes inside the stirring container are photographed to obtain an image of the jujubes. Figure 2 As shown.

[0060] After obtaining the jujube image, the jujube image is converted to grayscale to obtain the target image, and the grayscale value of each pixel in the target image is obtained. Grayscale conversion and grayscale value acquisition are existing technologies and will not be described in detail here.

[0061] Existing technologies typically use region growing algorithms to automatically segment the pulp and pit of jujubes. These algorithms involve planting seed points, each of which grows a region, which is then identified as the pit region. However, because the pulp and pit overlap, and the shadowed areas in the jujube image share similar local features with the pulp-covered pit, the grayscale values ​​across different regions are similar. This interferes with seed point placement in the region growing algorithm, reducing its accuracy and resulting in the grown region not always being the pit region. Furthermore, the presence of pitting cavities within the pit creates grayscale differences, potentially leading to incomplete region growth. These issues all reduce the accuracy of pit and pulp segmentation, making it difficult to accurately determine the degree of stirring in the jujube.

[0062] Therefore, this embodiment obtains seed points in the target image based on the grayscale distribution characteristics of pixels in the target image, and then obtains the kernel region in the target image. Then, based on the area of ​​the kernel region, it determines the degree of stirring of the jujube, so that the kernel region obtained by the region growing algorithm is more accurate.

[0063] Step S102: Based on the grayscale value distribution characteristics of the pixels in the target image, the target image is segmented to obtain at least two suspected kernel regions.

[0064] After being stirred, jujubes will produce pulp, pits, and pits covered by pulp (i.e., pits that are not completely separated). Since both the pits and the pits covered by pulp in the target image have low gray values, the target image can be segmented into multiple regions using a clustering algorithm. Then, based on the gray value distribution characteristics of pixels in different regions of the target image, the suspected pit regions can be obtained.

[0065] In this embodiment, a two-dimensional rectangular coordinate system is constructed with the lower left corner vertex of the target image as the origin, the horizontal direction as the x-coordinate, and the vertical direction as the y-coordinate. The coordinates of each pixel in the target image are obtained according to the two-dimensional rectangular coordinate system. The coordinates of each pixel and its gray value are combined to form a three-dimensional feature vector. According to the three-dimensional feature vector of each pixel, mean-shift clustering is performed on the pixels in the target image to obtain at least two clusters. Then, each pixel in the cluster is marked in the target image. All pixels corresponding to a cluster form an initial region. For any initial region, the circumscribed ellipse of the initial region is obtained. In any initial region, the pixel with the shortest distance to the circumscribed ellipse in each direction is obtained as the edge point. Connecting all the edge points, the cluster region corresponding to any initial region is obtained. According to the method of obtaining the cluster region corresponding to any initial region, at least two cluster regions are obtained.

[0066] Since the area containing the fruit pulp in the target image is much larger than the area containing the fruit pit, and the area containing the fruit pulp exhibits a higher grayscale value, there should be a clear boundary between the area containing the fruit pit and the area containing the fruit pulp in the grayscale histogram of the target image. Therefore, a grayscale histogram of the target image can be constructed, where the horizontal axis of the grayscale histogram represents the grayscale level and the vertical axis represents the number of pixels corresponding to each grayscale level. The cumulative distribution function of each grayscale level in the grayscale histogram, excluding the maximum and minimum grayscale levels, is obtained. The grayscale level corresponding to the minimum cumulative distribution function is used as the grayscale threshold, i.e., the boundary line in the target image. Based on the grayscale value distribution characteristics of pixels in different regions and the grayscale threshold, the suspected fruit pit region is obtained.

[0067] Specifically, for any cluster region, due to the pitting corrosion holes in the jujube fruit kernel, such as... Figure 3 As shown, isolated pixels may appear in the cluster region. To reduce the influence of interference factors such as pitting and holes, morphological opening operation is used to preprocess the various cluster regions. By eroding and then dilating the various cluster regions, the shape boundary is smoothed while the isolated pixels in the region are removed. Morphological opening operation is an existing technology and will not be described in detail here. The gray level of the average gray value of the pixels in any of the preprocessed cluster regions is obtained in the gray level histogram and recorded as the gray level of any cluster region. If the gray level of any cluster region is less than or equal to the gray level threshold, then the any cluster region is recorded as a suspected kernel region.

[0068] The gray level of each cluster region is obtained. Based on the above method for obtaining suspected kernel regions, at least two suspected kernel regions are obtained in the target image according to the gray level of each cluster region.

[0069] At this point, the suspected kernel region in the target image has been obtained.

[0070] Step S103: For any suspected fruit core region, obtain the fruit core confidence of the suspected fruit core region based on the grayscale change characteristics of the pixels in the suspected fruit core region, obtain the fruit core confidence of each suspected fruit core region, and filter at least one target region among all suspected fruit core regions based on the fruit core confidence of each suspected fruit core region.

[0071] The target image may also include shadow areas formed by the gap between the pulp and the seed. Since the gray values ​​of the area where the seed is covered by pulp are similar to those of the shadow area, there may be shadow areas in the suspected seed area obtained in step S102. In order to more accurately obtain the area where the seed is located in the target image, it is necessary to eliminate the interference of the shadow area on the area where the seed is located.

[0072] The area containing the fruit pit includes the area containing ordinary fruit pits and the area containing fruit pits covered by fruit pulp. Due to the pitting corrosion on the surface of the fruit pit, the area containing ordinary fruit pits exhibits more frequent local grayscale changes and faster changes in grayscale. The area containing fruit pits covered by fruit pulp, on the other hand, exhibits high local grayscale complexity and poor grayscale consistency, as the grayscale values ​​of the grayscale differences within the pulp-covered area are similar to those of the pulp area. The shaded area is formed between the pulp and the fruit pit, exhibiting lower grayscale complexity and higher grayscale consistency. Furthermore, no pulp is present in this area, meaning there is no interference from the grayscale values ​​of the pulp area. Therefore, for any suspected fruit pit area, the confidence level of the fruit pit in any suspected fruit pit area can be obtained based on the grayscale change characteristics of the pixels in that area. Then, based on the confidence level, the interference of the shaded area on the fruit pit area can be eliminated, and the target area can be selected.

[0073] The method for obtaining the fruit core confidence level of any suspected fruit core region based on the grayscale change characteristics of pixels in any suspected fruit core region is as follows:

[0074] (1) Based on the difference in grayscale values ​​between each pixel in any suspected kernel region and its pixels in the horizontal and vertical directions, the credibility of the first kernel is obtained.

[0075] Specifically, for any pixel in any suspected fruit core region, in any suspected fruit core region, the gray values ​​of the pixel and all pixels in the horizontal direction are combined to form a horizontal gray value sequence, and the gray values ​​of the pixel and all pixels in the vertical direction are combined to form a vertical gray value sequence.

[0076] Obtain the standard deviation of the horizontal grayscale value sequence. Number the grayscale values ​​in the horizontal grayscale value sequence from left to right according to the position of the corresponding pixel. Construct a grayscale value curve of the horizontal grayscale value sequence with the grayscale value number as the horizontal axis and the grayscale value as the vertical axis. In the grayscale value curve, obtain the average rate of change between each grayscale value and the next grayscale value as the rate of change of each grayscale value. The rate of change of the last grayscale value in the horizontal grayscale value sequence is 0. The average rate of change is a prior art and will not be elaborated here. Target rate of change that is not 0 is selected. The mean of all target rate of change is recorded as the mean rate of change. Obtain the product of the standard deviation and the mean rate of change to obtain the degree of grayscale change of the horizontal grayscale value sequence.

[0077] According to the above method for obtaining the grayscale change degree of the horizontal grayscale value sequence, the grayscale change degree of the vertical grayscale value sequence is obtained, and the average value between the grayscale change degree of the horizontal grayscale value sequence and the grayscale change degree of the vertical grayscale value sequence is calculated to obtain the change degree of any pixel.

[0078] The mean value of the degree of change of all pixels in any suspected kernel region is normalized to obtain the first kernel confidence level.

[0079] In one embodiment, taking the i-th suspected kernel region as an example, the formula for calculating the confidence level of the first kernel in the i-th suspected kernel region is:

[0080] ;

[0081] in, The confidence level of the first kernel in the i-th suspected kernel region; Let be the standard deviation of the horizontal or vertical grayscale value sequence of the j-th pixel in the i-th suspected kernel region; is the mean rate of change of the horizontal or vertical grayscale value sequence of the j-th pixel in the i-th suspected kernel region; f is the horizontal or vertical grayscale value sequence of the j-th pixel in the i-th suspected kernel region; N is the number of pixels in the i-th suspected kernel region; exp() is an exponential function with the natural constant as the base, used for normalization.

[0082] It should be noted that, This refers to the degree of grayscale variation in a horizontal or vertical grayscale value sequence. The larger the value, the more times the gray value changes in the horizontal or vertical gray value sequence, the greater the amplitude of the gray value change, and the greater the degree of gray value change. The larger the value, the greater the intensity of grayscale change in the horizontal or vertical grayscale value sequence, and the greater the degree of grayscale change. The greater the degree of grayscale change, the more the j-th pixel in the i-th suspected kernel region matches the characteristics of pitting holes in the region where ordinary kernels are located, and the greater the credibility of the first kernel.

[0083] (2) Construct a grayscale curve of any suspected fruit kernel region, wherein the horizontal axis of the grayscale curve is the grayscale value and the vertical axis is the number of pixels corresponding to the grayscale value. Based on the fluctuation characteristics of the data in the grayscale curve, obtain the credibility of the second fruit kernel.

[0084] Specifically, the valley points in the grayscale curve are obtained using the AMPD algorithm. The AMPD algorithm is existing technology and will not be elaborated upon here. Because the grayscale values ​​of the area where the fruit pit is covered by pulp differ significantly from those of the area where the fruit pit is located, the grayscale curve... Figure 1 Generally, it exhibits a bimodal characteristic, meaning there is only one valley point. In special cases, the grayscale curve may not have a valley point, such as when the suspected fruit pit area is the area where a normal fruit pit is located (the fruit pit is completely separated) or a shaded area.

[0085] Therefore, if there are no valley points in the grayscale curve, it indicates that the suspected kernel area is the area where ordinary kernels are located (kernels are completely separated) or the shaded area, confirming that the credibility of the second kernel is a constant 0;

[0086] If there is only one valley point in the grayscale curve, then obtain the pixel point corresponding to each data point to the right of the valley point in the grayscale curve, and record it as the covered pixel point. Obtain the average grayscale value of all covered pixels to get the average covered grayscale value.

[0087] Clusters with gray levels greater than the gray level threshold are categorized as pulp regions. The average gray value of all pulp regions is obtained to get the average gray value of the region. The absolute value of the difference between the average gray value of the coverage and the average gray value of the region is calculated to obtain the degree of difference.

[0088] Construct a gray-level co-occurrence matrix for any suspected kernel region. Obtain gray-level feature values ​​based on the gray-level uniformity of the gray-level co-occurrence matrix. The gray-level uniformity of the gray-level co-occurrence matrix is ​​an existing technology and will not be elaborated here. Obtain the product of the degree of difference and the gray-level feature values. Perform inverse proportional normalization on the product to obtain the second kernel confidence level.

[0089] In one embodiment, taking the i-th suspected kernel region as an example, the formula for calculating the confidence level of the second kernel in the i-th suspected kernel region is:

[0090] ;

[0091] in, J represents the confidence level of the second kernel in the i-th suspected kernel region; J is the gray-scale feature value. Let m be the grayscale value of the m-th covered pixel; M is the number of covered pixels. The average grayscale value of the region; is the absolute value symbol; exp(-) is an exponential function with the natural constant as the base, used for inverse proportional normalization.

[0092] It should be noted that, To indicate the degree of difference, The smaller J is, the more similar the gray values ​​of the covered pixels are to the gray values ​​of the pulp area. In other words, the i-th suspected core area is more consistent with the characteristics of the core area covered by pulp, and the greater the confidence of the second core in the i-th suspected core area. The smaller J is, the larger the difference in gray values ​​of the pixels in the i-th suspected core area is. In other words, the gray value consistency is poor. The more consistent the i-th suspected core area is with the characteristics of the core area covered by pulp, the greater the confidence of the second core in the i-th suspected core area.

[0093] (3) Since the area where the fruit pit is located includes the area where the ordinary fruit pit is located and the area where the fruit pit is covered by the pulp, and each area where the fruit pit is located can only belong to one of the areas where the ordinary fruit pit is located and the area where the fruit pit is covered by the pulp, the maximum value between the first fruit pit confidence and the second fruit pit confidence is obtained, and the maximum value is taken as the fruit pit confidence of any suspected fruit pit area.

[0094] Furthermore, based on the reliability of the fruit pit, the interference of the shaded area on the area where the fruit pit is located is eliminated, and the method for screening the target area is as follows:

[0095] Based on historical experience, the kernel confidence threshold is set to 0.8. This is not a restriction and can be set according to the specific implementation scenario. If the kernel confidence of the i-th suspected kernel region is greater than or equal to 0.8, it means that the i-th suspected kernel region is more consistent with the characteristics of the region where ordinary kernels are located or the kernel region covered by pulp. Therefore, among all suspected kernel regions, suspected kernel regions with kernel confidence greater than or equal to the kernel confidence threshold are selected and recorded as target regions.

[0096] At this point, the target region in the target image, namely the region where the fruit pit is located, is obtained.

[0097] Step S104: Record any target area as the area to be delivered. Based on the gray value distribution characteristics of the pixels in the area to be delivered, obtain the seed points in the area to be delivered. Obtain the growth area of ​​each seed point according to the region growth algorithm to form the kernel area in the area to be delivered.

[0098] After obtaining the target region in the target image, seed points need to be placed within the target region, and then the kernel region in the target image is obtained through a region growing algorithm. Each target region is designated as the region to be grown. Since region growing is based on grayscale values ​​as a threshold for segmenting each region, and the kernel itself has pitting cavities, which have a certain grayscale difference from the kernel itself, region growing on seed points when there is a large grayscale difference may lead to incomplete region growing, resulting in inaccurate kernel region segmentation. Therefore, to ensure the completeness of kernel region growing, seed points need to be obtained within the region to be grown based on the grayscale distribution characteristics of the region to be grown, and then the kernel region within the region to be grown is obtained based on the seed points.

[0099] To better analyze the grayscale value distribution characteristics of the area to be advertised, a grayscale change curve of the area to be advertised is constructed. The horizontal axis of the grayscale change curve is the grayscale value, and the vertical axis is the number of pixels corresponding to the grayscale value. The peak and valley points of the grayscale change curve are obtained by the AMPD algorithm. The AMPD algorithm is an existing technology and will not be described in detail here.

[0100] Since the fruit pit itself has some pitting holes, and there is a certain gray level difference between the pitting holes and the fruit pit itself, in order to obtain the complete fruit pit area, the peak point, valley point, first data point and last data point of the gray level change curve are recorded as key points, and the pixel point corresponding to the gray level value of each key point is the initial seed point in the area to be deployed.

[0101] The global region growth threshold for region segmentation of the target image using a region growing algorithm is obtained. This threshold is user-defined; the present invention only improves the number and location of seed points, while the other steps of the region growing algorithm remain unchanged. It can be directly obtained here. If keypoints are simply used as seed points, the growth result is not ideal when twice the global region growth threshold is less than the difference in grayscale values ​​between the corresponding keypoints. For example, if two keypoints have grayscale values ​​of 5 and 35 respectively, and the global region growth threshold is 5, and each keypoint corresponds to only one seed point, then performing region growing on the two seed points will result in two growing regions. However, these two seed points should be within the same growing region. Therefore, for any keypoint, based on the difference in grayscale values ​​between the keypoint, its right adjacent keypoint, and the global region growth threshold, S target keypoints corresponding to the keypoint are obtained. These target keypoints are added between the keypoint and its right adjacent keypoint to prevent incomplete growth of the core region.

[0102] Specifically, the difference in grayscale value between the right adjacent key point of any key point and any key point is obtained and recorded as grayscale difference. The ratio of grayscale difference to the global growth region threshold of a preset multiple is calculated, and the ratio is rounded down to obtain S target key points corresponding to any key point.

[0103] In one implementation, taking the k-th key point as an example, the formula for calculating the number of S target key points corresponding to the k-th key point is:

[0104] ;

[0105] Where S is the number of S target key points corresponding to the k-th key point; This represents the grayscale value of the (k+1)th key point in the grayscale variation curve. represents the grayscale value of the kth keypoint in the grayscale change curve; C is the global region growth threshold; 2 is the preset multiplier. This is the floor symbol.

[0106] It should be noted that, For grayscale difference, The larger the value of S, the greater the difference in grayscale value between the k-th key point and the (k+1)-th key point in the grayscale change curve. This means that more seed points are needed for region growth, and thus S becomes larger.

[0107] Furthermore, for any one of the S target key points, the gray value of any target key point is obtained based on the difference between the global region growth threshold and the gray value corresponding to any key point.

[0108] Specifically, the S target key points corresponding to any one key point are numbered, and the product of the number of any one target key point by a preset multiple and the global region growth threshold is obtained to get the value to be increased. The gray value of any one key point and the value to be increased are added together to obtain the gray value of any one target key point.

[0109] In one embodiment, taking the x-th target key point corresponding to the k-th key point as an example, the formula for calculating the grayscale value of the x-th target key point corresponding to the k-th key point is as follows:

[0110] ;

[0111] in, This represents the grayscale value of the x-th target key point corresponding to the k-th key point; is the grayscale value of the k-th key point; x is the number of the target key point corresponding to the k-th key point; C is the global region growth threshold; 2 is the preset multiplier.

[0112] Obtain the grayscale value of each target key point corresponding to the k-th key point. The pixel corresponding to the grayscale value of each target key point is the seed point to be added corresponding to the k-th key point.

[0113] Based on the method for obtaining the seed points to be added corresponding to the kth key point, obtain the seed points to be added corresponding to each key point in the grayscale change curve, and use all the initial seed points and all the seed points to be added as seed points in the area to be deployed.

[0114] After obtaining all the seed points in the area to be distributed, the growth area of ​​each seed point is obtained according to the global region growth threshold and the region growth algorithm, forming the kernel region in the area to be distributed. The region growth algorithm is existing technology and will not be described in detail here.

[0115] At this point, the kernel area in the area to be placed is obtained.

[0116] Step S105: Obtain the area of ​​the fruit pit region in each area to be placed. Based on the area of ​​all fruit pit regions, determine the degree of stirring of the jujube to evaluate the fruit pit segmentation status of the jujube.

[0117] Based on the above method for obtaining the kernel area in the area to be placed, the kernel area in each area to be placed is obtained. Since there are areas where ordinary kernels are located and areas where kernels are covered by pulp in the target area, and the kernels of jujube are generally uniform in size and close to elliptical in shape, for any kernel area, the area of ​​the circumscribed ellipse of any kernel area is obtained and recorded as the actual kernel area. The degree of stirring of the jujube can be judged based on the difference between the area of ​​the kernel area and the actual kernel area.

[0118] The method for judging the degree of stirring of jujube based on the area difference between the pit area and the actual pit area is as follows:

[0119] Obtain the cumulative area of ​​all fruit pit regions to get the total fruit pit area. Obtain the cumulative area of ​​all actual fruit pit regions to get the total actual fruit pit area. Calculate the ratio of the total fruit pit area to the total actual fruit pit area to get the jujube separation ratio.

[0120] If the jujube separation ratio is greater than 0.9, it indicates that the kernel area is closer to the actual kernel area that should be obtained, confirming that the jujube has been thoroughly stirred. If the jujube separation ratio is less than or equal to 0.9, it indicates that the difference between the kernel area and the actual kernel area that should be obtained is greater, confirming that the jujube has not been thoroughly stirred. Here, 0.9 is the separation ratio threshold set in this embodiment. The separation ratio threshold needs to be set according to the separation integrity required by the user. The larger the threshold, the higher the required separation integrity. There is no restriction here, and it can be set according to the specific implementation scenario.

[0121] To prevent some fruit pits from being located at the bottom of the mixing device and resulting in insufficient mixing, when the separation ratio of jujubes in the target image is greater than 0.9, the mixing time of the mixing device is changed to 30 seconds and a photo is taken. When five consecutive target images are judged to be sufficiently mixed, it is confirmed that the pulp and pits of the jujubes in the mixing device are completely separated, and the staff is reminded that the next step can be carried out. When at least one of the five consecutive target images is judged to be insufficiently mixed, mixing needs to continue until it is confirmed that the pulp and pits of the jujubes in the mixing device are completely separated.

[0122] This invention involves acquiring images of stirred jujubes to obtain jujube images, performing grayscale processing on the jujube images to obtain target images, and segmenting the target images based on the grayscale value distribution characteristics of the pixels in the target images to obtain at least two suspected pit regions. For any suspected pit region, the pit confidence of the suspected pit region is obtained based on the grayscale change characteristics of the pixels in the suspected pit region. The pit confidence of each suspected pit region is obtained, and at least one target region is selected from all suspected pit regions based on the pit confidence of each suspected pit region. Any target region is designated as a region to be placed. Based on the grayscale value distribution characteristics of the pixels in the region to be placed, seed points are obtained in the region to be placed. The growth region of each seed point is obtained according to the region growing algorithm to form the pit region in the region to be placed. The area of ​​the pit region in each region to be placed is obtained. Based on the area of ​​all pit regions, the degree of stirring of the jujube is determined to evaluate the pit segmentation status of the jujube. Specifically, based on the grayscale distribution characteristics of pixels in the target image, the pulp region in the target image can be identified, eliminating interference from the pulp region. Then, based on the kernel confidence of the suspected kernel region, it can be identified whether the suspected kernel region is the shadow region between the pulp and the kernel in the target image, eliminating interference from the shadow region in the target image. Finally, based on the grayscale distribution characteristics of pixels in the region to be distributed, the seed points in the region to be distributed can be obtained more accurately, thus obtaining the kernel region. This makes the kernel region segmented by the region growing algorithm more accurate.

[0123] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. An image processing-based system for segmenting and extracting jujube pulp and pit images, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, The processor implements the following method when executing the computer program: Image acquisition is performed on the stirred Chinese jujube to obtain a Chinese jujube image, and the Chinese jujube image is subjected to grayscale processing to obtain a target image; According to the gray value distribution characteristics of the pixel points in the target image, the target image is segmented to obtain at least two suspected kernel regions; For any suspected kernel region, the kernel credibility of the suspected kernel region is obtained according to the gray value change characteristics of the pixel points in the suspected kernel region, the kernel credibility of each suspected kernel region is obtained, and at least one target region is screened from all suspected kernel regions according to the kernel credibility of each suspected kernel region; Any target region is recorded as a to-be-discharged region, and a seed point in the to-be-discharged region is obtained according to the gray value distribution characteristics of the pixel points in the to-be-discharged region, the growth region of each seed point is obtained according to a region growing algorithm, and a kernel region in the to-be-discharged region is formed; The area of the kernel region in each to-be-discharged region is obtained, and the stirring degree of the Chinese jujube is determined according to the areas of all kernel regions, so as to evaluate the kernel segmentation state of the Chinese jujube; According to the gray value change characteristics of the pixel points in the target image, the kernel credibility of the target image is obtained, including: A first kernel credibility is obtained according to the gray value difference between each pixel point in the suspected kernel region and the pixel points in the horizontal direction and the vertical direction of the suspected kernel region; A gray curve graph of the suspected kernel region is constructed, the horizontal axis of the gray curve graph is the gray value, and the vertical axis is the pixel number corresponding to the gray value, a second kernel credibility is obtained according to the fluctuation characteristics of the data in the gray curve graph; The maximum value between the first kernel credibility and the second kernel credibility is obtained, and the maximum value is taken as the kernel credibility of the suspected kernel region; According to the gray value difference between each pixel point in the suspected kernel region and the pixel points in the horizontal direction and the vertical direction of the suspected kernel region, the first kernel credibility is obtained, including: For any pixel point in the suspected kernel region, the gray values of all pixel points in the horizontal direction of the pixel point in the suspected kernel region are combined to form a horizontal gray value sequence, and the gray values of all pixel points in the vertical direction of the pixel point in the suspected kernel region are combined to form a vertical gray value sequence; The standard deviation of the horizontal gray value sequence is obtained, the change rate of each gray value in the horizontal gray value sequence is obtained, the target change rate whose change rate is not 0 is screened, the mean value of all target change rates is recorded as a change rate mean value, the product of the standard deviation and the change rate mean value is obtained, and the gray value change degree of the horizontal gray value sequence is obtained; The gray value change degree of the vertical gray value sequence is obtained, the mean value between the gray value change degree of the horizontal gray value sequence and the gray value change degree of the vertical gray value sequence is calculated, and the change degree of the pixel point is obtained; The mean value of the change degrees of all pixel points in the suspected kernel region is normalized to obtain the first kernel credibility; The second kernel credibility is obtained according to fluctuation characteristics of data in the gray scale graph, and the method comprises the following steps: A valley point in the gray scale graph is obtained, if there is only one valley point in the gray scale graph, then a pixel point corresponding to each data point on the right side of the valley point in the gray scale graph is obtained, which is recorded as a covered pixel point, an average gray scale value of all covered pixel points is obtained, and a covered average gray scale value is obtained; A cluster region with a gray scale level greater than a gray scale level threshold value is recorded as a pulp region, an average gray scale value of all pulp regions is obtained, a regional average gray scale value is obtained, and an absolute value of a difference between the covered average gray scale value and the regional average gray scale value is calculated, and a difference degree is obtained; A gray scale co-occurrence matrix of any suspected kernel region is constructed, a gray scale characteristic value is obtained according to gray scale uniformity of the gray scale co-occurrence matrix, a product of the difference degree and the gray scale characteristic value is obtained, and the product is inversely proportional to the normalized processing, and a second kernel credibility is obtained; If there is no valley point in the gray scale graph, then the second kernel credibility is confirmed as a constant 0.

2. The image processing-based jujube pulp pit image segmentation extraction system according to claim 1, characterized in that, The target image is segmented according to the gray scale value distribution characteristics of the pixel points in the target image, and at least two suspected kernel regions are obtained, and the method comprises the following steps: A two-dimensional rectangular coordinate system is constructed in the target image, coordinates of each pixel point in the target image are obtained according to the two-dimensional rectangular coordinate system, a three-dimensional feature vector of each pixel point is formed by combining the coordinates of each pixel point with the gray scale value thereof, clustering processing is performed on the pixel points in the target image according to the three-dimensional feature vector of each pixel point, at least two clusters are obtained, and at least two cluster regions are obtained according to the pixel points corresponding to each cluster; A gray scale histogram of the target image is constructed, a horizontal axis of the gray scale histogram is a gray scale level, and a vertical axis of the gray scale histogram is a pixel number corresponding to the gray scale level, a cumulative distribution function of each gray scale level in the gray scale histogram except for a maximum gray scale level and a minimum gray scale level is obtained, and a gray scale level corresponding to a minimum cumulative distribution function is taken as a gray scale level threshold value; For any cluster region, a gray scale level of an average gray scale value of the pixel points in the any cluster region in the gray scale histogram is obtained, which is recorded as a gray scale level of the any cluster region, if the gray scale level of the any cluster region is less than or equal to the gray scale level threshold value, then the any cluster region is recorded as a suspected kernel region; A gray scale level of each cluster region is obtained, and at least two suspected kernel regions are obtained according to the gray scale level of each cluster region. 3.The image processing-based jujube pulp pit image segmentation and extraction system according to claim 1, characterized in that, The target region is screened from all suspected kernel regions according to the kernel credibility of each suspected kernel region, and the method comprises the following steps: A kernel credibility threshold value is set, and suspected kernel regions with a kernel credibility greater than or equal to the kernel credibility threshold value are screened from all suspected kernel regions, and the suspected kernel regions are recorded as target regions.

4. The image processing-based date pulp pit image segmentation extraction system according to claim 1, characterized in that, The seed point in the region to be put is obtained according to the gray scale value distribution characteristics of the pixel points in the region to be put, and the method comprises the following steps: A gray scale change curve of the region to be put is constructed, a horizontal axis of the gray scale change curve is a gray scale value, and a vertical axis of the gray scale change curve is a pixel number corresponding to the gray scale value, a peak point and a valley point of the gray scale change curve are obtained; The peak point, the valley point, the first data point and the last data point of the gray scale change curve are recorded as key points, and the pixel point corresponding to the gray scale value of each key point is an initial seed point in the to-be-dropped region; A global region growing threshold for region segmentation of the target image by using a region growing algorithm is obtained, and for any key point, S target key points corresponding to the key point are obtained according to the gray scale value difference between the key point, its right adjacent key point and the global region growing threshold; For any target key point in the S target key points, the gray scale value of the target key point is obtained according to the difference between the global region growing threshold and the gray scale value corresponding to the target key point, and the gray scale value of each target key point is obtained, and the pixel point corresponding to the gray scale value of each target key point is a to-be-increased seed point corresponding to the target key point; The to-be-increased seed points corresponding to each key point are obtained, and all the initial seed points and all the to-be-increased seed points are taken as seed points in the to-be-dropped region.

5. The image processing-based jujube pulp pit image segmentation extraction system according to claim 4, characterized in that, The S target key points corresponding to the key point are obtained according to the gray scale value difference between the key point, its right adjacent key point and the global region growing threshold, including: The difference between the right adjacent key point of the key point and the gray scale value of the key point is recorded as a gray scale difference, the ratio of the gray scale difference to the global growing region threshold multiplied by a preset multiple is calculated, the ratio is subjected to a down-rounding process, and the S target key points corresponding to the key point are obtained. 6.The image processing-based jujube pulp pit image segmentation and extraction system according to claim 4, characterized in that, The gray scale value of the target key point is obtained according to the difference between the global region growing threshold and the gray scale value corresponding to the target key point, including: The S target key points corresponding to the key point are numbered, the product of the number of the target key point multiplied by the global region growing threshold and a preset multiple is obtained to obtain an to-be-increased value, and the addition result of the gray scale value of the key point and the to-be-increased value is obtained to obtain the gray scale value of the target key point.

7. The image processing-based date pulp pit image segmentation extraction system according to claim 1, characterized in that, The stirring degree of the jujube is determined according to the areas of all the core regions, including: For any core region, the area of the circumscribed ellipse of the core region is obtained and recorded as an actual core region; The cumulative value of the areas of all the core regions is obtained to obtain a total core area, the cumulative value of the areas of all the actual core regions is obtained to obtain a total actual core area, and the ratio of the total core area to the total actual core area is calculated to obtain a jujube separation ratio; If the jujube separation ratio is greater than a preset separation ratio threshold, it is determined that the jujube is stirred sufficiently, and if the jujube separation ratio is less than or equal to the preset separation ratio threshold, it is determined that the jujube is not stirred sufficiently.

Citation Information

Patent Citations

  • SAR remote-sensing image oil spilling detection and identification method

    CN104951799A

  • Gold ore mineral analysis method based on video analysis for a draw shaft

    CN112163631A