Crab rice mildew particle removing method and system based on image enhancement

CN123010554APending Publication Date: 2026-10-30TANGSHAN FENGNAN HONGFENG RICE IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611222283.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-12
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

然而,该方案仅依赖全局颜色阈值进行合格与否的二分类判定,未对米粒表面附着性霉变与内部侵染性变质进行差异化特征提取,也未建立霉变程度的量化分级模型

Benefits of technology

(1)本发明通过对原始图像进行边缘检测,分割得到环形表面区域和内部透射区域,分别提取色调异常的黄斑像素和透光率异常的黑心像素作为表面变色特征与内部变质特征。通过边缘检测将米粒图像分割为环形表面区域与内部透射区域,在空间上将两类霉变的发生区域物理隔离,使得表面区域的色调分析和内部区域的透光率分析互不干扰,实现了两类霉变特征的解耦提取,避免了特征间的相互干扰,为后续为霉变程度量化提供了多维特征基础。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123010554A_ABST
    Figure CN123010554A_ABST
Patent Text Reader

Abstract

The present application relates to crab field rice mildew grain removing technical field, disclose a kind of crab field rice mildew grain removing method and system based on image enhancement, the method includes obtaining crab field rice original image, extract surface discoloration feature and internal metamorphic feature;Two features are mapped to feature to obtain mildew degree numerical value, then pollution classification is carried out to obtain pollution grade.If it is mild pollution, extract morphological feature data to carry out trajectory parameter mapping;If it is severe pollution, extract surface feature data to carry out adhesion parameter mapping, obtain control data.Control data is parsed to generate dynamic adjustment instruction, execute spray removal and obtain preliminary screening crab field rice.The residual mildew detection is carried out to preliminary screening crab field rice, extracts residual mildew feature and generates reinspection signal to execute secondary removal, and obtains final screening crab field rice.The present application can realize high-precision removal of mildew crab field rice under mixed mildew state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of removing moldy grains from crab-farmed rice, and more particularly to an image-enhanced method and system for removing moldy grains from crab-farmed rice. Background Technology

[0002] Currently, crab-field rice, as a high-quality rice grown under an ecological farming model, has its quality and safety directly related to consumer health and industry development. The high humidity conditions in the crab-field growing environment make the rice highly susceptible to mold contamination during harvesting, storage, and processing. Moldy grains not only affect the appearance of the rice but may also produce harmful substances that threaten food safety. With the rapid development of image sensing technology, machine vision-based color sorting equipment has become the mainstream method for rice quality control. However, existing solutions still struggle to achieve accurate grading and removal when faced with mixed streams exhibiting significant differences in mold levels.

[0003] In a current technology, color sorting equipment uses an industrial camera to capture images of rice grains, extracts color features, and sets a fixed threshold to determine whether the grains are qualified. All abnormal grains are then removed using uniform airflow parameters. However, this approach relies solely on a global color threshold for binary classification, failing to extract differentiated features between surface-adherent mold and internal contamination, and lacking a quantitative grading model for the degree of mold. When lightly moldy grains show only slight surface discoloration, while heavily moldy grains are deeply contaminated internally, the uniform airflow parameters cannot match the removal intensity required for different contamination levels. Using uniform parameters, lightly moldy grains are excessively removed due to overly strong airflow, affecting surrounding normal grains and resulting in the loss of high-quality rice; heavily moldy grains suffer from insufficient airflow due to high peeling resistance, leading to residual contamination.

[0004] In summary, existing technologies suffer from insufficient removal accuracy in mixed mold conditions due to the lack of a refined grading mechanism for the degree of mold growth and a dynamic matching mechanism for differentiated removal parameters. Summary of the Invention

[0005] This invention provides a method and system for removing moldy grains from crab-field rice based on image enhancement, so as to achieve high-precision removal of moldy crab-field rice under mixed mold conditions.

[0006] In a first aspect, to solve the above-mentioned technical problems, the present invention provides a method for removing moldy grains from crab-field rice based on image enhancement, comprising: Obtain the original image of crab rice, and extract features from the original image to obtain surface discoloration features and internal deterioration features; Based on the surface discoloration characteristics and internal deterioration characteristics, feature mapping is performed to obtain the degree of mold growth numerical value. The degree of mold growth numerical value is then used to classify the pollution level to obtain the pollution grade. If the pollution level is light pollution, extract the morphological feature data of the crab rice, and perform trajectory parameter mapping based on the morphological feature data to obtain control data; If the pollution level is severe pollution, the adhesion strength of the adhering substances on the surface of the crab rice is extracted, the adhesion strength is mapped by adhesion parameters, the airflow intensity and response timing for peeling off the adhering substances are derived, and the data is encoded to obtain control data. The control data is parsed to generate a dynamic adjustment command. The trajectory of the crab rice is predicted to obtain a flight prediction trajectory. The dynamic adjustment command is corrected according to the flight prediction trajectory, and then the spraying and removal is performed to obtain the initial screened crab rice. The initial-screened crab-field rice is subjected to residual mold detection to obtain residual mold characteristics. Based on the residual mold characteristics, it is then removed a second time to obtain the final-screened crab-field rice.

[0007] Secondly, the present invention provides an image enhancement-based system for removing moldy grains from crab-field rice, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described above.

[0008] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.

[0009] Compared with the prior art, the present invention has the following beneficial effects: (1) This invention performs edge detection on the original image to segment it into an annular surface region and an internal transmission region. Yellow spots with abnormal hue and black spots with abnormal transmittance are extracted as surface discoloration features and internal deterioration features, respectively. By segmenting the rice grain image into an annular surface region and an internal transmission region through edge detection, the two types of mold occurrence regions are physically isolated in space. This ensures that the hue analysis of the surface region and the transmittance analysis of the internal region do not interfere with each other, thus achieving decoupled extraction of the two types of mold features and avoiding mutual interference between features. This provides a multi-dimensional feature basis for subsequent quantification of the degree of mold.

[0010] (2) This invention concatenates surface discoloration features and internal deterioration features into a fusion vector, which is then input into a fully connected neural network. Through step-by-step feature extraction and nonlinear transformation by the fully connected layers, discrete multidimensional pixel features are mapped to continuous mold degree values. Then, a preset threshold is used to classify the mold degree values ​​to obtain the contamination level. This establishes a clear boundary between mild surface mold and severe deep mold in the numerical space, providing a precise grading basis for subsequent differential removal. It achieves step-by-step quantification and grading from discrete pixel features to continuous values ​​and then to discrete levels, providing a precise grading basis for differential removal.

[0011] (3) This invention establishes trajectory parameter mapping and adhesion parameter mapping for different pollution levels. When the pollution is light, the target flight trajectory is obtained by flight simulation based on particle mass and initial settling velocity. A lower airflow intensity is matched to accurately blow away moldy particles. When the pollution is heavy, the peeling resistance and residence time are calculated based on the adhesion intensity. A higher airflow intensity and early triggering time are obtained by inversion to overcome strong adhesion. Combined with the re-inspection process, residual mold is detected in the primary screened crab field rice and a re-inspection rejection signal is generated to perform secondary rejection. This invention achieves simultaneous improvement in rejection accuracy and good product retention rate under mixed moldy conditions. Attached Figure Description

