Method for detecting transparency of rice appearance quality

By eliminating rice motion blur through dual-optical-path alternating synchronous image acquisition and optical flow estimation algorithms, and combining radial sampling and light intensity ratio criteria, high-precision rice transparency detection was achieved. This solved the problems of low detection efficiency and large error in existing technologies, and met the high-precision and high-speed online detection requirements of modern rice processing.

CN122468673APending Publication Date: 2026-07-28SHENYANG AGRI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENYANG AGRI UNIV
Filing Date
2026-06-30
Publication Date
2026-07-28

AI Technical Summary

Technical Problem

Existing methods for detecting rice transparency suffer from low detection efficiency, large errors, and high false positive rates, making it difficult to meet the high-precision and high-speed online detection needs of the modern rice processing industry.

Method used

The system employs dual-optical-path alternating synchronous image acquisition, combined with optical flow estimation algorithm and Wiener deconvolution operation to eliminate motion blur, and distinguishes the transparency of rice grains through radial sampling and light intensity ratio criteria, thereby achieving sub-pixel-level peak positioning and transparency level determination.

Benefits of technology

It achieves high-speed online detection of over 1000 grains per second, with high grading accuracy, ensuring the stability and consistency of rice processing quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122468673A_ABST
    Figure CN122468673A_ABST
Patent Text Reader

Abstract

The present application relates to the field of optical detection technology, specifically to a kind of rice appearance quality transparency detection method, comprising the following steps: obtaining the continuous multiple frames of double light path alternate synchronous images of high-speed moving rice grain, calling lightweight pyramid light flow model to calculate dense optical flow field, construct spatial uniform point spread function per rice grain, execute wiener deconvolution to eliminate motion blur and take multiple frame average to obtain clear image;With the geometric center of rice grain as origin, sample along multiple radial directions to generate one-dimensional transmission scattering difference sequence, search to obtain sub-pixel level peak feature by residual sum of squares minimization;Calculate global light intensity ratio to remove chalky, crack interference sample, and output final transparency grade by table lookup mapping.The present application eliminates high-speed motion light intensity distortion and single light path high misjudgment by double light path feature fusion and per rice grain adaptive deblurring, improves grading accuracy by combining sub-pixel detection, and guarantees the stability and consistency of per second thousand grain level detection in industrial assembly line.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of optical inspection technology, and in particular to a method for detecting the transparency of rice appearance quality. Background Technology

[0002] Rice transparency directly reflects the density of starch granules inside the endosperm. Traditional rice transparency testing mainly relies on manual visual inspection. Testers lay rice grains flat under a standard light source box to compare them with standard rice samples for grading. This method has drawbacks such as strong subjectivity, low testing efficiency, large error fluctuations, and high labor intensity. Long-term work can easily cause visual fatigue, further reducing the testing accuracy and making it difficult to meet the needs of large-scale and automated production in the modern rice processing industry.

[0003] Existing machine vision inspection methods mostly employ single-path transmission imaging, determining the grade by calculating the average transmitted light intensity of the entire rice grain. However, this approach has shortcomings in high-speed production line scenarios: the directional blurring caused by the high-speed movement of rice grains leads to severe distortion in light intensity measurement; a single transmitted light intensity feature cannot distinguish between normal low-transparency rice grains and defective samples such as chalkiness or internal cracks, resulting in a high false positive rate; furthermore, the feature extraction method based on the average light intensity of the entire grain is insufficient to reflect the spatial distribution information of transparency within the rice grain, failing to meet the requirements of fine grading and hindering the improvement of rice processing quality. Therefore, developing a high-precision, high-speed, and interference-resistant online detection method for rice transparency has become an urgent technical problem to be solved in this field. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of the existing technology and propose a method for detecting the transparency of rice appearance quality.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: a method for detecting the transparency of rice appearance quality, comprising the following steps:

[0006] S1: Acquire continuous multi-frame dual-optical-path alternating synchronous images of high-speed moving rice grains. Calculate the dense motion displacement vector of all frames relative to the reference frame using an optical flow estimation algorithm. Based on this, construct a spatially uniform point diffusion function for each rice grain region. Perform blur deconvolution correction on each frame image. Take the pixel average of the corrected multi-frame images to obtain a clear transmission image and a clear scattering image.

[0007] S2: Perform noise reduction filtering and adaptive threshold segmentation on the clear transmission image and clear scattering image respectively, extract the rice grain contour, remove overlapping, incomplete edge rice grains and impurity samples, and obtain the transmission area image and scattering area image of the effective rice grains.

[0008] S3: Taking the geometric center of the rice grain as the origin, sample pixel by pixel along multiple uniformly distributed radial directions, calculate the difference between the transmitted light intensity and the scattered light intensity after correction by the pre-calibrated light intensity balance coefficient at each sampling point, and sort and splice them according to the radial distance to generate a one-dimensional transmission and scattering difference sequence.

[0009] S4: Smooth the one-dimensional transmission and scattering difference sequence and locate the initial peak point. Construct a local fitting interval with the initial peak point as the center. Search for the position with the minimum sum of squared residuals along the radial direction with a set step size. Output the sub-pixel level peak position and the corresponding peak difference.

[0010] S5: Read the pre-calibrated feature level mapping table, convert the peak difference and peak position into transparency level; calculate the global light intensity ratio of the transmission area and the scattering area, remove chalky and cracked interference samples according to the ratio range, output the final transparency level of the effective rice grains and associate it with the rice grain number.

[0011] As a further aspect of the present invention, the process of acquiring the clear transmission image and the clear scattering image is specifically as follows:

[0012] S101: A global shutter industrial camera is used to alternately and synchronously trigger the acquisition of multiple consecutive frames of transmission and scattering images of rice grains at a set frame rate, thereby obtaining a transmission image sequence and a scattering image sequence. The transmission image is acquired by illumination from a bottom front transmission light source, and the scattering image is acquired by illumination from a side scattering light source installed at a set tilt angle. The two light sources are synchronously triggered with the industrial camera, and the time difference between two adjacent acquisitions is less than a set threshold.

[0013] S102: For the transmission image sequence and the scattering image sequence respectively, call the pre-trained lightweight optical flow estimation model, take the middle frame of the corresponding sequence as the reference frame, calculate the dense optical flow field of all frames in the sequence relative to the reference frame, and obtain the average motion displacement vector data of each grain region.

[0014] S103: Based on the average motion displacement vector data, construct a spatially uniform point diffusion function for each grain region, perform Wiener deconvolution operation on each frame of the transmission image sequence and the scattering image sequence to eliminate motion blur, take the average gray level of each frame at the corresponding pixel position, and output a clear transmission image and a clear scattering image.

[0015] As a further aspect of the present invention, the process of acquiring the transmission region image and scattering region image of the effective rice grains is specifically as follows:

[0016] S201: Perform median filtering on the clear transmission image and the clear scattering image respectively to remove salt and pepper noise, and use an adaptive threshold segmentation algorithm to binarize the denoised image to extract the contour region of the rice grains;

[0017] S202: Calculate the grain area parameter, aspect ratio parameter, and grayscale variance parameter for each contour region. Compare the grain area parameter with a set area threshold, compare the aspect ratio parameter with a set aspect ratio range, and compare the grayscale variance parameter with a set grayscale variance range.

[0018] S203: Remove broken rice areas with an area lower than the set area threshold, abnormal areas with an aspect ratio exceeding the set aspect ratio range, and impurity areas with a gray-scale variance exceeding the set gray-scale variance range. Retain valid areas that meet the criteria for determining complete rice grains, and output the transmission area image and scattering area image of the valid rice grains.

[0019] As a further aspect of the present invention, the generation process of the one-dimensional transmission and scattering difference sequence is specifically as follows:

[0020] S301: Extract the coordinates of the geometric center point of the effective region, establish a radial sampling reference axis with the geometric center point as the origin, and generate radial sampling lines along 8-32 uniformly distributed directions;

[0021] S302: Read the transmitted light intensity value and scattered light intensity value at the corresponding position pixel by pixel along each radial sampling line from the contour edge to the center point, and calculate the difference feature value at each sampling point, wherein the difference feature value is equal to the transmitted light intensity value minus the product of the light intensity balance coefficient and the scattered light intensity value, and the light intensity balance coefficient is obtained by one-time calibration using a standard transparency meter sample.

[0022] S303: Sort the difference feature values ​​of all sampling points in each radial direction in a unified manner according to the radial distance from the sampling point to the center point from far to near, and splice them to generate a one-dimensional transmission and scattering difference sequence.

[0023] As a further aspect of the present invention, the process of obtaining the sub-pixel level peak position and peak difference is specifically as follows:

[0024] S401: Perform a moving average smoothing process with a window width of 3-7 pixels on the one-dimensional transmission and scattering difference sequence, traverse the smoothed sequence to find the position with the maximum difference feature value, and take this position as the initial peak point;

[0025] S402: Construct a local fitting interval by taking 2-4 pixels to the left and right of the initial peak point as the center, and calculate the sum of squared residuals between the sequence values ​​and the fitted line within the local fitting interval;

[0026] S403: Move the center of the fitting interval point by point within a set range to the left and right of the initial peak point with a set step size, repeatedly calculate the sum of squared residuals corresponding to each candidate position, stop the search when the sum of squared residuals reaches the minimum value, output the candidate position as the sub-pixel level peak position, extract the difference feature value corresponding to the position as the peak difference value, and output the sub-pixel level peak position and the peak difference value together.

[0027] As a further aspect of the present invention, the process of moving the center of the fitting interval point by point within a set range to the left and right of the initial peak point with a set step size, and repeatedly calculating the sum of squared residuals corresponding to each candidate position, specifically involves:

[0028] Read the sequence position index of the initial peak point, set the traversal range to be one pixel wide to the left and right of the initial peak point, and set the traversal step size to 0.1 pixels;

[0029] Starting from the beginning of the traversal range, the center position of the fitting interval is moved point by point with the traversal step size as the interval. For each candidate position, the sequence value in the fitting interval is extracted, the residual sum of squares between the sequence value and the fitting line is calculated, and the index of each candidate position and its corresponding residual sum of squares are recorded.

[0030] After traversing all candidate positions, select the candidate position with the smallest sum of squared residuals.

[0031] As a further aspect of the present invention, the process of obtaining the final transparency level is specifically as follows:

[0032] S501: Read the pre-calibrated feature level mapping table, which records the correspondence between the peak difference and peak position joint features and the national standard transparency level. Substitute the peak difference and peak position into the feature level mapping table for lookup conversion to obtain the preliminary transparency level determination result.

[0033] S502: Calculate the ratio of the average transmitted light intensity in the transmission region to the average scattered light intensity in the scattering region, and use it as the global light intensity ratio.

[0034] S503: Compare the global light intensity ratio with the preset multiple interval thresholds. When the global light intensity ratio is in the normal transparency range, retain the preliminary transparency level judgment result as the final level. When the global light intensity ratio is in the chalky white judgment range or the crack judgment range, it is judged as an interference sample and the removal operation is performed. Output the final transparency level of the effective rice grains and associate it with the rice grain number.

[0035] As a further aspect of the present invention, the process of comparing the global light intensity ratio with preset multiple sets of interval thresholds specifically involves:

[0036] Read the global light intensity ratio, compare the global light intensity ratio with the lower boundary and the upper boundary of the first threshold, and when the global light intensity ratio is greater than the lower boundary of the first threshold and less than the upper boundary of the first threshold, determine that the rice grain is a normal transparent rice grain and retain the preliminary determination result of the transparency level.

[0037] When the global light intensity ratio is less than the second threshold, the rice grain is determined to be a chalky rice grain, and the rice grain is marked as an interference sample and removed.

[0038] When the global light intensity ratio is greater than or equal to the second threshold and less than the third threshold, the rice grain is determined to be an internally cracked rice grain, and the rice grain is marked as an interference sample and removed.

[0039] As a further aspect of the present invention, the lightweight optical flow estimation model adopts a pyramid hierarchical structure, and the specific calculation process is as follows:

[0040] The input frame to be estimated and the reference frame are downsampled to generate a multi-scale image pyramid. The optical flow field is calculated layer by layer starting from the lowest resolution layer. The optical flow field result calculated in the current layer is upsampled to the corresponding resolution and used as the initial optical flow estimate of the next layer. Iterative optimization is performed by combining the feature information of the previous layer image. Finally, the dense optical flow field of the highest resolution layer is output. The motion displacement vector of all pixels in each grain region is extracted and the average value is calculated to obtain the average motion displacement vector data of the grain region.

[0041] As a further aspect of the present invention, the adaptive threshold segmentation algorithm employs the local mean thresholding method, the specific process of which is as follows:

[0042] A square local window with a side length of 15-31 pixels is constructed with each pixel as the center. The average gray value of all pixels within the local window is calculated as the segmentation threshold for that pixel. When the gray value of a pixel is greater than the segmentation threshold, it is determined to be a foreground pixel; otherwise, it is determined to be a background pixel, thus completing the image binarization process.

[0043] Compared with the prior art, the advantages and positive effects of the present invention are as follows:

[0044] In this invention, nanosecond-level synchronous acquisition of transmission and scattering images is achieved through a single camera with dual optical paths. A lightweight pyramid optical flow model is used to calculate the average motion displacement vector for each rice grain to construct a spatially uniform point diffusion function. Wiener deconvolution is combined to eliminate directional ambiguity caused by high-speed motion. A multi-directional radial sampling strategy is adopted to convert the two-dimensional transparency distribution into a one-dimensional transmission and scattering difference sequence. Subpixel-level peak positioning is achieved through residual sum of squares minimization search. A light intensity balance coefficient is introduced to eliminate light source differences and suppress common-mode interference such as light fluctuations and surface reflections. Combined with the global light intensity ratio criterion, normal rice grains are accurately distinguished from chalky or cracked defect samples, achieving high-speed online detection of more than 1,000 grains per second, with higher grading accuracy, ensuring the stability and consistency of rice processing quality grading. Attached Figure Description