[0012] Figure 1 This is a schematic diagram of a method for removing moldy grains from crab-field rice based on image enhancement, provided in the first embodiment of the present invention. Detailed Implementation

[0013] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0014] Reference Figure 1 The first embodiment of the present invention provides a method for removing moldy grains from crab-field rice based on image enhancement, comprising the following steps: S11, Obtain the original image of crab rice, and extract features from the original image to obtain surface discoloration features and internal deterioration features; S12, perform feature mapping based on the surface discoloration characteristics and internal deterioration characteristics to obtain a mold degree value, and classify the mold degree value to obtain a pollution level. S13, if the pollution level is light pollution, extract the morphological feature data of the crab rice, and perform trajectory parameter mapping based on the morphological feature data to obtain control data; S14, if the pollution level is severe pollution, the adhesion strength of the adhering substances on the surface of the crab rice is extracted, the adhesion strength is mapped by adhesion parameters, the airflow intensity and response timing for peeling off the adhering substances are derived, and the data is encoded to obtain control data. S15, the control data is parsed to generate a dynamic adjustment command, the trajectory of the crab rice is predicted to obtain a flight prediction trajectory, the dynamic adjustment command is corrected according to the flight prediction trajectory, and then the spraying and removal is performed to obtain the initial screened crab rice. S16, perform residual mold detection on the initial screened crab field rice to obtain residual mold characteristics, and perform secondary rejection based on the residual mold characteristics to obtain final screened crab field rice.

[0015] In step S11, the rice grains are arranged in a single layer on the sorting conveyor belt and pass through the inspection station at a uniform speed. An imaging module consisting of an industrial camera and a backlight source is installed above the conveyor belt. The industrial camera is a global shutter color area array camera with a pixel resolution of 1920 x 1080, a frame rate of 200 frames per second, and a lens working distance of 150 mm. The backlight source is a 4500K color temperature LED flat panel light source, which uniformly illuminates the light-transmitting area below the conveyor belt, creating an imaging effect where the rice grains exhibit a superposition of front-reflected light and back-transmitted light in the camera's field of view. The camera continuously captures a color image each time a rice grain passes the trigger photoelectric sensor, obtaining the original image.

[0016] In one implementation, feature extraction is performed on the original image to obtain surface discoloration features and internal degradation features, including: The original image is filtered and denoised to obtain an enhanced image; Edge detection and segmentation are performed on the enhanced image to obtain the surface region and the internal transmission region; A color-changing pixel set is obtained by extracting hue anomalies from the surface region, and a color-changing pixel set is obtained by extracting transmittance anomalies from the internal transmission region. Feature extraction is performed on the set of color-changing pixels and the set of deteriorated pixels to obtain the surface color-changing features and the internal deterioration features.

[0017] It should be noted that after acquiring the original images of crab-field rice captured by an industrial camera in the mixed material flow, Gaussian filtering is applied to the images to remove dust noise caused by friction between rice grains and conveyor belt vibration. The Gaussian kernel size is set to 5×5, and the standard deviation is set to 1.5. This combination of parameters can completely preserve the gradient information of the rice grain contour edges while eliminating salt-and-pepper noise in the smoothing process of the translucent endosperm region of the crab-field rice. The filtering process performs a weighted average of each pixel and its 5×5 neighborhood pixels, with the weight distribution following a two-dimensional Gaussian function. Where x and y are the coordinate offsets of neighboring pixels relative to the center pixel, in pixels; σ is the standard deviation, taken as 1.5. The weight values ​​are calculated by substituting the coordinates of the 25 points within the neighborhood and normalized to obtain weighting coefficients. The gray values ​​of the neighboring pixels are then weighted and summed according to the weights, and the result is used as the filtered gray value of the center pixel, outputting an enhanced image with an improved signal-to-noise ratio of approximately 10dB.

[0018] Next, edge detection and segmentation are performed on the enhanced image. First, the horizontal and vertical gradients of each pixel in the enhanced image are calculated, and the square root of the sum of the squares of the two directions is taken to obtain the gradient magnitude. Then, non-maximum suppression is performed. The gradient magnitude of each pixel is compared with the gradient magnitude of its two neighboring pixels along the gradient direction. If the gradient magnitude of the pixel is not the maximum of the three, it is set to zero, thus refining coarse edges into candidate edges with a width of one pixel.

[0019] Next, the results after non-maximum suppression were processed using a dual-threshold hysteresis thresholding method, with a high threshold set to 120 and a low threshold set to 50. Pixels with gradient magnitudes greater than 120 were directly marked as strong edge points, while pixels with gradient magnitudes less than 50 were directly determined as non-edge points. Pixels with gradient magnitudes between 50 and 120 were retained as edge points if they were connected to the eight-neighborhood of a marked strong edge point; otherwise, they were discarded. This process yielded a closed rice grain contour boundary. The high threshold of 120 and the low threshold of 50 were determined by statistically analyzing the gradient magnitude distribution of edge pixels and background pixels in 500 crab-field rice sample images. The 5th percentile of the edge pixel gradient magnitude distribution was used as the low threshold, and the 50th percentile as the high threshold, ensuring that over 95% of the true edge pixel gradient magnitudes fall between the two thresholds, thus guaranteeing the continuity of contour extraction.

[0020] Furthermore, based on the extracted original contour boundaries, a geometric shrinkage strategy is employed to generate surface and internal transmission regions. The contour boundary is shrunk inward by 3 pixels, and the annular region between the shrunk boundary and the original contour is used as the surface region image. The width of this annular region corresponds to the average thickness of the rice grain skin, effectively capturing moldy patches attached to the rice grain surface. The central portion inside the original contour, after removing the surface region, is used as the internal transmission region image. Under backlighting conditions, this region primarily reflects the changes in light transmittance within the rice grain endosperm, characterizing deep defects such as internal black-heart deterioration.

[0021] It should be noted that during the extraction of tonal anomalies from surface area images, the surface area was converted from the RGB color space to the HSV color space, and the H-channel data of the tonal values ​​were extracted. The abnormal tonal range was set to 30° to 50°, which corresponds to the characteristic reflection peaks of Aspergillus flavus metabolites in the visible light band, serving as a general hue range to distinguish the normal milky white base color of crab-field rice from the early moldy yellow spots. Pixel-by-pixel, it was determined whether the H-channel value fell into the abnormal tonal range. Pixels falling into the range were marked as color-changing pixels, and the positions and numbers of all color-changing pixels were counted, outputting a set of color-changing pixels. Simultaneously, transmittance anomalies were extracted from the internal transmission area images. Under the condition of backlighting normalized to 255 gray levels, pixels with gray values ​​below 80 in the transmission image were identified as transmittance anomalies. This threshold was determined based on the statistical distribution of transmittance of normal crab-field rice endosperm under near-infrared backlight. The average gray value corresponding to the transmittance of normal grains is 140, and areas with transmittance below 80 correspond to a transmittance decrease of more than 40%, which can clearly characterize starch degradation and mycelial aggregation caused by internal mold. Extract all pixels with grayscale values ​​below 80 to form a set of degraded pixels.

[0022] It is worth noting that the feature extraction process employs a multi-dimensional fusion analysis method. For the discolored pixel set, its color moment features are extracted. Based on the first-order mean, second-order standard deviation, and third-order skewness of the hue channel, the fourth-order kurtosis of the hue channel is extracted to characterize the thickness of the color distribution tail. The difference between the peak hue value of the discolored pixel set and the baseline hue of normal rice grains is extracted to quantify the magnitude of the color shift. The percentage of the discolored area to the total surface area of ​​the rice grain is extracted to describe the extent of mold coverage. The baseline hue of normal rice grains is the average hue value of 100 consecutive high-quality rice grains before processing in that batch. The above six indicators are combined to form a 6×1 dimension surface discoloration feature vector, reflecting the concentration, coverage, and degree of shift in the color distribution of surface mold. For a set of degraded pixels, its transmittance statistical features are extracted. Based on the average gray value, maximum area of ​​connected components, and transmittance variation coefficient of the degraded pixels, the standard deviation of gray values ​​in the degraded region is extracted to reflect the non-uniformity of internal degradedness; the number of connected components is extracted to reflect the dispersion of the degraded region; and the contrast feature of the gray-level co-occurrence matrix is ​​extracted to characterize the roughness of the degraded texture. The contrast of the gray-level co-occurrence matrix is ​​obtained by statistically analyzing the mean of the sum of squared gray-level differences between adjacent pixels. These six indicators are combined into a 6×1 internal degraded feature vector, quantifying the degree, range, and texture characteristics of the internal black core degraded areas.

[0023] In step S12, the surface discoloration characteristics and internal deterioration characteristics are mapped to the degree of mold growth to obtain a numerical value for the degree of mold growth, including: The surface discoloration feature and the internal degradation feature are concatenated into a fusion vector; The fused vector is subjected to feature extraction and nonlinear transformation to obtain a dimension-reduced mapping vector; Perform a fully connected mapping on the reduced-dimensionality mapping vector to output the degree of mold growth.

[0024] It should be noted that when the surface discoloration features and internal degradation features are meshed, the surface discoloration features are 6×1 vectors, with each dimension corresponding to the first-order mean, second-order standard deviation, third-order skewness, fourth-order kurtosis, the difference between the peak hue and the reference hue, and the proportion of discoloration area. The internal degradation features are 6×1 vectors, with each dimension corresponding to the average gray value of the degradation pixel, the standard deviation of the gray value, the area of ​​the largest connected region, the proportion of connected regions, the contrast of the gray-level co-occurrence matrix, and the gray-level ratio of the degradation region to the normal region.

[0025] Two sets of feature vectors are concatenated in the order of surface color change features followed by internal degradation features to obtain a 12×1 one-dimensional fusion vector. This concatenated 12×1 fusion vector is then input into a pre-trained fully connected neural network. The network structure consists of an input layer, a first fully connected layer, a second fully connected layer, and an output layer. The input layer receives the 12-dimensional fusion vector. The first fully connected layer contains 32 output nodes, each fully connected to the 12-dimensional input vector. The 12-dimensional input undergoes a linear transformation—multiplying it by the trained weight matrix, adding a bias vector, and then passing it through a ReLU activation function—to output a 32-dimensional feature vector. The second fully connected layer contains 16 neurons, further mapping the 32-dimensional features to 16 dimensions. After processing with a ReLU activation function, it outputs a 16-dimensional reduced-dimensional vector. The output layer contains one neuron. After a fully connected mapping of the dimensionality reduction vector, the output is compressed to between 0 and 1 by the Sigmoid activation function. Multiplying the output by 100 yields an integer between 0 and 100 as the degree of mold. The larger the value, the more severe the mold.

[0026] This fully connected neural network obtains its weight parameters through pre-training. The pre-training dataset contains 20,000 samples of crab-field rice manually labeled with mold levels. Each sample is labeled with a mold level score from 0 to 100, and the average score is calculated after independent scoring by three quality inspectors. The samples are then randomly divided into training and validation sets in a 7:3 ratio. Before training, the Xavier uniform initialization method is used to initialize all weight parameters of the network, while the bias parameters are initialized to zero. During training, the training set samples are input into the network in batches. The predicted mold level values ​​are calculated through forward propagation. The mean squared error is used as the loss function to calculate the error between the predicted and labeled ground truth values. The gradient of each layer parameter is calculated through backpropagation. The Adam optimizer is used to update the network parameters to minimize the loss function. The initial learning rate is set to 0.001, the batch size is 64, and the training epochs are 100. After each epoch, the model performance is evaluated using the validation set. If the validation set loss does not decrease for 10 consecutive epochs, training is terminated early to prevent overfitting. The trained network had a root mean square error of 3.5 and a coefficient of determination R² of 0.96 for predicting the degree of mold on the validation set.

[0027] In one possible implementation, the degree of moldiness is classified into contamination levels to obtain contamination levels, including: If the degree of mold is less than the preset threshold, the corresponding pollution level is determined to be light pollution; if the degree of mold is greater than or equal to the preset threshold, the corresponding pollution level is determined to be heavy pollution.

[0028] It should be noted that the contamination level is determined by classifying the degree of mold by threshold values. When the degree of mold is less than the preset threshold, it indicates that the degree of mold in the crab field rice is relatively mild and is judged as slightly contaminated. When the degree of mold is greater than or equal to the preset threshold, it indicates that the degree of mold in the crab field rice is relatively severe and is judged as severely contaminated.

[0029] The preset boundary threshold is determined through the following steps: 10,000 grains of crab-field rice manually labeled as slightly contaminated and 10,000 grains manually labeled as heavily contaminated are input into a pre-trained fully connected neural network to obtain the degree of mold growth for each sample. The mold growth values ​​of all slightly contaminated samples are statistically analyzed, sorted from smallest to largest, and the value at the 95th percentile is taken as the upper limit of the slightly contaminated group. Similarly, the mold growth values ​​of all heavily contaminated samples are statistically analyzed, sorted from smallest to largest, and the value at the 5th percentile is taken as the lower limit of the heavily contaminated group. The upper limit of the slightly contaminated group and the lower limit of the heavily contaminated group are added together and divided by 2; the average value is the preset boundary threshold. This method ensures that more than 95% of the slightly contaminated samples are below this threshold and more than 95% of the heavily contaminated samples are above this threshold, maximizing the distinction between the two groups. In this embodiment, the threshold is 50.