[0045] Figure 1 This is a schematic diagram of the main steps of the present invention. Detailed Implementation

[0046] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0047] Please see Figure 1 This invention provides a technical solution: a method for detecting the transparency of rice appearance quality, comprising the following steps:

[0048] S1: Acquire continuous multi-frame dual-optical-path alternating synchronous images of high-speed moving rice grains. Calculate the dense motion displacement vector of all frames relative to the reference frame using an optical flow estimation algorithm. Based on this, construct a spatially uniform point diffusion function for each rice grain region. Perform blur deconvolution correction on each frame image. Take the pixel average of the corrected multi-frame images to obtain a clear transmission image and a clear scattering image.

[0049] S2: Denoising filtering and adaptive threshold segmentation are performed on the clear transmission image and the clear scattering image respectively to extract the rice grain contours, remove overlapping, incomplete edge rice grains and impurity samples, and obtain the transmission area image and scattering area image of the effective rice grains.

[0050] S3: Taking the geometric center of the rice grain as the origin, sample pixel by pixel along multiple uniformly distributed radial directions, calculate the difference between the transmitted light intensity and the scattered light intensity after correction by the pre-calibrated light intensity balance coefficient at each sampling point, and sort and splice them according to the radial distance to generate a one-dimensional transmission and scattering difference sequence.

[0051] S4: Smooth the one-dimensional transmission and scattering difference sequence and locate the initial peak point. Construct a local fitting interval with the initial peak point as the center. Search for the minimum position of the residual sum of squares along the radial direction with a set step size. Output the sub-pixel level peak position and the corresponding peak difference.

[0052] S5: Read the pre-calibrated feature level mapping table, convert the peak difference and peak position into transparency level; calculate the global light intensity ratio of the transmission area and the scattering area, remove chalky and cracked interference samples according to the ratio range, output the final transparency level of the effective rice grains and associate it with the rice grain number.

[0053] The specific process for acquiring clear transmission and clear scattering images is as follows:

[0054] S101: Employs a global shutter industrial camera to alternately and synchronously trigger the acquisition of multiple consecutive frames of transmission and scattering images of rice grains at a set frame rate, obtaining transmission and scattering image sequences. The transmission images are acquired by illumination from a bottom front transmission light source, while the scattering images are acquired by illumination from a side scattering light source installed at a set tilt angle. Both light sources are triggered synchronously with the industrial camera, and the time difference between two adjacent acquisitions is less than a set threshold. A white LED surface light source is installed directly below the bottom of the inspection station as a front transmission light source, and a white LED surface light source of the same power and color temperature is installed at a 45° tilt angle on the side of the inspection station as a back scattering light source. Both light sources are driven by a programmable pulse power supply and are connected to the same hardware synchronization controller as the external trigger signal line of the industrial camera. As the rice grains enter the camera's field of view along the conveyor belt, the industrial camera triggers a sampling pulse to the synchronization controller at a frame rate of 1000fps. The synchronization controller then triggers the transmitted and diffused light sources in an alternating sequence, capturing optical images of the rice grains in both transmitted and diffused states in adjacent frames. The time interval between each two frames is 1ms, and the actual execution time difference between the two alternating triggers is controlled within 500ns by the hardware synchronization controller. This ensures that the image acquisition time difference for the same rice grain under both transmitted and diffused lighting conditions is far below the displacement error threshold caused by the grain's movement. After acquisition, the industrial camera writes the transmitted and diffused image sequences into the image processing buffer, respectively.

[0055] S102: The pre-trained lightweight optical flow estimation model is invoked. Using the middle frame of the sequence as the reference frame, the dense optical flow field of all frames in the sequence relative to the reference frame is calculated to obtain the average motion displacement vector data of each grain region. The transmission image sequence and scattering image sequence in the image processing cache are read, and the frame located in the middle position of each sequence is used as the reference frame. Next, the lightweight optical flow estimation model based on a deep learning framework is invoked. This model uses parameter weights pre-trained on a large-scale general motion scene dataset. Within the grain movement speed range (0.5-2 m / s) in this embodiment, satisfactory optical flow estimation accuracy can be obtained without additional transfer training or fine-tuning for the rice detection scenario. If applied to a higher speed detection scenario, a small number of rice motion images can be collected to fine-tune the model. The frame to be estimated and the reference frame are directly used as input. The model outputs the motion displacement components of each pixel position in the horizontal and vertical directions, forming a dense optical flow field. For each grain region with extracted contours, the motion displacement vectors corresponding to all pixels within that region are statistically analyzed, and their arithmetic mean in the horizontal and vertical directions is calculated to obtain the average motion displacement vector data of that grain region. This vector data contains both motion direction and motion amplitude information.

[0056] S103: Based on the average motion displacement vector data, a spatially uniform point spread function is constructed for each grain region. Wiener deconvolution is performed on each frame of the transmission and scattering image sequences to eliminate motion blur. The grayscale average of the corresponding pixel positions in each corrected frame image is taken, and a clear transmission image and a clear scattering image are output. For each grain region, its average motion displacement vector data is read. The horizontal and vertical components of this vector are used as the direction and length parameters of the motion blur to construct a one-dimensional point spread function uniformly distributed along the motion direction. The width of the point spread function is equal to the number of pixels corresponding to the magnitude of the motion displacement vector. The weights of the point spread function at each position in the motion direction are equally distributed to reflect the uniform blur effect caused by uniform motion. Subsequently, for each frame of the transmission and scattering image sequences, the point spread function of the corresponding grain region of that frame is used as the degradation model. The noise variance estimate of each frame image is combined with the noise variance estimate of each frame image as a regularization parameter. The noise variance estimate of each frame image is obtained by extracting the pure background region without grains in the image and calculating the grayscale variance of all pixels in that region. This method leverages the characteristic that the background region contains only system noise to quickly and accurately estimate the noise level of the current frame. Wiener deconvolution is performed to eliminate directional blur caused by the high-speed movement of rice grains. The frequency domain expression of Wiener deconvolution is used to recover the filter. Conjugate divided by The sum of the squared modulus and the power spectrum ratio of the noise signal is used to perform frequency domain deconvolution pixel by pixel, transforming it back to the spatial domain to obtain the corrected clear image for each frame. Then, the arithmetic mean of the gray levels of each corrected frame in the transmission sequence is taken at the corresponding pixel positions to output a clear transmission image; similarly, the arithmetic mean of the gray levels of each corrected frame in the scattering sequence is taken at the corresponding pixel positions to output a clear scattering image. This process eliminates the measurement distortion of light intensity caused by high-speed motion, resulting in higher physical accuracy for subsequent transparency feature values ​​calculated based on light intensity values.

[0057] The lightweight optical flow estimation model adopts a pyramid hierarchical structure, and the specific calculation process is as follows:

[0058] The input two adjacent frames of images are downsampled to generate a multi-scale image pyramid. The optical flow field is calculated layer by layer starting from the lowest resolution layer. The optical flow field result calculated at each layer is upsampled and used as the initial optical flow estimate of the next layer. Iterative optimization is performed by combining the feature information of the previous layer image. Finally, the dense optical flow field of the highest resolution layer is output. The motion displacement vector of all pixels in each grain region is extracted and the average value is calculated to obtain the average motion displacement vector data of the grain region.

[0059] Specifically, the input frame image to be estimated and the reference frame image are first subjected to a stepwise 2x downsampling operation to generate an image pyramid with four scale levels. The 0th level is the original resolution image, and the 3rd level is the lowest resolution coarse image (downsampled by 2x at each level). Then, starting from the 3rd level (lowest resolution level), the frame image to be estimated and the reference frame are input into the feature extraction module of the optical flow estimation network. Multi-channel feature maps are extracted and a correlation volume is constructed. A coarse optical flow field result is calculated at this level through an iterative update mechanism. Subsequently, the optical flow field result of this level is multiplied by a factor of 2 and then bilinearly interpolated to upsample to the resolution size of the next level, serving as the initial optical flow estimate for the next level. Simultaneously, the feature maps of the frame image to be estimated and the reference frame in the next level are jointly encoded with the upsampled optical flow field. The optical flow field is refined through several iterations of optimization. This process propagates layer by layer upwards and iteratively optimizes until the optical flow calculation of the 0th level (original resolution level) is completed, outputting the final dense optical flow field. This optical flow field records sub-pixel-level motion displacement components in both the horizontal and vertical directions at each pixel location. The advantage of the pyramid-structured architecture lies in the fact that low-resolution layers can efficiently capture global trends with large-scale motion, while high-resolution layers can finely refine local details. The combination of these two allows optical flow estimation to handle the large inter-frame displacements of high-speed moving grains while maintaining pixel-level estimation accuracy. Finally, the motion displacement vectors corresponding to all pixels within each segmented grain region in the dense optical flow field are extracted, and the arithmetic mean of each vector component in the horizontal and vertical directions is calculated to obtain the average motion displacement vector data for that grain region.

[0060] The specific process for obtaining the transmission and scattering region images of the effective rice grains is as follows:

[0061] S201: Median filtering is performed on both the clear transmission and clear scattering images to remove salt-and-pepper noise. An adaptive thresholding segmentation algorithm is then used to binarize the denoised images to extract the contour regions of the rice grains. Both the clear transmission and clear scattering images are read separately, and a 3×3 neighborhood window median filtering operation is performed on each image. This involves sorting the nine grayscale values ​​within the 3×3 neighborhood corresponding to each pixel position from smallest to largest and taking the median to replace the original grayscale value. This operation effectively removes salt-and-pepper noise caused by tiny impurities in the light source or sensor thermal noise during image acquisition, while preserving the edge details of the rice grains. Subsequently, the denoised images are binarized using an adaptive thresholding segmentation algorithm, converting the grayscale image into a binary image containing only the foreground and background. Foreground pixels correspond to the rice grain region, and background pixels correspond to non-rice grain regions. Finally, connected component labeling is performed on the binary image to extract the contour coordinate sequences of each connected region, obtaining the contour regions of the rice grains.

[0062] S202: For each contour region, calculate the grain area parameter, aspect ratio parameter, and gray-level variance parameter. Compare the grain area parameter with a set area threshold, the aspect ratio parameter with a set aspect ratio range, and the gray-level variance parameter with a set gray-level variance range. For each extracted contour region, calculate the following three discrimination parameters: First, the grain area parameter, which is the total number of pixels contained within the contour region, obtained by calculating the pixel area of ​​the contour polygon; Second, the aspect ratio parameter, which is the ratio of the major axis length to the minor axis length of the smallest bounding rectangle of the contour region, reflecting the geometric shape characteristics of the grain; Third, the gray-level variance parameter, which is the arithmetic mean of the squared differences between the corresponding gray-level values ​​of each pixel within the contour region in the original clear image and the mean gray-level value of the region, reflecting the uniformity of gray-level distribution within the grain. The rice grain area parameter is then compared with a set area threshold (usually set to 30% of the average area of ​​a standard whole rice grain), the aspect ratio parameter is compared with a set aspect ratio range (usually set to 2.0 to 4.0), and the grayscale variance parameter is compared with a set grayscale variance range. The grayscale variance range is usually set to 0 to 50 (8-bit grayscale image), which is obtained by collecting grayscale variance statistics from 1000 normal whole rice grains.

[0063] S203: Remove broken rice areas with an area below a set area threshold, abnormal areas with an aspect ratio exceeding a set aspect ratio range, and impurity areas with a gray-level variance exceeding a set gray-level variance range. Retain valid areas that meet the criteria for intact rice grains and output the transmission and scattering area images of the valid rice grains. For each contour region, three discrimination parameters are determined: when the rice grain area parameter is less than the set area threshold, the contour region is determined to be broken rice or impurity fragments, and removal is performed; when the aspect ratio parameter is less than the lower limit of the set aspect ratio range or greater than the upper limit, the contour region is determined to be an abnormal shape sample (such as irregular shapes caused by broken rice grains), and removal is performed; when the gray-level variance parameter exceeds the set gray-level variance range, if it is higher than the upper limit, it indicates severe gray-level unevenness; if it is lower than the lower limit, it may be a solid-color impurity particle, and removal is performed in both cases. After removing the contour regions that do not meet the above conditions, retain the complete valid areas that simultaneously meet the area threshold condition, aspect ratio range condition, and gray-level variance range condition. Finally, for each effective region, the corresponding rectangular region is cropped from the clear transmission image and the clear scattering image, respectively, and the transmission region image and scattering region image of the effective rice grain are output for subsequent difference sequence generation and transparency feature calculation.

[0064] The adaptive threshold segmentation algorithm uses the local mean thresholding method, and the specific process is as follows:

[0065] A square local window with a side length of 15-31 pixels is constructed with each pixel as the center. The average gray value of all pixels within the local window is calculated as the segmentation threshold for that pixel. If the gray value of a pixel is greater than the segmentation threshold, it is determined to be a foreground pixel; otherwise, it is determined to be a background pixel, thus completing the image binarization process.