[0030] In step S13, if the pollution level is light pollution, the morphological feature data of the crab-field rice is extracted, and trajectory parameter mapping is performed on the morphological feature data to obtain control data, including: If the pollution level is light pollution, perform morphological analysis on the lightly polluted crab rice to obtain particle mass and initial settling velocity. Flight simulation is performed based on the particle mass and the initial settling velocity to obtain the target flight trajectory, and spatial intersection is performed with the preset nozzle action area to obtain the target rejection coordinates; The target's coordinates are removed and distance is mapped to obtain the target's purge distance; The airflow intensity and response timing are obtained by fitting the target purge distance and the target flight trajectory. The airflow intensity and response timing are then encoded into commands to obtain control data.

[0031] It should be noted that when the pollution level is determined to be lightly polluted, the morphological feature data of the rice grains is extracted from the first image of crab-field rice to obtain its physical parameters. The morphological analysis process first extracts the pixel area and perimeter of the rice grain outline. The pixel area is obtained by counting the total number of pixels within the outline, with the unit being pixels. The perimeter is obtained by calculating the cumulative Euclidean distance of the outline boundary chain code. The pixel area and perimeter are then substituted into a multiple linear regression model to estimate the particle mass. This regression model is calibrated using experimental data from 1000 crab-field rice grains. During the calibration process, each grain was weighed using an analytical balance with an accuracy of 0.1 mg as the true value. A linear fit was performed with image pixel area and perimeter as independent variables and the true mass as the dependent variable. The goodness of fit R² was 0.94, accurately reflecting the mapping relationship between morphological parameters and particle mass. Simultaneously, the initial settling velocity is calculated by dividing the displacement difference of the centroid position of the same rice grain in two consecutive frames of images from a binocular vision sensor by the inter-frame time interval. The inter-frame time interval is determined by the camera frame rate; when the frame rate is set to 200 frames per second, the inter-frame interval is 5 milliseconds. The displacement difference is converted into physical distance using the Euclidean distance of the centroid pixel coordinates. For example, analyzing a slightly moldy rice grain from a crab-field farm, its particle mass can be estimated to be 22 mg, and its initial settling velocity to be 4 m / s.

[0032] Next, flight simulations were performed based on particle mass and initial settling velocity to obtain the target flight trajectory. Kalman filtering was used to estimate the state of the rice grains during free fall within the sorting chamber. A state-space model was constructed using particle mass, initial settling velocity, gravitational acceleration, and air resistance coefficient. The gravitational acceleration was taken as 9.8 m / s², and the air resistance coefficient was taken as 0.47 based on the ellipsoidal shape of the rice grains. The state-space model used the vertical position and vertical velocity of the rice grains as state variables, recursively predicting the spatial position at each sampling moment through discrete-time state transition equations. Kalman filtering simultaneously fused theoretical predictions with sensor observations, weighting and correcting for process and observation noise, outputting the target flight trajectory composed of multiple three-dimensional coordinate points. This trajectory contains the predicted spatial position sequence of the rice grains from entering the sorting chamber to reaching the nozzle's action area, with a time resolution of 5 milliseconds for the trajectory points.

[0033] The preset nozzle operating area is a spherical region with a radius of 30 mm and the nozzle outlet center as its center. This radius corresponds to the effective operating range of the nozzle under standard working pressure. During the spatial intersection process, it is determined whether the line connecting two adjacent points in the flight trajectory passes through this spherical region. When an intersection point is detected between the trajectory segment and the spherical surface, this intersection point is used as the target rejection coordinate, and the timestamp of the trajectory point corresponding to the intersection point is used as the rejection time reference. The calculated target rejection coordinate is expressed as a vertical distance with the nozzle outlet center as the origin. For example, the target rejection coordinate is 150 mm vertically from the nozzle outlet.

[0034] It should be noted that when performing distance mapping on the target rejection coordinates, a pre-calibrated spatial mapping database contains Euclidean distance values ​​from the center of the nozzle outlet to each spatial point within the sorting chamber. The calibration process uses a laser rangefinder to perform a gridded scan of the sorting chamber, measuring distance values ​​one by one on a 10mm-pitched three-dimensional grid to establish an index table of spatial coordinates and straight-line distances. The target rejection coordinates are then hash-searched in the index table to match the corresponding distance parameter, outputting the target purging distance. This distance represents the straight-line length required for the high-pressure airflow to travel from the nozzle outlet to the surface of the rice grain.

[0035] It should be noted that when calculating the airflow intensity based on the target purging distance, the value is obtained from a pre-calibrated curve showing the relationship between purging distance and airflow pressure. The calibration process was conducted under standard atmospheric pressure and a room temperature of 25°C. Eight different purging distance settings were selected: 20 mm, 30 mm, 40 mm, 50 mm, 60 mm, 70 mm, 80 mm, and 90 mm. At each distance setting, the minimum airflow pressure required to effectively deflect slightly moldy rice grains with a mass range of 15 to 30 mg was measured. Effective deflection refers to the lateral displacement of the rice grains under the influence of the airflow exceeding half the width of the separation channel. Each setting was tested 10 times, and the average airflow pressure was taken, resulting in eight pairs of distance and pressure data. A first-order linear fit was performed on the eight data sets using the least squares method. The fitted coefficients were 5.2 for the first term and 92.4 for the constant term, with a coefficient of determination (R²) of 0.97. The required airflow intensity was obtained by substituting the current target purging distance into the fitting formula. The response timing is calculated by subtracting the inherent response delay of the pneumatic actuator from the moment the grain reaches the target elimination coordinate. The inherent delay of the pneumatic actuator is obtained from the equipment specifications, with a typical value of 3 milliseconds. The airflow intensity and response timing are encoded according to fixed rules. The airflow intensity is first quantized into an 8-bit binary number with a precision of 0.5 kPa per unit. The duty cycle is the quantized value divided by 255 and then multiplied by 100%. The response timing is counted in milliseconds. The highest bit of the 8-bit count value is 0 for delayed triggering and 1 for early triggering. The remaining 7 bits represent the absolute millisecond count value. The two are combined to generate 16-bit control data.

[0036] In step S14, if the pollution level is severe pollution, the adhesion strength of the adhering substances on the surface of the crab rice is extracted, adhesion parameters are mapped onto the adhesion strength, the airflow intensity and response timing for peeling off the adhering substances are derived, and the data is encoded to obtain control data, including: If the pollution level is severe pollution, the adhesion parameters of the heavily polluted crab rice are extracted to obtain the adhesion strength. The peeling resistance is calculated based on the adhesion strength and the preset surface friction coefficient. The dwell time is obtained by deriving the dwell time based on the peeling resistance. Based on the dwell time, parameter inversion is performed to obtain the airflow intensity and response timing. The airflow intensity and response timing are then encoded into commands to obtain control data.

[0037] It should be noted that when the pollution level is determined to be heavily polluted, surface feature data of the rice grains are extracted from the first image of the crab-field rice to obtain the attachment parameters. The attachment parameter extraction process first involves binarizing and segmenting the surface area image. The segmentation threshold is set to a hue H channel value falling within the range of 30° to 50°. Pixels matching this hue range are marked as surface attachment pixels. The proportion of the total number of attachment pixels to the total number of pixels in the surface area is calculated as the coating area ratio, which reflects the degree of mold mycelium coverage on the rice grain surface. Simultaneously, the number of attachment pixels per unit area is directly counted as the distribution density, measured in pixels / mm. 2 This reflects the spatial aggregation characteristics of the attached material. The percentage of the wrapped area and the distribution density are normalized to the range of 0 to 1, with the normalization benchmark being the maximum value of the corresponding indicator in that batch of crab-field rice. The two normalized values ​​are then added together and scaled to a range of 0 to 500 to represent the adhesion strength, expressed in N / m². 2 .

[0038] It should be further explained that the surface deposits on the rice grains are considered as tangential forces acting on a curved surface. The peeling resistance is equal to the adhesion strength multiplied by the effective contact area of ​​the deposits, and then multiplied by the surface friction coefficient. The effective contact area of ​​the deposits is estimated by multiplying the percentage of the wrapped area by the total surface area of ​​the rice grains. The total surface area of ​​the rice grains is calculated using the ellipsoidal volume integral formula combined with the length and width dimensions of the outline. The surface friction coefficient is taken as 0.35, which corresponds to the typical static friction coefficient between fungal mycelium and the rice husk.

[0039] It is worth further clarification that the residence time is defined as the pulse duration required for a high-pressure airflow to continuously act on the surface of rice grains to peel off the attached material. A mapping relationship between peeling resistance and residence time was established through calibration experiments. During calibration, under a fixed airflow pressure of 200 kPa, airflow pulses of different durations were applied to standard samples with different peeling resistances. The moment when the attached material was completely peeled off was recorded using a high-speed camera. The shortest pulse duration for complete peeling was taken as the residence time corresponding to that peeling resistance. Ten test points were taken at intervals of 20 N / m², ranging from 20 N / m² to 200 N / m², for a total of 10 groups. Each group was repeated 5 times, and the average residence time was calculated to establish a lookup table between peeling resistance and residence time. During actual operation, the corresponding residence time was obtained by looking up the table based on the currently calculated peeling resistance. For example, for heavily moldy grains with a peeling resistance of 120 N / m², the residence time was found to be 8 milliseconds.

[0040] Then, when performing parameter inversion based on the residence time, the airflow intensity is obtained from the pre-calibrated residence time versus airflow pressure curve. The calibration process is conducted under standard atmospheric pressure and 25°C room temperature conditions, using simulated samples with standard adhesion strength as the test object. The sample adhesion strength is calibrated using a precision tensile tester. The airflow pressure is divided into 8 levels, from 100 kPa to 800 kPa, with 100 kPa intervals. The test is repeated 10 times at each pressure level, and the average residence time is taken, resulting in 8 pressure-time data pairs. The 8 data pairs are fitted using the least squares method with a quadratic polynomial, yielding a quadratic coefficient of -1.2, a linear coefficient of -45.3, and a constant of 982.6, with a fitting coefficient of determination R² of 0.98. The required residence time is substituted into the fitted curve to obtain the desired airflow intensity. The response timing is obtained by subtracting the residence time and the inherent delay of the solenoid valve from the moment the grain reaches the target removal coordinate. The inherent delay of the solenoid valve is obtained from the equipment specifications, with a typical value of 3 milliseconds. For example, for adhesion strength up to 85 N / m 2 The severely moldy particles had a calculated residence time of 8 milliseconds. The airflow intensity, determined from the curve, was 600 kPa, with a response timing of 11 milliseconds in advance. The airflow intensity and response timing were encoded according to a fixed rule. The airflow intensity was first quantized, converting the 0-800 kPa range into 8-bit binary numbers with a precision of 0.5 kPa per unit. The response timing was counted in milliseconds. The highest bit of the 8-bit count was set to 1 for early triggering and 0 for delayed triggering. The remaining 7 bits represented the absolute millisecond count, with a maximum representation of 127 milliseconds. The quantized airflow intensity value was filled into the high 8 bits of the 16-bit code, and the response timing count value was filled into the low 8 bits, combined into 16-bit control data.

[0041] In step S15, the control data is parsed to generate a dynamic adjustment command. The trajectory of the crab-field rice is predicted to obtain a predicted flight trajectory. After correcting the dynamic adjustment command based on the predicted flight trajectory, a blowing and removal process is performed to obtain the initial-screened crab-field rice. This includes: The control data is decoded to obtain the initial drive level and duty cycle; Obtain the response delay under the current operating condition, and compensate and reconstruct the initial drive level and the duty cycle based on the response delay to obtain the corrected level and the corrected duty cycle; Based on the correction level and the correction duty cycle, a dynamic adjustment instruction is generated. Perform a three-dimensional coordinate transformation on the surface discoloration feature to obtain the solid coordinates; The current falling speed of the crab rice is obtained, and the trajectory is predicted based on the entity coordinates and the falling speed to obtain the flight trajectory vector. The dynamic adjustment command is adjusted according to the flight trajectory vector, and the crab rice is removed to obtain the initial screened crab rice.

[0042] It should be noted that when decoding the control data, the high 8 bits of the 16-bit encoding are taken to restore the airflow intensity quantization value. The airflow intensity quantization value is multiplied by 800 and divided by 255 to obtain the airflow intensity in kPa. Then, based on the ratio between airflow intensity and drive level, i.e., the standard drive voltage of the solenoid valve is 24V, corresponding to a maximum output airflow of 800kPa, the initial drive level is obtained by multiplying 24V by the airflow intensity and dividing by 800. At the same time, the duty cycle is obtained by dividing the airflow intensity quantization value by 255.

[0043] Subsequently, the measured response delay under the current operating condition was obtained. The response delay is affected by the driving voltage and ambient temperature. A three-dimensional correction table of voltage-temperature-delay was established by pre-testing the response time of the solenoid valve under different voltage and temperature combinations. During testing, the voltage range was 20V to 30V, with a step size of 1V, for a total of 11 voltage points; the temperature range was 5℃ to 50℃, with a step size of 5℃, for a total of 10 temperature points, resulting in 110 sets of operating condition combinations. For each set of operating conditions, a high-speed camera recorded the time from the rising edge of the driving signal to the completion of the valve core displacement, at a sampling rate of 10,000 frames per second. Each set was measured 5 times, and the average value was taken as the response delay under that operating condition, which was then entered into the table at the intersection of the corresponding voltage and temperature. During actual operation, the current driving level and the ambient temperature collected by the temperature sensor were read, rounded to the nearest voltage and temperature scale in the table, and then the corresponding response delay was obtained by looking up the table.

[0044] Next, the drive level and duty cycle are reconstructed and compensated based on the response delay. The compensation amount is determined using pre-calibrated voltage correction curves and duty cycle correction curves, both calibrated at a constant temperature of 25°C. The voltage correction curve is calibrated with the solenoid valve's nominal response time of 7 milliseconds as a baseline. The delay is increased millisecond by millisecond, and the minimum drive voltage required for the valve core to complete its action within a specified time is recorded. The fitted correction voltage is equal to the initial voltage plus twice the delay deviation value, where the delay deviation is the current response delay minus 7 milliseconds. The duty cycle correction curve is calibrated under the same conditions. For every 1 millisecond increase in delay, the duty cycle is increased by 5 percentage points to maintain the equivalent energy obtained by the solenoid valve within the pulse cycle.