[0066] Specifically, for each pixel in the denoised grayscale image, a square neighborhood window with a side length of 21 pixels (an empirical value, corresponding to a radius of 10 pixels) is taken centered on the pixel's location. The arithmetic mean of the grayscale values ​​of all pixels within this window is calculated. This mean is multiplied by a preset adjustment coefficient (usually a constant between 0.85 and 0.95) and used as the local adaptive segmentation threshold for that pixel location. The value of the adjustment coefficient is determined based on the grayscale contrast between the background and the foreground. A smaller value (0.85) is used when the background is brighter and the grains are darker, and a larger value (0.95) is used when the background is darker and the grains are brighter. In this embodiment, since both the transmitted and scattered images have bright backgrounds and dark targets, the adjustment coefficient is uniformly set to 0.9. Then, the grayscale value of the pixel is compared with the corresponding local threshold. When the grayscale value is greater than the local threshold, the pixel is determined to be a foreground pixel belonging to the grain region and assigned a value of 1; when the grayscale value is less than or equal to the local threshold, the pixel is determined to be a background pixel belonging to the background region and assigned a value of 0, thereby completing the pixel-by-pixel binarization processing of the entire image. The core advantage of the local mean thresholding method is that the segmentation threshold of each pixel is dynamically determined by the gray-level statistical features of its local neighborhood, rather than using a globally uniform threshold. Therefore, it can effectively deal with the problem of non-uniform gray-level distribution caused by uneven illumination from dual light source sources, differences in the curvature of rice grain surfaces, or vignetting effects of camera optical systems in clear transmission and clear scattering images, ensuring that the outline of rice grains can be accurately segmented in areas with different light intensities.

[0067] The specific process for generating a one-dimensional transmission-scattering difference sequence is as follows:

[0068] S301: Extract the geometric center coordinates of the effective rice grain contour region. Establish a radial sampling reference axis with the geometric center point as the origin, and generate radial sampling lines along 8-32 uniformly distributed directions. Read the contour region of the effective rice grain in the clear transmission image and the clear scattering image respectively, and calculate the arithmetic mean of the coordinates of all boundary pixels of the contour region as the geometric center coordinates of the rice grain, denoted as (x0, y0). Establish a two-dimensional polar coordinate system with this geometric center point as the origin. Uniformly select 16 direction angles within the range of 0° to 360° (i.e., adjacent directions are spaced 22.5° apart, corresponding to 0°, 22.5°, 45°, 67.5°, 90°...337.5° respectively). Generate a radial sampling line from the origin to the contour edge along each direction angle. The length of each sampling line is the farthest distance from the origin to the contour edge in that direction. The selection of 16 uniformly distributed directions balances the sufficiency of sampling and computational efficiency, enabling the uniform acquisition of transparency feature information in all regions of the rice grain, avoiding incomplete feature descriptions due to too few sampling directions or unnecessary increases in computational load due to too many sampling directions.

[0069] S302: Read the transmitted light intensity value and scattered light intensity value at the corresponding position pixel by pixel along each radial sampling line from the edge of the contour to the center point, and calculate the difference feature value at each sampling point. The difference feature value is equal to the transmitted light intensity value minus the product of the light intensity balance coefficient and the scattered light intensity value. The light intensity balance coefficient is obtained by one-time calibration using a standard transparency meter sample.

[0070] For each radial sampling line, the process is performed pixel-by-pixel, starting from the endpoint of the contour edge and moving towards the geometric center. For each pixel coordinate position reached, the corresponding gray value is read from both the clear transmission image and the clear scattering image. The gray value in the transmission image is used as the transmitted light intensity value T(i,j), and the gray value in the scattering image is used as the scattered light intensity value S(i,j). Then, the difference eigenvalue is calculated using the formula...

[0071] ;

[0072] Calculate the difference characteristic value at the sampling point, where k is the light intensity balance coefficient. The calibration method for the light intensity balance coefficient k is as follows: A set of standard rice samples with transparency level 1, confirmed by national standards, is pre-selected. Under the hardware configuration and light source power conditions of the current testing station, their transmission and scattering images are acquired. The ratio of the average transmitted light intensity to the average scattered light intensity at all pixel locations is calculated. This ratio is used as the fixed value of the light intensity balance coefficient k, which remains unchanged during subsequent testing and does not require repeated calibration. The physical meaning of the difference calculation is that the light intensity balance coefficient k has been calibrated using level 1 standard rice samples, making the average difference of completely transparent rice grains approach 0. For rice grains with transparency below level 1, the internal starch density decreases, the transmitted light intensity decreases while the scattered light intensity increases, resulting in a negative difference with the absolute value increasing as transparency decreases. For chalky or severely internally defective rice grains, the transmitted light intensity is extremely low while the scattered light intensity is extremely high, resulting in a negative difference with a large absolute value. Factors such as light fluctuations, dust pollution, and surface reflection have a similar influence on the intensity of transmitted and scattered light in terms of direction and magnitude. These common-mode interferences can be naturally eliminated through subtraction, allowing the extraction of pure physical feature values ​​that only reflect the transparency properties of the rice grains themselves.

[0073] S303: Sort the difference feature values ​​of all sampling points in each radial direction in a unified manner according to the radial distance from the sampling point to the center point from far to near, and splice them to generate a one-dimensional transmission and scattering difference sequence.

[0074] The difference feature values ​​of all sampling points in the 16 radial directions are summarized, and the radial Euclidean distance r from each sampling point to the geometric center is calculated. Then, all difference feature values ​​are uniformly sorted in descending order of radial distance r (i.e., from the contour edge to the center point). The sorted difference feature values ​​are then concatenated into a one-dimensional sequence to generate the transmission scattering difference sequence D(r). The physical meaning of this sequence is: the trend of the change of the net transmitted light intensity from the surface of the rice grain to different depths inside. The beginning of the sequence corresponds to the transparency characteristics of the rice grain edge region, and the end of the sequence corresponds to the transparency characteristics of the rice grain center region. The entire sequence completely records the spatial distribution information of the rice grain's transparency in the radial dimension.

[0075] The specific process for obtaining sub-pixel level peak position and peak difference is as follows:

[0076] S401: Perform a moving average smoothing process with a window width of 3-7 pixels on the one-dimensional transmission and scattering difference sequence, traverse the smoothed sequence to find the position with the maximum difference feature value, and take this position as the initial peak point;

[0077] The one-dimensional transmission and scattering difference sequence D(r) is read, and a moving average smoothing process with a window width of 5 pixels is performed on the sequence. That is, for each position in the sequence, the arithmetic mean of the gray values ​​of the two neighboring positions (two positions before and two positions after the original value) is taken to replace the original value, eliminating local noise spikes that may exist during the sampling process. Then, the smoothed difference sequence is traversed, and the magnitude of the difference feature value at each position is compared one by one. The index of the position where the difference feature value is the maximum is found, and this position is taken as the initial peak point. This initial peak point corresponds to the region with the highest transparency inside the rice grain, that is, the radial depth where the light penetration ability is the strongest.

[0078] S402: Construct a local fitting interval by taking 2-4 pixels to the left and right of the initial peak point as the center, and calculate the sum of squared residuals between the sequence values ​​and the fitted line within the local fitting interval;

[0079] Centered on the initial peak point, extend 3 pixels to the left and right to construct a local fitting interval covering 7 data points. Extract the sequence index of each position within this interval as the independent variable x, and the corresponding difference feature value as the dependent variable y. Use the least squares method to fit a straight line, calculate the residual value between the difference feature value of each data point within the interval and the value at the corresponding position on the fitted line, and sum the squared residual values ​​to obtain the residual sum of squares.

[0080] S403: Move the fitted interval center point by point within a set range to the left and right of the initial peak point with a set step size, repeatedly calculate the residual sum of squares corresponding to each candidate position, stop the search when the residual sum of squares reaches the minimum value, output the candidate position as the sub-pixel level peak position, extract the difference feature value corresponding to the position as the peak difference value, and output the sub-pixel level peak position and the peak difference value together.

[0081] Starting from the initial peak point's sequence position as the center, the local fitting interval is moved point by point within a range shifted 1 pixel to the left and right, with a fixed step size of 0.1 pixels, resulting in a total of 21 candidate positions (from the initial peak point -1.0 pixel to the initial peak point +1.0 pixel, with a step size of 0.1 pixels). For each candidate position, the sequence values ​​of 7 data points are re-extracted using it as the new fitting interval center (when the candidate position is a non-integer pixel, linear interpolation is used to obtain the difference feature value at that position), and the fitted line and residual sum of squares are calculated again. After traversing all 21 candidate positions, the candidate position corresponding to the minimum residual sum of squares is selected as the sub-pixel-level peak position, and the difference feature value corresponding to this sub-pixel position (obtained through linear interpolation) is extracted as the peak difference value. Finally, the sub-pixel-level peak position and peak difference value are combined and output as two core physical features characterizing the transparency of the rice grain. The advantage of sub-pixel-level positioning lies in its accuracy. Conventional integer-pixel-level positioning achieves an accuracy equivalent to the actual physical length of one pixel (typically on the order of tens of micrometers), while a 0.1-pixel step size search strategy improves the positioning accuracy to the order of one-tenth of a pixel (typically on the order of several micrometers), enabling more precise capture of key locations where the transparency gradient changes within a grain of rice. The principle of this sub-pixel detection method is as follows: the peak region of a one-dimensional transmission-scattering difference sequence approximates a linearly changing straight line segment within a local range of ±1 pixel. When the center of the fitting interval coincides exactly with the peak point, the fitted straight line achieves the highest degree of fit with the actual sequence, and the sum of squared residuals reaches its minimum. Through a fine-grained search with a 0.1-pixel step size, the peak positioning accuracy can be improved from the integer-pixel level to the sub-pixel level.

[0082] The process of moving the center of the fitting interval point by point within a set range to the left and right of the initial peak point, and repeatedly calculating the sum of squared residuals corresponding to each candidate position, is as follows:

[0083] Read the sequence position index of the initial peak point, set the traversal range to be one pixel wide to the left and right of the initial peak point, and set the traversal step size to zero pixels.

[0084] Starting from the beginning of the traversal range, move the center position of the fitting interval point by point with the traversal step size as the interval. For each candidate position, extract the sequence value within the fitting interval, calculate the residual sum of squares between the sequence value and the fitting line, and record the index of each candidate position and its corresponding residual sum of squares.

[0085] Specifically, the sequence position index value p0 of the initial peak point is read, the left boundary of the traversal range is set to p0-1.0, the right boundary to p0+1.0, and the traversal step size is 0.1 pixels. Starting from the left boundary p0-1.0, a candidate position sequence {p0-1.0, p0-0.9, p0-0.8, ..., p0+0.9, p0+1.0} is generated with a step size of 0.1 pixels, resulting in a total of 21 candidate positions. For each candidate position p... k , with p k A local fitting interval is constructed by taking 7 sampling points, 3 on each side of the center, and 3 on the left and right. When p k When the position is a non-integer position, the difference feature value at that position is obtained by linear interpolation using the difference feature values ​​of its left and right adjacent integer positions. The interpolation formula is as follows: Then, using the sequence indices of these 7 sampling points as independent variables and the difference feature values ​​as dependent variables, a straight line was fitted using the least squares method. The residual values ​​between the difference feature values ​​of each sampling point and the predicted values ​​of the fitted straight line were calculated. The squared residual values ​​were then summed to obtain the sum of squared residuals for each candidate position. The index of each candidate position and its corresponding sum of squared residuals were recorded in the results list.

[0086] After traversing all candidate positions, select the candidate position with the smallest sum of squared residuals, use the index of the candidate position as the sub-pixel level peak position, extract the difference feature value corresponding to the position as the peak difference, and output the sub-pixel level peak position and the peak difference.

[0087] The process of obtaining the final transparency level is as follows:

[0088] S501: Read the pre-calibrated mapping relationship between the peak difference and peak position joint features and the national standard transparency level, substitute the peak difference and peak position into the mapping relationship for table lookup conversion, and obtain the preliminary judgment result of the transparency level;

[0089] The pre-established mapping relationship is calibrated according to the rice transparency grading standards of grades 1-5 specified in the national standard GB / T1354-2023. The calibration method is as follows: select several batches of rice samples covering grades 1 to 5 of the national standard transparency, acquire dual-path images at the current testing station, and execute all steps S1 to S4 mentioned above to obtain the peak difference Dp and peak position rp data pairs corresponding to each grade of standard sample. Perform statistical analysis on the data pairs of each grade to determine the boundary range of each grade in the Dp-rp two-dimensional feature space, and establish a mapping table from joint features to national standard grades. During testing, substitute the peak difference and peak position of the current rice grain into the mapping table for lookup matching, find the grade interval, and output the preliminary judgment result of the transparency grade.

[0090] S502: Calculate the ratio of the average transmitted light intensity of the rice grain region in the clear transmitted image to the average scattered light intensity of the rice grain region in the clear scattered image, and use it as the global light intensity ratio.

[0091] Read the image of the transmission area corresponding to the current rice grain, calculate the arithmetic mean of the gray values ​​of all pixels in that area, and obtain the average transmitted light intensity value mean(T). Read the image of the scattering area corresponding to the current rice grain, calculate the arithmetic mean of the gray values ​​of all pixels in that area, and obtain the average scattered light intensity value mean(S). Calculate the ratio of the two, R = mean(T) / mean(S), and use this ratio R as the global light intensity ratio. The physical meaning of the global light intensity ratio is the ratio of the overall transmission capacity to the scattering capacity of the rice grain. This ratio directly reflects the way the internal structure of the rice grain affects light, and is the core physical criterion for distinguishing normal transparent rice grains from interfering rice grains such as chalky or cracked grains.

[0092] S503: Compare the global light intensity ratio with the preset multiple interval thresholds. When the global light intensity ratio is in the normal transparency range, retain the preliminary transparency level judgment result as the final level. When the global light intensity ratio is in the chalky white judgment range or the crack judgment range, it is judged as an interference sample and the removal operation is performed. Output the final transparency level of the effective rice grains.