[0045] It should be noted that the instruction generation process converts the correction level into a quantized value of the controller's digital-to-analog converter. The conversion formula is: quantized value = correction level divided by reference voltage multiplied by the number of quantization levels. The reference voltage is taken as the controller's full-scale voltage of 5 volts, and the number of quantization levels is 12 bits, i.e., 4096 levels. The corrected duty cycle is then converted into a pulse width modulation waveform counting period value. The conversion formula is: counting period value = duty cycle multiplied by the total pulse period count divided by 100. The total pulse period count is determined by the controller's timer prescaler coefficient. The quantized value and counting period value are written into the register at the corresponding address of the field-programmable gate array controller. The controller generates a pulse width modulation waveform with a specific frequency and duty cycle according to the register configuration. After power amplification, the output is a dynamic adjustment instruction, which can directly drive the solenoid coil of the air valve to produce an opening and closing action of corresponding intensity.

[0046] It should be noted that the surface discoloration feature records the two-dimensional coordinates of the discoloration pixels in the image coordinate system. The center of the connected region with the highest density of discoloration pixels is extracted as the representative location of the heterochromatic lesion area. The coordinates of this center are obtained by calculating the arithmetic mean of the horizontal and vertical coordinates of all pixels in the connected region. The conversion process from two-dimensional image coordinates to three-dimensional physical space coordinates adopts affine transformation. The transformation matrix is ​​determined through the camera calibration process. During calibration, a checkerboard calibration plate with known dimensions of 20 mm intervals is used. Multi-angle images are acquired at the air nozzle action plane in the sorting chamber. The image coordinates of the checkerboard corner points are extracted using a corner detection algorithm, and a point-to-point mapping relationship is established with the corresponding physical coordinates. The parameters of the affine transformation matrix are solved using the least squares method. The center pixel coordinates of the discoloration area are multiplied by the affine transformation matrix to output the entity coordinates. For example, after the transformation, the entity coordinates of the center of the discoloration area of ​​a sample are 15 mm horizontally, 20 mm vertically, and 100 mm deep, with the origin located at the center of the air nozzle outlet.

[0047] The descent velocity is obtained by dividing the displacement difference of the same grain's centroid position in two consecutive frames of images from a binocular vision sensor by the frame interval, which is 5 milliseconds. The entity coordinates and descent velocity are input for trajectory prediction. The entity coordinates are used as the initial value of the state vector, and the descent velocity is used as the initial value of the velocity vector. The state-space model considers the effects of gravitational acceleration of 9800 mm / s² and air resistance, with an air resistance coefficient of 0.47. The predicted position for each future time step is recursively derived through the state transition equation, outputting a flight trajectory vector composed of the predicted three-dimensional coordinates for each time step. The trajectory vector contains information on the velocity direction and magnitude, representing the spatial motion trend of the grain within the future time window. For example, the current descent velocity is 3000 mm / s.

[0048] It is worth noting that during the adjustment of the dynamic adjustment command, the lateral offset distance between the predicted landing point position of the flight trajectory vector and the center line of the preset separation channel is first calculated. The receiving width of the preset separation channel is 50 mm. If the offset distance is greater than 25 mm, that is, the predicted landing point exceeds the channel boundary, thrust correction is triggered. The thrust correction adopts PID control logic, with the offset distance and offset change rate as inputs. It is established based on the empirical relationship between the nozzle thrust and the grain deflection angle. The proportional, integral, and derivative coefficients of the PID control are set to 2.0, 0.5, and 0.2, respectively. The calibration process of the coefficients is as follows: first, under standard operating conditions, the integral and derivative coefficients are fixed at zero. Starting from 0.5, the proportional coefficient is gradually increased in steps of 0.5. After each increase, a step signal corresponding to a fixed offset is input to the nozzle, and the grain deflection response is observed. The proportional coefficient value of 2.0 is selected so that the grain returns to the center line of the channel in the shortest time without obvious oscillation. Then, keeping the proportional coefficient constant at 2.0, the integral coefficient is gradually increased in increments of 0.1, observing the residual deviation of the grain from the channel centerline in steady state. The smallest integral coefficient value of 0.5 is selected, ensuring the residual deviation is within 0.5 mm. Finally, keeping both the proportional and integral coefficients constant, the derivative coefficient is gradually increased in increments of 0.05, observing the recovery speed of the grain after a momentary disturbance. The derivative coefficient value of 0.2 is selected, minimizing the recovery time and preventing high-frequency jitter. The PID calculation output thrust correction is converted into an airflow pressure increment, increasing the airflow pressure value in the original dynamic adjustment command. The adjusted command is updated and written to the controller register in real time, correcting the solenoid valve's drive level and pulse width. For example, when the predicted landing point deviation is too large, the airflow pressure can be dynamically increased from 600 kPa to 800 kPa. According to the adjusted dynamic adjustment command, the rejection action is executed. The solenoid valve opens according to the corrected timing and duty cycle, releasing a high-pressure airflow pulse that acts on the surface of the rice grains. The momentum of the airflow pulse is transferred to the lateral impulse of the rice grains through the fluid dynamics collision model, changing the original falling path of the rice grains so that they deviate from the main channel and fall into the waste trough. Normal rice grains in the main channel are not affected by the airflow and continue to fall along the original trajectory. In this way, the spray rejection is completed and the separated primary screened crab field rice is obtained.

[0049] In step S16, residual mold is detected in the initially screened crab-field rice to obtain residual mold characteristics. Based on these residual mold characteristics, a second round of removal is performed to obtain the final screened crab-field rice, including: The mold distribution of the pre-screened crab-field rice was identified to obtain a mycelial distribution matrix; Connectivity analysis was performed on the hyphal distribution matrix to obtain the area of ​​abnormal aggregation; If the area of ​​the abnormal cluster is not greater than the preset residual threshold, then no re-inspection and removal will be performed; If the abnormal aggregation area is greater than the preset residual threshold, the mold coordinates are extracted according to the mycelial distribution matrix to obtain the residual mold characteristics; Based on the residual mold characteristics, the arrival time is predicted and a re-inspection rejection signal is generated. A second rejection is performed based on the re-inspection rejection signal to obtain the final screened crab field rice.