[0093] The global light intensity ratio R is read and compared with three preset threshold ranges. When the R value falls within the normal transparency range, the current rice grain is determined to be a normal transparent rice grain, and the preliminary transparency level determination result obtained in S501 is retained as the final transparency level output. When the R value falls within the chalky white determination range, the current rice grain is determined to be a chalky white interference rice grain, marked as an interference sample, and removed from the valid detection results. When the R value falls within the crack determination range, the current rice grain is determined to be an internal crack interference rice grain, marked as an interference sample, and removed from the valid detection results. Finally, the final transparency level of all valid rice grains is output, and the transparency level result of each rice grain is associated with its unique number and image acquisition timestamp, and written into the detection result database for storage. The above thresholds are empirical values ​​under the hardware configuration of this embodiment. In actual applications, they should be calibrated by the following method: collect 1000 normal transparent rice grains of known grade, 1000 chalky rice grains, and 1000 cracked rice grains, calculate their global light intensity ratios respectively, and determine the boundary thresholds of each interval through statistical analysis to ensure that the misjudgment rate is less than 1%.

[0094] The process of comparing the global light intensity ratio with preset interval thresholds is as follows:

[0095] Read the global light intensity ratio and compare it with the lower boundary and upper boundary of the first threshold. When the global light intensity ratio is greater than or equal to the lower boundary of the first threshold and less than the upper boundary of the first threshold, the rice grain is determined to be a normal transparent rice grain, and the preliminary determination result of the transparency level is retained.

[0096] Specifically, the lower boundary of the first threshold is set to 0.8, and the upper boundary of the first threshold is set to 1.5. When the global light intensity ratio R satisfies 0.8≤R<1.5, it indicates that the transmitted light intensity and scattered light intensity of the rice grain are within a balanced ratio range, the light can effectively penetrate the rice grain and there is no abnormally strong scattering or absorption inside, which is consistent with the optical physical characteristics of a normal transparent rice grain. The rice grain is determined to be a normal transparent rice grain, and the preliminary transparency level determination result obtained in S501 is retained as the final transparency level of the rice grain.

[0097] When the global light intensity ratio is less than the second threshold, the rice grain is determined to be a chalky rice grain. The loose internal starch structure of the chalky rice grain causes the scattered light intensity to be much greater than the transmitted light intensity. The rice grain is marked as an interference sample and removed.

[0098] The second threshold is set to 0.6. When the global light intensity ratio R satisfies R < 0.6, it indicates that the scattered light intensity of the rice grain is significantly higher than the transmitted light intensity. The physical reason for this is that the starch particles inside the chalky region are loosely arranged, and there are a large number of air-starch interfaces. During the transmission process, the incident light undergoes severe Mie scattering, and most of the light energy is scattered in various directions and cannot pass through along the forward transmission direction, resulting in a characteristic optical response of extremely low forward transmitted light intensity and extremely high backscattered light intensity. Although such rice grains may be misjudged as "low transparency" under the single index of forward transmitted light intensity, they are actually not within the normal transparency gradient range. Rather, their abnormal optical properties are caused by internal structural defects. Therefore, this rice grain is marked as an interfering sample and removed from the valid detection results.

[0099] When the global light intensity ratio is greater than or equal to the second threshold and less than the third threshold, the rice grain is determined to be an internally cracked rice grain. The cracked air interface of the internally cracked rice grain will cause strong scattering of transmitted light, resulting in a significant attenuation of transmitted light intensity and a small change in scattered light intensity. Therefore, the global light intensity ratio is lower than the normal transparent range but higher than the chalky white determination range. The rice grain is marked as an interference sample and is removed.

[0100] The third threshold is set to 0.8, which is equal to the lower boundary of the first threshold. When the global light intensity ratio R satisfies 0.6 ≤ R < 0.8, it indicates that the ratio of transmitted light intensity to scattered light intensity of the rice grain is lower than the lower limit of normal transparent rice grains but higher than the characteristic range of chalky rice grains. The physical reason is that there are microscopic cracks or fissures inside the rice grain. A high refractive index difference interface is formed between the air inside the crack and the rice grain endosperm tissue. The incident light undergoes strong Fresnel reflection and refraction at this interface, and some transmitted light energy is scattered to non-positive directions by the crack interface, resulting in a significant attenuation of the positive transmitted light intensity. However, since the total volume and interface area of ​​the crack are much smaller than the loose starch area of ​​the chalky region, the increase in scattered light intensity is limited. Therefore, the global light intensity ratio is in the transition zone between the chalky range and the normal range. The degree of attenuation of the forward transmitted light intensity of this type of rice grain is between that of chalky rice grains and normal rice grains. It is difficult to distinguish it from low-transparency rice grains using a single transmitted light intensity index. However, it can be effectively identified and eliminated by using the interval criterion of the global light intensity ratio, thus avoiding interference with the transparency level determination results.

[0101] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A method for detecting the transparency of rice appearance quality, characterized in that, Includes the following steps: S1: Acquire continuous multi-frame dual-optical-path alternating synchronous images of high-speed moving rice grains. Calculate the dense motion displacement vector of all frames relative to the reference frame using an optical flow estimation algorithm. Based on this, construct a spatially uniform point diffusion function for each rice grain region. Perform blur deconvolution correction on each frame image. Take the pixel average of the corrected multi-frame images to obtain a clear transmission image and a clear scattering image. S2: Perform noise reduction filtering and adaptive threshold segmentation on the clear transmission image and clear scattering image respectively, extract the rice grain contour, remove overlapping, incomplete edge rice grains and impurity samples, and obtain the transmission area image and scattering area image of the effective rice grains. S3: Taking the geometric center of the rice grain as the origin, sample pixel by pixel along multiple uniformly distributed radial directions, calculate the difference between the transmitted light intensity and the scattered light intensity after correction by the pre-calibrated light intensity balance coefficient at each sampling point, and sort and splice them according to the radial distance to generate a one-dimensional transmission and scattering difference sequence. S4: Smooth the one-dimensional transmission and scattering difference sequence and locate the initial peak point. Construct a local fitting interval with the initial peak point as the center. Search for the position with the minimum sum of squared residuals along the radial direction with a set step size. Output the sub-pixel level peak position and the corresponding peak difference. S5: Read the pre-calibrated feature level mapping table, convert the peak difference and peak position into transparency level; calculate the global light intensity ratio of the transmission area and the scattering area, remove chalky and cracked interference samples according to the ratio range, output the final transparency level of the effective rice grains and associate it with the rice grain number.

2. The method for detecting the transparency of rice appearance quality according to claim 1, characterized in that, The specific process for acquiring the clear transmission image and the clear scattering image is as follows: S101: A global shutter industrial camera is used to alternately and synchronously trigger the acquisition of multiple consecutive frames of transmission and scattering images of rice grains at a set frame rate, thereby obtaining a transmission image sequence and a scattering image sequence. The transmission image is acquired by illumination from a bottom front transmission light source, and the scattering image is acquired by illumination from a side scattering light source installed at a set tilt angle. The two light sources are synchronously triggered with the industrial camera, and the time difference between two adjacent acquisitions is less than a set threshold. S102: For the transmission image sequence and the scattering image sequence respectively, call the pre-trained lightweight optical flow estimation model, take the middle frame of the corresponding sequence as the reference frame, calculate the dense optical flow field of all frames in the sequence relative to the reference frame, and obtain the average motion displacement vector data of each grain region. S103: Based on the average motion displacement vector data, construct a spatially uniform point diffusion function for each grain region, perform Wiener deconvolution operation on each frame of the transmission image sequence and the scattering image sequence to eliminate motion blur, take the average gray level of each frame at the corresponding pixel position, and output a clear transmission image and a clear scattering image.