[0050] It should be noted that when identifying mold distribution in the initially screened crab-field rice, the rice is guided to the detection area of ​​the near-infrared photoelectric sensor via a conveyor. The near-infrared photoelectric sensor uses a linear array scanning method, with a light source wavelength covering the near-infrared band from 900 nm to 1700 nm. This band corresponds to the characteristic absorption bands of chemical components in rice, such as moisture, starch, and aflatoxin metabolites. The sensor collects spectral reflectance data for each grain of rice in a row-scanning manner, with a row spacing of 0.2 mm, outputting a two-dimensional initial scan signal matrix. Continuous wavelet transform is performed on the initial scan signal to smooth noise and correct baseline drift. The Mexican Hat wavelet basis function is selected, with a scale parameter set to 4. This parameter reduces high-frequency noise power by approximately 15 dB while preserving the shape of the characteristic absorption peaks. After wavelet transform processing, characteristic absorption peaks are extracted near 1200 nm and 1450 nm. These two wavelengths correspond to the second and first overtone absorptions of the carbon-hydrogen bonds in the aflatoxin B1 molecule, respectively, and are characteristic spectral fingerprints for identifying mold metabolites. For each characteristic absorption peak, three parameters are extracted: center wavelength, peak intensity, and full width at half maximum (FWHM), which are used to form a mold growth feature vector.

[0051] Next, the mold feature vectors are spatially mapped to the two-dimensional contour coordinates of the initially screened crab-field rice to generate a mycelial distribution matrix. The spatial mapping uses each extracted mold feature vector as a known sampling point and each pixel grid point within the contour coordinate range as an interpolation point. The interpolation weight is calculated as the reciprocal of the Euclidean distance between the interpolation point and the sampling point, with a distance exponent of 2. Interpolation expands the discrete mold feature vectors to a continuous spatial distribution, outputting a mycelial texture distribution matrix of size 64 x 64 pixels. Each element in the matrix represents the mold infection depth index at the corresponding physical location, ranging from 0 to 255. Higher values ​​indicate deeper mycelial invasion at that location. This matrix resolution corresponds to a physical scale of approximately 0.1 mm x 0.1 mm on the surface of a single crab-field rice grain, capable of resolving sub-millimeter-level mycelial distribution features.

[0052] Then, connected component analysis uses pixels with element values ​​greater than 150 in the matrix as seed points. This threshold is calculated based on the maximum transmittance of normal crab-field rice endosperm in the near-infrared band. The transmittance of normal grains corresponds to an average matrix element value of 80, and 150 corresponds to a severely moldy area with a transmittance decrease of more than 45%. During region growth, an 8-neighborhood is used as the search range, and adjacent pixels with element values ​​greater than 150 are grouped into the same connected component. The growth stops when there are no pixels in the neighborhood that meet the threshold. After traversing all pixels in the matrix, the total number of pixels contained in each connected component is counted, and the number of pixels in the largest connected component is taken as the abnormal aggregation area. The preset residual threshold is set to 120 pixels. This threshold is determined by statistical analysis of the mycelial distribution matrix of 3000 normal crab-field rice samples. The 95th percentile of the pseudo-abnormal connected component area caused by the natural texture of the endosperm in normal samples is 115 pixels. After rounding and adding an engineering margin of 5 pixels, it is set to 120.

[0053] It should be noted that if the current abnormal cluster area is no greater than the preset residual threshold, it can be considered that the mold residue in the crab-field rice after the first rejection has been fully removed, and the quality has met the standards. Therefore, there is no need to perform a second rejection, and this initially screened crab-field rice can be directly used as the final screened crab-field rice. If the current abnormal cluster area is greater than the preset residual threshold, it indicates that there are deep-seated residual mold mycelia inside the initially screened crab-field rice, and a re-inspection and rejection process needs to be triggered. When extracting mold coordinates based on the mycelium distribution matrix, the connected region with the largest abnormal cluster area is taken as the object, and the arithmetic mean of the horizontal and vertical coordinates of all pixels in the connected region is calculated as the mold core location. The row and column indices of the core location in the 64x64 matrix are converted into the horizontal and vertical offsets of the physical coordinate system. At the same time, the sum of the pixel element values ​​in the connected region is extracted as the mold cumulative intensity index. The physical coordinates of the mold core location and the mold cumulative intensity are combined into residual mold features, which are used for parameter calculation of the subsequent re-inspection and rejection signal.

[0054] Next, the real-time position and motion parameters of the crab-field rice on the current conveyor belt are acquired. The conveyor belt speed is constantly set at 2000 mm / s, and real-time displacement data is synchronously provided by the encoder pulse signal. Using the physical coordinates of the mold core location in the residual mold characteristics as the initial position and the conveyor belt speed as the uniform motion parameter, the estimated arrival time required for the mold core location to reach directly below the pneumatic nozzle is calculated using linear kinematic equations. The estimated arrival time is equal to the longitudinal distance from the mold core location to directly below the nozzle divided by the conveyor belt speed. After obtaining this time, the inherent mechanical response delay time of the pneumatic solenoid valve is subtracted to calculate the trigger timestamp of the re-inspection rejection signal. The inherent response delay of the solenoid valve is 3 milliseconds, a value given in the solenoid valve's manufacturer's specifications and confirmed by high-speed camera re-testing. The calculated trigger timestamp and the preset pulse width are encoded into a re-inspection rejection signal. The signal format is 16-bit binary data, with the first 8 bits representing the count value of the timer corresponding to the trigger timestamp and the last 8 bits representing the count value of the timer corresponding to the pulse width. For example, if a grain of rice that needs to be re-inspected has an estimated arrival time of 450 milliseconds, subtracting the valve response delay, a re-inspection rejection signal with a trigger timestamp of 435 milliseconds and a pulse width of 10 milliseconds can be generated.

[0055] It is worth noting that the re-inspection rejection signal, after being analyzed by the controller, is output to the solenoid valve drive circuit of the pneumatic nozzle. The drive circuit outputs a drive level to the solenoid valve coil according to the trigger timestamp and pulse width. After the solenoid valve opens, it releases a high-pressure airflow pulse. The airflow pressure is set according to the control parameters corresponding to heavy contamination. The airflow pulse acts on the surface of the crab field rice with residual mold characteristics, and under the action of lateral thrust, pushes the rice grains out of the main channel and into the waste trough. Normal rice grains without detected residual mold characteristics are not disturbed by the airflow and continue to move along the original conveyor belt trajectory into the finished product collection trough, finally obtaining the final screened crab field rice after re-inspection rejection.

[0056] In summary, this invention discloses a method for removing moldy grains from crab-field rice based on image enhancement. The method includes acquiring an original image of the crab-field rice, extracting features from the original image to obtain surface discoloration features and internal spoilage features; performing feature mapping based on the surface discoloration features and internal spoilage features to obtain a mold degree value; classifying the mold degree value into a pollution level; if the pollution level is mild, extracting morphological feature data of the crab-field rice, and performing trajectory parameter mapping based on the morphological feature data to obtain control data; if the pollution level is severe, then extracting... The adhesion strength of the adhering substances on the surface of the crab-field rice is analyzed. Adhesion parameters are mapped to this adhesion strength to derive the airflow intensity and response timing for removing the adhering substances, and this data is encoded to obtain control data. The control data is then parsed to generate dynamic adjustment commands. The trajectory of the crab-field rice is predicted to obtain a flight prediction trajectory. After correcting the dynamic adjustment commands based on the flight prediction trajectory, a blowing process is performed to remove the moldy rice, resulting in a primary screen of crab-field rice. The primary screened crab-field rice is then subjected to residual mold detection to obtain residual mold characteristics. A secondary removal process is performed based on these residual mold characteristics to obtain a final screen of crab-field rice. This invention achieves high-precision removal of moldy crab-field rice under mixed mold conditions by extracting and quantifying mold characteristics, dynamically adjusting valve parameters according to the pollution level, and conducting residual re-inspection.