3. The method for detecting the transparency of rice appearance quality according to claim 2, characterized in that, The specific process for acquiring the transmission region image and scattering region image of the effective rice grains is as follows: S201: Perform median filtering on the clear transmission image and the clear scattering image respectively to remove salt and pepper noise, and use an adaptive threshold segmentation algorithm to binarize the denoised image to extract the contour region of the rice grains; S202: Calculate the grain area parameter, aspect ratio parameter, and grayscale variance parameter for each contour region. Compare the grain area parameter with a set area threshold, compare the aspect ratio parameter with a set aspect ratio range, and compare the grayscale variance parameter with a set grayscale variance range. S203: Remove broken rice areas with an area lower than the set area threshold, abnormal areas with an aspect ratio exceeding the set aspect ratio range, and impurity areas with a gray-scale variance exceeding the set gray-scale variance range. Retain valid areas that meet the criteria for determining complete rice grains, and output the transmission area image and scattering area image of the valid rice grains.

4. The method for detecting the transparency of rice appearance quality according to claim 3, characterized in that, The specific process for generating the one-dimensional transmission scattering difference sequence is as follows: S301: Extract the coordinates of the geometric center point of the effective region, establish a radial sampling reference axis with the geometric center point as the origin, and generate radial sampling lines along 8-32 uniformly distributed directions; S302: Read the transmitted light intensity value and scattered light intensity value at the corresponding position pixel by pixel along each radial sampling line from the contour edge to the center point, and calculate the difference feature value at each sampling point, wherein the difference feature value is equal to the transmitted light intensity value minus the product of the light intensity balance coefficient and the scattered light intensity value, and the light intensity balance coefficient is obtained by one-time calibration using a standard transparency meter sample. S303: Sort the difference feature values ​​of all sampling points in each radial direction in a unified manner according to the radial distance from the sampling point to the center point from far to near, and splice them to generate a one-dimensional transmission and scattering difference sequence.

5. The method for detecting the transparency of rice appearance quality according to claim 4, characterized in that, The process of obtaining the sub-pixel level peak position and peak difference is as follows: S401: Perform a moving average smoothing process with a window width of 3-7 pixels on the one-dimensional transmission and scattering difference sequence, traverse the smoothed sequence to find the position with the maximum difference feature value, and take this position as the initial peak point; S402: Construct a local fitting interval by taking 2-4 pixels to the left and right of the initial peak point as the center, and calculate the sum of squared residuals between the sequence values ​​and the fitted line within the local fitting interval; S403: Move the center of the fitting interval point by point within a set range to the left and right of the initial peak point with a set step size, repeatedly calculate the sum of squared residuals corresponding to each candidate position, stop the search when the sum of squared residuals reaches the minimum value, output the candidate position as the sub-pixel level peak position, extract the difference feature value corresponding to the position as the peak difference value, and output the sub-pixel level peak position and the peak difference value together.

6. The method for detecting the transparency of rice appearance quality according to claim 5, characterized in that, The process of moving the center of the fitting interval point by point within a set range to the left and right of the initial peak point with a set step size, and repeatedly calculating the sum of squared residuals corresponding to each candidate position, is as follows: Read the sequence position index of the initial peak point, set the traversal range to be one pixel wide to the left and right of the initial peak point, and set the traversal step size to 0.1 pixels; Starting from the beginning of the traversal range, the center position of the fitting interval is moved point by point with the traversal step size as the interval. For each candidate position, the sequence value in the fitting interval is extracted, the residual sum of squares between the sequence value and the fitting line is calculated, and the index of each candidate position and its corresponding residual sum of squares are recorded. After traversing all candidate positions, select the candidate position with the smallest sum of squared residuals.

7. The method for detecting the transparency of rice appearance quality according to claim 1, characterized in that, The process of obtaining the final transparency level is as follows: S501: Read the pre-calibrated feature level mapping table, which records the correspondence between the peak difference and peak position joint features and the national standard transparency level. Substitute the peak difference and peak position into the feature level mapping table for lookup conversion to obtain the preliminary transparency level determination result. S502: Calculate the ratio of the average transmitted light intensity in the transmission region to the average scattered light intensity in the scattering region, and use it as the global light intensity ratio. S503: Compare the global light intensity ratio with the preset multiple interval thresholds. When the global light intensity ratio is in the normal transparency range, retain the preliminary transparency level judgment result as the final level. When the global light intensity ratio is in the chalky white judgment range or the crack judgment range, it is judged as an interference sample and the removal operation is performed. Output the final transparency level of the effective rice grains and associate it with the rice grain number.

8. The method for detecting the transparency of rice appearance quality according to claim 7, characterized in that, The process of comparing the global light intensity ratio with preset multiple interval thresholds is as follows: Read the global light intensity ratio, compare the global light intensity ratio with the lower boundary and the upper boundary of the first threshold, and when the global light intensity ratio is greater than the lower boundary of the first threshold and less than the upper boundary of the first threshold, determine that the rice grain is a normal transparent rice grain and retain the preliminary determination result of the transparency level. When the global light intensity ratio is less than the second threshold, the rice grain is determined to be a chalky rice grain, and the rice grain is marked as an interference sample and removed. When the global light intensity ratio is greater than or equal to the second threshold and less than the third threshold, the rice grain is determined to be an internally cracked rice grain, and the rice grain is marked as an interference sample and removed.

9. The method for detecting the transparency of rice appearance quality according to claim 2, characterized in that, The lightweight optical flow estimation model adopts a pyramid hierarchical structure, and the specific calculation process is as follows: The input frame to be estimated and the reference frame are downsampled to generate a multi-scale image pyramid. The optical flow field is calculated layer by layer starting from the lowest resolution layer. The optical flow field result calculated in the current layer is upsampled to the corresponding resolution and used as the initial optical flow estimate of the next layer. Iterative optimization is performed by combining the feature information of the previous layer image. Finally, the dense optical flow field of the highest resolution layer is output. The motion displacement vector of all pixels in each grain region is extracted and the average value is calculated to obtain the average motion displacement vector data of the grain region.

10. The method for detecting the transparency of rice appearance quality according to claim 3, characterized in that, The adaptive threshold segmentation algorithm uses the local mean thresholding method, and the specific process is as follows: A square local window with a side length of 15-31 pixels is constructed with each pixel as the center. The average gray value of all pixels within the local window is calculated as the segmentation threshold for that pixel. When the gray value of a pixel is greater than the segmentation threshold, it is determined to be a foreground pixel; otherwise, it is determined to be a background pixel, thus completing the image binarization process.