[0057] The second embodiment of the present invention provides an image enhancement-based system for removing moldy grains from crab-field rice, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described above.

[0058] It should be noted that the image enhancement-based moldy grain removal system for crab-field rice provided in this embodiment of the invention is used to execute all the process steps of the image enhancement-based moldy grain removal method for crab-field rice in the above embodiment. The working principles and beneficial effects of the two are one-to-one, so they will not be described again.

[0059] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.

[0060] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.

Claims

1. A method for removing moldy grains from crab-field rice based on image enhancement, characterized in that, include: Obtain the original image of crab rice, and extract features from the original image to obtain surface discoloration features and internal deterioration features; Based on the surface discoloration characteristics and internal deterioration characteristics, feature mapping is performed to obtain the degree of mold growth numerical value. The degree of mold growth numerical value is then used to classify the pollution level to obtain the pollution grade. If the pollution level is light pollution, extract the morphological feature data of the crab rice, and perform trajectory parameter mapping based on the morphological feature data to obtain control data; If the pollution level is severe pollution, the adhesion strength of the adhering substances on the surface of the crab rice is extracted, the adhesion strength is mapped by adhesion parameters, the airflow intensity and response timing for peeling off the adhering substances are derived, and the data is encoded to obtain control data. The control data is parsed to generate a dynamic adjustment command. The trajectory of the crab rice is predicted to obtain a flight prediction trajectory. The dynamic adjustment command is corrected according to the flight prediction trajectory, and then the spraying and removal is performed to obtain the initial screened crab rice. The initial-screened crab-field rice is subjected to residual mold detection to obtain residual mold characteristics. Based on the residual mold characteristics, it is then removed a second time to obtain the final-screened crab-field rice.

2. The method for removing moldy grains from crab-field rice based on image enhancement according to claim 1, characterized in that, The step of extracting features from the original image to obtain surface discoloration features and internal degradation features includes: The original image is filtered and denoised to obtain an enhanced image; Edge detection and segmentation are performed on the enhanced image to obtain the surface region and the internal transmission region; A color-changing pixel set is obtained by extracting hue anomalies from the surface area, and a color-changing pixel set is obtained by extracting transmittance anomalies from the internal transmission area. Feature extraction is performed on the set of color-changing pixels and the set of deteriorated pixels to obtain the surface color-changing features and the internal deterioration features.

3. The method for removing moldy grains from crab-field rice based on image enhancement according to claim 1, characterized in that, The process of mapping the surface discoloration characteristics and internal deterioration characteristics to obtain a mold degree value includes: The surface discoloration feature and the internal degradation feature are concatenated into a fusion vector; The fused vector is subjected to feature extraction and nonlinear transformation to obtain a dimension-reduced mapping vector; Perform a fully connected mapping on the reduced-dimensionality mapping vector to output the degree of mold growth.

4. The method for removing moldy grains from crab-field rice based on image enhancement according to claim 1, characterized in that, The pollution level is determined by classifying the degree of mold growth into pollution levels, including: If the degree of mold is less than the preset threshold, the corresponding pollution level is determined to be light pollution; if the degree of mold is greater than or equal to the preset threshold, the corresponding pollution level is determined to be heavy pollution.

5. The method for removing moldy grains from crab-field rice based on image enhancement according to claim 1, characterized in that, If the pollution level is light pollution, then the morphological feature data of the crab-field rice is extracted, and trajectory parameter mapping is performed on the morphological feature data to obtain control data, including: If the pollution level is light pollution, morphological analysis is performed on the lightly polluted crab rice to obtain morphological characteristic data, which includes particle mass and initial settling velocity. Flight simulation is performed based on the morphological feature data to obtain the target flight trajectory, and spatial intersection is performed with the preset nozzle action area to obtain the target elimination coordinates; The target's coordinates are removed and distance is mapped to obtain the target's purge distance; The airflow intensity and response timing are obtained by fitting the target purge distance and the target flight trajectory. The airflow intensity and response timing are then encoded into commands to obtain control data.

6. The method for removing moldy grains from crab-field rice based on image enhancement according to claim 1, characterized in that, If the pollution level is severe pollution, the adhesion strength of the adhering substances on the surface of the crab-field rice is extracted, adhesion parameters are mapped onto the adhesion strength, the airflow intensity and response timing for peeling off the adhering substances are derived, and the data is encoded to obtain control data, including: If the pollution level is severe pollution, the adhesion parameters of the heavily polluted crab rice are extracted to obtain the adhesion strength. The peeling resistance is calculated based on the adhesion strength and the preset surface friction coefficient. The dwell time is obtained by deriving the dwell time based on the peeling resistance. Based on the dwell time, parameters are inverted to obtain the airflow intensity and response timing; The airflow intensity and the response timing are encoded into commands to obtain control data.

7. The method for removing moldy grains from crab-field rice based on image enhancement according to claim 1, characterized in that, The process of parsing the control data to generate dynamic adjustment commands, predicting the trajectory of the crab-field rice to obtain a predicted flight trajectory, correcting the dynamic adjustment commands based on the predicted flight trajectory, and then performing spraying and removal to obtain initially screened crab-field rice includes: The control data is decoded to obtain the initial drive level and duty cycle; Obtain the response delay under the current operating condition, and compensate and reconstruct the initial drive level and the duty cycle based on the response delay to obtain the corrected level and the corrected duty cycle; Based on the correction level and the correction duty cycle, a dynamic adjustment instruction is generated. Perform a three-dimensional coordinate transformation on the surface discoloration feature to obtain the solid coordinates; The current falling speed of the crab rice is obtained, and the trajectory is predicted based on the entity coordinates and the falling speed to obtain the flight trajectory vector. The dynamic adjustment command is adjusted according to the flight trajectory vector, and the crab rice is removed to obtain the initial screened crab rice.

8. The method for removing moldy grains from crab-field rice based on image enhancement according to claim 1, characterized in that, The process involves detecting residual mold in the initially screened crab-field rice to obtain residual mold characteristics, followed by secondary rejection based on these characteristics to obtain the final screened crab-field rice, including: The mold distribution of the pre-screened crab-field rice was identified to obtain a mycelial distribution matrix; Connectivity analysis was performed on the hyphal distribution matrix to obtain the area of ​​abnormal aggregation; If the abnormal aggregation area is greater than the preset residual threshold, the mold coordinates are extracted according to the mycelial distribution matrix to obtain the residual mold characteristics; Based on the residual mold characteristics, the arrival time is predicted and a re-inspection rejection signal is generated. A second rejection is performed based on the re-inspection rejection signal to obtain the final screened crab field rice.

9. A system for removing moldy grains from crab-field rice based on image enhancement, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method according to any one of claims 1 to 8.

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