A machine vision-based method and system for automatically detecting quality defects in grains

By generating vibration spectrum diagrams and using dual-spectrum fusion technology, the problem of high-precision identification of grain defects under high-speed motion was solved, enabling refined classification and localization of mold and insect damage defects, and improving the stability and identification capability of the detection system.

CN120609837BActive Publication Date: 2025-10-17HUIZHOU ECONOMICS & POLYTECHNIC COLLEGE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511121916.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-12
Publication Date
2025-10-17
Estimated Expiration
2045-08-12

AI Technical Summary

Technical Problem

Existing technologies struggle to perform high-precision, non-destructive online identification of grain surface defects under high-speed motion, particularly in distinguishing and analyzing defects such as mold and insect infestation. Furthermore, traditional machine vision systems suffer from poor image quality in vibrating environments, affecting detection accuracy.

Method used

By acquiring triaxial vibration data of the conveyor belt to generate a vibration spectrum map, calculating the compensation angle to control the deflection of the LED module of the ring light source, and combining simultaneous shooting with visible light and near-infrared cameras to generate a dual-spectrum fusion image, extracting color saturation and transmittance channel features, and generating a defect distribution map.

Benefits of technology

It improves the stability and clarity of image acquisition in vibrating environments, enabling precise differentiation and location of mold and insect infestation defects, thus enhancing the accuracy and intelligence of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120609837B_ABST
    Figure CN120609837B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of machine vision detection, and relates to a kind of based on machine vision's cereal quality defect automatic detection method and system, comprising the following steps: generating vibration spectrum based on three-axis vibration data;The main resonance peak amplitude of vibration spectrum is parsed to calculate the compensation angle, and the deflection irradiation direction of the multiple LED modules of annular light source is controlled according to the compensation angle;Drive coaxially arranged visible light camera and near-infrared camera to shoot synchronously, generate dual-spectrum fusion image;Mapping data containing spatial coordinates associated with potential moldy area and potential insect-eroded hollow position are generated;Call pre-stored variety feature library to generate dynamic judgment template containing moldy threshold condition and insect-eroded threshold condition;Defect distribution map containing defect position coordinates is generated.The present application solves the problem that defects with completely different physical causes and visual features such as mold and insect-erosion cannot be effectively distinguished and analyzed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of machine vision detection, and relates to a kind of based on machine vision's cereal quality defect automatic detection method and system. BACKGROUND

[0002] In modern grain processing and storage process, rapid and accurate quality detection of grain is the key link to ensure food safety and improve product value. When the grain is conveyed at high speed on the conveying belt, it is often accompanied by mold, insect damage and other surface defects. How to identify these subtle defects online and non-destructively is a major challenge faced by current automated production lines. Especially in high-speed motion state, the types of defects are diverse and the characteristics are complex, and a single detection method cannot meet the requirements of high precision and high efficiency of industrial production.

[0003] Traditional grain defect detection relies on manual sorting or conventional machine vision systems. Manual sorting is not only inefficient, labor-intensive, and the detection results are easily affected by subjective factors, making it difficult to ensure standardization and stability. While the conventional machine vision system has improved automation, it usually uses a single visible light camera imaging, and has limited recognition ability for internal insect damage or early mold and other defects with inconspicuous color features. More importantly, the mechanical vibration generated by the conveying belt during operation can cause the captured image to be blurred, which seriously reduces the accuracy of defect recognition and becomes a technical bottleneck restricting the improvement of detection performance.

[0004] Based on the above problems, for mold and insect damage defects with completely different physical causes and visual features, traditional methods cannot effectively distinguish and analyze them, resulting in insufficient detection refinement. SUMMARY

[0005] In a first aspect, the application provides a kind of based on machine vision's cereal quality defect automatic detection method, adopt the following technical solutions:

[0006] A kind of based on machine vision's cereal quality defect automatic detection method, comprising the following steps:

[0007] S1, obtain the three-axis vibration data of conveying belt, generate vibration spectrum based on three-axis vibration data Peak figure;

[0008] S2, analyze the main resonance peak amplitude value of vibration spectrum diagram to calculate compensation angle, according to the compensation angle control the deflection direction of the multiple LED modules of annular light source;

[0009] S3, the deflection direction of LED module compensation illumination, drive coaxially arranged visible light camera and near-infrared camera synchronous shooting, generate dual-spectrum fusion image;

[0010] S4, extract the color saturation channel and the surface transmittance channel of the dual-spectrum fusion image, generate mapping data containing the spatial coordinates associated with the potential moldy area and the potential insect-eroded hollow position by identifying the continuous dark area in the color saturation channel and detecting the local transmittance mutation point in the surface transmittance channel;

[0011] S5, receive the grain variety identification input externally, call the pre-stored variety feature library to generate a dynamic judgment template containing moldy threshold conditions and insect-eroded threshold conditions;

[0012] S6, compare the potential moldy area and the potential insect-eroded hollow in the spatial coordinate mapping data based on the moldy threshold conditions and the insect-eroded threshold conditions of the dynamic judgment template, and generate a defect distribution map containing the defect position coordinates.

[0013] Further schemes of the present application, generating a vibration spectrum diagram, comprising the following steps:

[0014] Through the three-axis acceleration sensor installed on the conveying belt support frame, the original vibration waveform in X / Y / Z direction is captured in real time;

[0015] The original vibration waveform is subjected to band-pass filtering processing to generate a filtered time-domain waveform;

[0016] The filtered time-domain waveform is subjected to fast Fourier transform to generate a frequency domain energy distribution diagram;

[0017] The frequency domain energy distribution diagram identifies the main resonance peak position and the corresponding amplitude value to generate a vibration spectrum diagram.

[0018] Further schemes of the present application, calculating a compensation angle, comprising the following steps:

[0019] The frequency value and the acceleration amplitude value of the main resonance peak are extracted from the vibration spectrum diagram;

[0020] The displacement amplitude is calculated according to the acceleration amplitude value and the frequency value;

[0021] The compensation angle is calculated according to the displacement amplitude and the preset vertical distance from the conveying belt surface to the annular light source.

[0022] Further schemes of the present application, controlling the deflection irradiation direction of the multiple LED modules of the annular light source according to the compensation angle, comprising the following steps:

[0023] After the compensation angle is calculated, the multiple LED modules of the annular light source are controlled to deflect the irradiation direction in the opposite direction of the vibration displacement according to the compensation angle;

[0024] The camera exposure time window is synchronously matched, so that the deflection action of the annular light source based on the compensation angle completely covers the exposure period of the camera.

[0025] The further scheme of the present application generates a dual-spectrum fusion image, comprising the following steps:

[0026] The visible light camera and the near-infrared camera arranged coaxially are synchronously driven to take pictures, the color saturation channel is extracted from the visible light image, and the surface transmittance channel is extracted from the near-infrared image;

[0027] The saturation value of the color saturation channel is calculated according to the red channel intensity, the green channel intensity and the blue channel intensity read from the pixels of the visible light image;

[0028] The transmittance value of the surface transmittance channel is calculated according to the ratio of the pixel intensity value of the near-infrared image to the preset reference whiteboard intensity value;

[0029] The color saturation channel and the surface transmittance channel are fused by equal-weighted average fusion according to the same pixel position to generate a dual-spectrum fusion image.

[0030] The further scheme of the present application generates mapping data containing spatial coordinates associated with potential moldy area and potential insect-eroded hollow position, comprising the following steps:

[0031] The adjacent pixel set with a saturation value lower than a preset moldy threshold in the color saturation channel is marked as a potential moldy area;

[0032] The position point with a transmittance gradient change rate exceeding a preset mutation threshold in the surface transmittance channel is marked as a potential insect-eroded hollow;

[0033] All pixel coordinates of the potential moldy area and the potential insect-eroded hollow are traversed to identify and associate their overlapping positions in the image plane, and mapping data containing spatial coordinates associated with the potential moldy area and the potential insect-eroded hollow position are generated.

[0034] The further scheme of the present application generates a dynamic judgment template containing moldy threshold conditions and insect-eroded threshold conditions in combination, comprising the following steps:

[0035] According to the received grain variety identification, the corresponding moldy threshold and the corresponding insect-eroded threshold are retrieved and extracted from the pre-stored variety characteristic library, and the insect-eroded threshold is the mutation threshold;

[0036] The moldy threshold and the insect-eroded threshold of the current variety are extracted to generate a dynamic judgment template containing moldy threshold conditions and insect-eroded threshold conditions in combination.

[0037] The further scheme of the present application compares the potential moldy area and the potential insect-eroded hollow in the spatial coordinate mapping data, comprising the following steps:

[0038] The color saturation value of the potential moldy area marked in the spatial coordinate mapping data is compared with the moldy threshold in the dynamic judgment template, and the saturation value less than the threshold is marked as a moldy defect position.

[0039] The light transmission mutation point density of the potential wormhole marked in the spatial coordinate mapping data is compared with the wormhole threshold in the dynamic determination template, and the area exceeding the threshold is marked as the wormhole defect position.

[0040] In a further aspect of the present application, a defect distribution map containing defect position coordinates is generated, comprising the following steps:

[0041] The intersection of the coordinates of the mold defect and the wormhole defect in the image plane is detected, and the mold-wormhole area that overlaps in space is merged as a composite defect position;

[0042] Finally, all defect marking results are integrated to generate coordinate information containing mold defect positions, wormhole defect positions, and composite defect positions, forming a complete defect distribution map.

[0043] In a second aspect, the present application provides a machine vision-based automatic detection system for quality defects of cereals, which adopts the following technical solution:

[0044] A machine vision-based automatic detection system for quality defects of cereals, comprising the following modules:

[0045] A vibration spectrum feature acquisition module acquires three-axis vibration data of the conveyor belt and generates a vibration spectrum graph based on the three-axis vibration data;

[0046] A dynamic light compensation control module analyzes the main resonance peak amplitude value of the vibration spectrum graph to calculate a compensation angle, and controls the deflection direction of the compensation light of the LED module of the annular light source according to the compensation angle;

[0047] A dual-spectrum image fusion imaging module, the LED module deflection direction of the compensation light, drives the visible light camera and the near-infrared camera arranged coaxially to be synchronously photographed, generating a dual-spectrum fusion image;

[0048] A multi-dimensional defect feature separation and extraction module is used to extract the color saturation channel and the surface transmittance channel of the dual-spectrum fusion image, identify the continuous dark area in the color saturation channel and detect the local light transmittance mutation point in the surface transmittance channel, and generate mapping data containing spatial coordinates associated with potential mold area and potential wormhole position.

[0049] A dynamic determination template generation module is used to receive an external input of a grain variety identification, call a pre-stored variety feature library to generate a dynamic determination template containing mold threshold conditions and wormhole threshold conditions;

[0050] A defect precision classification and positioning module compares the potential mold area and the potential wormhole in the spatial coordinate mapping data based on the mold threshold conditions and the wormhole threshold conditions of the dynamic determination template, and generates a defect distribution map containing defect position coordinates.

[0051] In summary, the present application includes the following beneficial technical effects:

[0052] 1. By actively compensating for vibration interference during conveying, the stability and clarity of image acquisition are significantly improved. The system can monitor the vibration spectrum of the conveying belt in real time and control the illumination angle of the light source in the opposite direction according to the analysis results, thereby physically offsetting the relative displacement caused by vibration. This dynamic light compensation mechanism ensures that the camera can capture high-quality, motion-blur-free images at the exposure moment, laying a solid foundation for subsequent accurate defect analysis and effectively solving the interference problem of high-precision vision detection in industrial vibration environments.

[0053] 2. By using visible light and near-infrared dual-spectrum imaging technology, the depth of grain defect information is mined and complementary analysis is achieved. Visible light images are sensitive to color changes and can effectively extract color saturation features reflecting the degree of moldiness; while near-infrared light has stronger penetration to internal structures, which can reveal the changes in light transmission caused by small cavities under the surface caused by insect damage. By fusing information from these two different spectral bands, the system can obtain more comprehensive and comprehensive defect features than single imaging mode, effectively distinguishing color abnormalities from texture abnormalities, and improving the recognition ability of complex and composite defects.

[0054] 3. It can classify and spatially locate defects in detail, not only recognizing single moldiness or insect damage defects, but also accurately recognizing and labeling composite defect regions where both exist. By establishing a spatial coordinate mapping relationship of different defect features, the system can generate detailed defect distribution maps by merging and analyzing overlapping regions. This fine division and accurate positioning of defect types provide more accurate data support for subsequent sorting, quality grading, and other process links, improving the intelligent level of the entire production line and the product quality control capability. BRIEF DESCRIPTION OF DRAWINGS

[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. The drawings are used to provide further understanding of the present application, and those skilled in the art can obtain other drawings from these drawings without creative labor.

[0056] Fig. 1 The flowchart of the embodiment of the present application is disclosed.

[0057] Fig. 2 The structural schematic diagram of the embodiment of the present application is disclosed. DETAILED DESCRIPTION

[0058] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. All other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0059] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Figs. 1-2 The preferred detailed description of the present application is as follows.

[0060] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Fig. 1 The present application provides a machine vision-based automatic detection method for grain quality defects, comprising the following steps:

[0061] S1, acquiring three-axis vibration data of a conveying belt, and generating a vibration spectrum based on the three-axis vibration data;

[0062] S2, analyzing the main resonance peak amplitude value of the vibration spectrum to calculate a compensation angle, and controlling the deflection direction of the multiple LED modules of the annular light source according to the compensation angle;

[0063] S3, compensating the illumination direction of the LED module deflection, driving the coaxially arranged visible light camera and near-infrared camera to synchronously shoot, and generating a dual-spectrum fusion image;

[0064] S4, extracting the color saturation channel and the surface transmittance channel of the dual-spectrum fusion image, identifying the continuous dark area in the color saturation channel and detecting the local transmittance mutation point in the surface transmittance channel, and generating mapping data containing the spatial coordinates associated with the potential moldy area and the potential worm-eaten hollow position;

[0065] S5, receiving the external input of the grain variety identification, calling the pre-stored variety feature library to generate a dynamic judgment template containing the moldy threshold condition and the worm-eaten threshold condition;

[0066] S6, comparing the potential moldy area and the potential worm-eaten hollow in the spatial coordinate mapping data based on the moldy threshold condition and the worm-eaten threshold condition of the dynamic judgment template, and generating a defect distribution map containing the defect position coordinates.

[0067] In one of the embodiments of the present application, step S1 comprises the following steps:

[0068] The vibration spectrum feature of the conveying belt is acquired, three-axis vibration data of the cereal conveying process is collected by an acceleration sensor and a vibration spectrum diagram is generated, specifically including that a three-axis acceleration sensor is installed on a conveying belt support frame to capture original vibration waveforms in X / Y / Z directions in real time; the original vibration waveforms are subjected to 0.1-5Hz band-pass filtering processing, time-domain waveforms are converted into frequency energy distribution diagrams, main resonance peak positions and amplitude values are marked, and a vibration spectrum diagram is generated.

[0069] Specifically, the three-axis acceleration sensor is installed on the conveying belt support frame, and is used to measure the acceleration changes in three orthogonal directions (X-axis, Y-axis, Z-axis). The setting basis is the industrial sensor standard, and is selected based on the actual installation requirements of the cereal conveying system. The three-axis acceleration sensor captures the vibration waveforms in the X-axis, Y-axis and Z-axis directions generated during the cereal conveying process in real time. The vibration waveforms represent the vibration signal curves in the X-axis, Y-axis and Z-axis directions varying with time. Then, band-pass filtering processing is applied to the captured original vibration waveforms. The original waveform refers to the initial vibration signal data without processing. The filter is set to a frequency range of 0.1HZ-5HZ. The frequency range of 0.1HZ-5HZ refers to allowing signals in the frequency range of 0.1HZ-5HZ to pass through, removing high-frequency mechanical noise interference. Based on the analysis of 200 groups of actual cereal conveying belt measurement data, the frequency band of 0.1HZ-5HZ contains effective vibration signals, and the high-frequency mechanical noise interference refers to irrelevant high-frequency vibration signals (such as high-frequency mechanical noise > 5HZ) from the conveying belt device.

[0070] The filtered time-domain waveforms are converted into frequency energy distribution diagrams by fast Fourier transform. The time-domain waveforms represent the expression form of the vibration signal on the time axis, and the frequency energy distribution diagrams show the energy intensity distribution of the signal at different frequency points. The frequency energy distribution diagrams identify and mark the positions of the main resonance peaks and their corresponding amplitude values. The main resonance peak position refers to the frequency point with the highest energy value in the frequency energy distribution diagram, and the amplitude value refers to the signal amplitude size corresponding to the main resonance peak position. Finally, a vibration spectrum diagram containing the main resonance peak position and amplitude value is generated based on the marked information.

[0071] For example, assuming that the three-axis acceleration sensor is fixedly installed on the support frame during the operation of the cereal conveying belt, the vibration waveforms in the X-axis, Y-axis and Z-axis directions are captured in real time. After applying 0.1HZ-5HZ band-pass filtering to the original waveforms, the high-frequency mechanical noise interference is removed and the effective signals are retained. After conversion to the frequency energy distribution diagram, the main resonance peak position is identified at a frequency of 2HZ, and the amplitude value is 0.5g. The vibration spectrum diagram contains the main resonance peak position and amplitude value information, verifying that the 0.1HZ-5HZ band-pass filtering effectively removes noise and the main resonance peak marking function is normal.

[0072] In one embodiment of the present application, step S2 includes the following steps:

[0073] analyzing the main resonance peak amplitude of the vibration spectrum diagram, calculating the compensation angle , controlling 48 LED modules of the annular light source, according to the compensation angle , the irradiation direction is reversely deflected; the camera exposure time window is synchronously matched, so that the light source compensation action covers the entire exposure period.

[0074] Specifically, the vibration spectrum diagram generated in the analyzing step S1 is analyzed, and the frequency value corresponding to the main resonance peak position is extracted f and the amplitude value a , the displacement amplitude is calculated according to the physical relationship between acceleration and displacement , a is the main resonance peak acceleration amplitude, f is the main resonance peak frequency value. According to the displacement amplitude d and the preset vertical distance from the conveying belt surface to the annular light source L , the compensation angle is calculated , the vertical distance from the conveying belt surface to the annular light source is represented, the preset fixed value is 0.5 m, and the setting basis is the industrial installation standard measurement. Then, 48 LED modules of the annular shadowless light source are controlled, and all the modules are synchronously deflected in the irradiation direction according to the compensation angle , the compensation angle represents the radian value of the LED module deflection. The annular shadowless light source is a lighting device composed of 48 independently controlled light-emitting units arranged in a ring.

[0075] The LED module is the smallest control unit of the light source and has a mechanical deflection function, and the irradiation direction refers to the pointing angle of the light-emitting center of the LED module. At the same time, the camera exposure time window is matched, and the exposure time window refers to the time interval from the start of camera exposure to the end of camera exposure, so that the start and end time of the light source compensation action completely covers the entire exposure period of the camera exposure.

[0076] For example, the vibration spectrum diagram of step S1 obtains the main resonance peak frequency , the acceleration amplitude is 4.9 m / s², the calculated displacement amplitude is ; according to the preset distance L = 0.5 m, it is calculated that radian, 48 LED modules are controlled to be deflected in the vibration direction by 0.062 radian, the camera exposure time window is synchronously matched by 10 ms, and it is ensured that the deflection action covers the entire 10 ms exposure.

[0077] In one embodiment of the present application, step S3 includes the following steps:

[0078] The coaxially arranged visible light camera and near-infrared camera are synchronously driven to take pictures, a color saturation channel is extracted from the visible light image, and a surface transmittance channel is extracted from the near-infrared image; the saturation channel and the transmittance channel are fused by equal-weighted average fusion according to pixel positions to generate a dual-spectrum fusion image.

[0079] Specifically, the coaxially arranged visible light camera and near-infrared camera are synchronously driven to take pictures under the adjusted compensation light, the visible light camera captures images in a wavelength range of 400-700 nm, and the near-infrared camera captures images in a wavelength range of 900-1700 nm. The visible light camera refers to an optical imaging device with a working wavelength range of 400-700 nm, and the near-infrared camera refers to an optical imaging device with a working wavelength range of 900-1700 nm. Coaxial arrangement refers to the optical center axes of the two cameras coinciding to ensure the spatial position alignment of the images. A color space conversion process is applied to the visible light image to extract a color saturation channel, which is a data layer extracted from the visible light image and represents color purity. The saturation value is obtained by calculating the difference between the RGB channel values of each pixel, and satisfies the following formula:

[0080]

[0081] wherein, the saturation value ranges from 0 to 1. the red channel intensity, the green channel intensity, the blue channel intensity, and the red channel intensity, the green channel intensity and the blue channel intensity are directly read from the pixel values obtained by the visible light camera.

[0082] A light transmittance analysis process is applied to the near-infrared image to extract a surface transmittance channel, which is a data layer extracted from the near-infrared image and represents the light transmittance of the material. The transmittance value is obtained by calculating the ratio of the pixel intensity to the reference benchmark, and satisfies the following formula: the transmittance value, the pixel intensity value of the near-infrared image, the pixel intensity value of the reference whiteboard under the same light condition, which is set to 100 gray value through pre-calibration experiment, and the setting basis is the laboratory calibration data. Finally, the color saturation channel and the surface transmittance channel are fused by equal-weighted average fusion according to the same pixel position to generate a dual-spectrum fusion image.

[0083] ​​Exemplarily, under the coverage of the compensation illumination and exposure time window of step S2, the visible light camera and the near-infrared camera are driven to shoot synchronously, and the color saturation channel of the visible light image is extracted, such as the saturation S value at the center pixel position is calculated to be 0.65; the surface transmittance channel of the near-infrared image is extracted, such as the transmittance T value at the same pixel position is calculated to be 0.75; and the S and T channels are weightedly averaged and fused with equal weights according to the pixel position to generate a pixel value of 0.70 for the dual-spectrum fusion image.

[0084] In one embodiment of the present invention, step S4 includes the following steps:

[0085] Continuous dark areas are identified in the color saturation channel and marked as potential moldy areas. Local transmittance mutation points are detected in the surface transmittance channel and marked as potential insect-eaten cavities. A spatial coordinate mapping relationship is established to associate the overlapping positions of moldy areas and cavity areas.

[0086] Specifically, the dual-spectrum fusion image generated in step S3 is received, the saturation value of the color saturation channel and the transmittance value of the surface transmittance channel are separated and extracted from the dual-spectrum fusion image, and each saturation value is compared with the preset mildew threshold value. , the saturation value is lower than the preset mildew threshold The adjacent pixel set of is marked as the potential moldy area. The continuous dark area is the image area attribute identified from the color saturation channel, which is defined as the saturation value below A potential mold area is a set of annotated image coordinates that indicates the location of possible mold defects.

[0087] Calculate the gradient change rate of each pixel transmittance value and compare each gradient change rate with the preset mutation threshold , the gradient change rate exceeds the preset mutation threshold The position point is marked as a potential wormhole. The local transmittance mutation point is the image position attribute detected from the surface transmittance channel, which is defined as the transmittance gradient change rate exceeding the preset mutation threshold. The points are calibrated based on the measured data of 150 sets of worm-eaten grain samples. Potential worm-eaten voids are a set of annotated image points that indicate the locations of possible worm-eaten defects.

[0088] Establish a spatial coordinate mapping relationship, traverse the pixel coordinates of all potential moldy areas and potential insect-eaten cavities, identify and associate their overlapping locations on the image plane, and output spatial coordinate mapping data containing separated color anomaly features, potential moldy areas, and texture anomaly features, potential insect-eaten cavities. The separated defect feature space includes decoupled color anomaly features and texture anomaly features. Decoupling color anomaly and texture anomaly features is the process of separating and identifying color-related and texture-related defect features from the fused image.

[0089] For example, the pixel value of the dual-spectrum fusion image obtained in step S3 is 0.70, the color saturation channel value of the dual-spectrum fusion image is 0.65, and the surface transmittance channel value is 0.75, the preset mold threshold is set to 0.4, and the preset mutation threshold is set to 0.1. In the color saturation channel, a continuous dark area with a saturation lower than the preset mold threshold 0.4, for example, an area containing 50 pixels, is marked as a potential mold area; in the surface transmittance channel, a transmittance gradient change rate higher than the preset mutation threshold 0.1 is detected and marked as a potential wormhole cavity; and the overlapping position of the mold area and the cavity area is associated through spatial coordinate mapping.

[0090] In one embodiment of the present application, step S5 includes the following steps:

[0091] Receiving an external input of a grain variety identification, calling a pre-stored variety feature library to combine mold-worm dual threshold conditions of the current variety, and generating a dynamic judgment template.

[0092] Specifically, an external input of a grain variety identification is received, the grain variety identification representing a currently detected grain variety, such as one of soybeans, red beans, or Dutch beans. Then, a pre-stored variety feature library is called, the pre-stored variety feature library pre-storing mold threshold and worm threshold rules corresponding to different grain varieties. Based on the received variety identification, corresponding mold threshold and worm threshold are extracted from the pre-stored variety feature library, the worm threshold being a mutation threshold, for example, when the grain variety identification is soybeans, the mold threshold condition of saturation value < 0.7 is extracted, and the worm threshold condition of light transmission mutation point density > 12 / mm2 is extracted, the mold threshold condition and the worm threshold condition of the current variety are combined, and a dynamic judgment template containing a dual threshold rule set is generated. The grain variety identification of the dynamic judgment template is an input data item, the attribute being a string enumeration value, and the mold threshold and worm threshold rules corresponding to different grain varieties being set to manual selection or automatic input by a user.

[0093] The pre-stored variety feature library is set to laboratory test data, and is based on 100 groups of different grain variety samples.

[0094] The soybean mold threshold is a judgment rule for soybean rot defect, defined as a defect when the saturation value is < 0.7, and set based on 50 groups of soybean mold sample experimental data analysis. The soybean worm threshold is a judgment rule for soybean worm defect, defined as a defect when the light transmission mutation point density is > 12 / mm2, and set based on 60 groups of soybean worm sample test data. The mold-worm dual threshold condition is a combined logic rule set, including two condition items of the mold threshold and the worm threshold.

[0095] For example, the spatial coordinate mapping data output by step S4 includes a potential moldy area saturation value of 0.35 and a potential insect damage cavity light transmission mutation point density value of 10 / mm2; an external input soybean variety identifier is received, a pre-stored variety characteristic library is called, a soybean mold threshold saturation value <0.7 and a soybean insect damage threshold light transmission mutation point density >12 / mm2 are extracted; a dynamic determination template is generated by combination and includes a mold condition saturation value <0.7 and an insect damage condition light transmission mutation point density >12 / mm2.

[0096] In one embodiment of the present application, step S6 includes the following steps:

[0097] The color saturation of the to-be-tested region is compared with the mold threshold value, and the region exceeding the threshold value is marked as a mold defect; the light transmission mutation point density of the to-be-tested region is compared with the insect damage threshold value, and the region exceeding the threshold value is marked as an insect damage defect; the mold-insect damage region with spatial overlap is merged as a composite defect, and a defect distribution map containing position coordinates is generated.

[0098] Specifically, the feature space data output by step S4 is received, the feature space data includes a set of color saturation values of a potential moldy area and a set of light transmission mutation point density values of a potential insect damage cavity, and the dynamic determination template generated by step S5 is received. The color saturation value of each to-be-tested region is compared with the mold threshold value of the dynamic determination template, and the region with a saturation value exceeding the mold threshold value is marked as a mold defect; the light transmission mutation point density value of each to-be-tested region is compared with the insect damage threshold value of the dynamic determination template, and the region with a mutation point density exceeding the insect damage threshold value is marked as an insect damage defect; the light transmission mutation point density is defined as the number of light transmission rate mutation points per square millimeter of the region.

[0099] Based on the spatial coordinate mapping relationship established in step S4, the spatial overlap position of the mold defect region and the insect damage defect region is detected, the overlapping region is merged and marked as a composite defect, the spatial overlap position refers to the coordinate intersection of the mold defect region and the insect damage defect region on the image plane, and the composite defect represents a region with both mold and insect damage; finally, all defect marking results are integrated to generate coordinate information including the mold defect position, the insect damage defect position and the composite defect position, and a complete defect distribution map is formed.

[0100] Exemplarily, the potential mildew area saturation value of step S4 is 0.35, and the dynamic determination template mildew threshold saturation of step S5 is <0.7. After comparison, the area saturation is 0.75, which does not exceed the standard, and no mildew defect is marked. The step S4 of the wormhole cavity light transmission mutation point density is 10 / mm2, and the step S5 of the wormhole threshold is 12 / mm2. The area does not reach the standard and is not marked as a wormhole defect. Another area saturation is 0.65, which is less than the threshold of 0.7 and is marked as a mildew defect. Another area has a mutation point density of 18 / mm2, which exceeds the threshold of 12 / mm2 and is marked as a wormhole defect. The two areas are spatially overlapped and merged into a composite defect, and finally a defect distribution map containing the marked positions is generated.

[0101] Referring to the accompanying drawings Fig. 2 The present application also proposes a machine vision-based automatic detection system for grain quality defects, comprising the following modules:

[0102] A vibration spectrum feature acquisition module acquires three-axis vibration data of the conveying belt and generates a vibration spectrum graph based on the three-axis vibration data;

[0103] A dynamic light compensation control module analyzes the main resonance peak amplitude value of the vibration spectrum graph to calculate a compensation angle, and controls the deflection direction of the compensation light of the multiple LED modules of the annular light source according to the compensation angle;

[0104] A dual-spectrum image fusion imaging module, the LED module deflection irradiation direction compensation light, driving coaxially arranged visible light camera and near-infrared camera synchronous shooting, generating dual-spectrum fusion image;

[0105] A multi-dimensional defect feature separation and extraction module is used to extract the color saturation channel and the surface transmittance channel of the dual-spectrum fusion image, identify the continuous dark area in the color saturation channel and detect the local transmittance mutation point in the surface transmittance channel, and generate mapping data containing the spatial coordinates associated with the potential mildew area and the potential wormhole cavity position;

[0106] A dynamic determination template generation module is used to receive an external input of a grain variety identification, call a pre-stored variety feature library to generate a dynamic determination template containing a mildew threshold condition and a wormhole threshold condition;

[0107] A defect precision classification and positioning module compares the potential mildew area and the potential wormhole cavity in the spatial coordinate mapping data based on the mildew threshold condition and the wormhole threshold condition of the dynamic determination template, and generates a defect distribution map containing the defect position coordinates.

[0108] It should be noted that the above formulas can be translated into unitless standard values or same-dimension superimposable parameters by the principle of dimensional consistency and mathematical standardization means (for example, normalization processing, dimensionless parameter conversion or unit system unification), so as to eliminate the interference of different dimensions on the operation logic, make the formula have mathematical operation rationality and objective law adaptability while preserving the original data distribution characteristics. The above is only an exemplary embodiment of the present application, and cannot limit the scope of the present application.

[0109] The various modules can be realized by software, hardware and their combination in whole or in part, support hardware form is embedded in or independent of the processor in the computer device, and also support the software form is stored in the memory in the computer device, so as to facilitate the processor to call and execute the operation corresponding to each module.

[0110] It should be noted that the human information (including but not limited to human device information and personal information, etc.) and data (including but not limited to data for analysis, stored data and displayed data, etc.) involved in the present application are all information and data authorized by the human body or fully authorized by all parties. The collection, use and processing of relevant data require relevant legal standards.

[0111] The above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can still be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A method for automatically detecting cereal quality defects based on machine vision, characterized in that: The following steps are involved: S1. Acquire the three-axis vibration data of the conveyor belt and generate a vibration spectrum based on the three-axis vibration data; The original vibration waveform in the X / Y / Z directions is captured in real time by a three-axis acceleration sensor installed on the conveyor belt support frame; Bandpass filtering is performed on the original vibration waveform to generate a filtered time domain waveform; The filtered time domain waveform is fast Fourier transformed to generate a frequency domain energy distribution map; The frequency domain energy distribution diagram identifies the main resonance peak position and the corresponding amplitude value, and generates a vibration spectrum diagram; S2. Analyze the amplitude of the main resonance peak of the vibration spectrum to calculate the compensation angle, and control the deflection illumination direction of the multiple LED modules of the ring light source according to the compensation angle; Extract the frequency value and acceleration amplitude value of the main resonance peak from the vibration spectrum; Calculate the displacement amplitude based on the acceleration amplitude and frequency values; Calculate the compensation angle according to the displacement amplitude and the preset vertical distance from the conveyor belt surface to the annular light source; S3, the LED module deflects the compensating light in the illumination direction, driving the coaxially arranged visible light camera and near-infrared camera to shoot synchronously and generate a dual-spectrum fusion image; Drive the coaxially arranged visible light camera and near-infrared camera to shoot synchronously, extract the color saturation channel from the visible light image, and extract the surface transmittance channel from the near-infrared image; The saturation value of the color saturation channel is calculated based on the red channel intensity, green channel intensity, and blue channel intensity read from the pixels of the visible light image; The transmittance value of the surface transmittance channel is calculated based on the ratio of the pixel intensity value of the near-infrared image to the intensity value of the preset reference white plate; The color saturation channel and the surface transmittance channel are fused by weighted average according to the same pixel position to generate a dual-spectrum fusion image; S4. Extracting the color saturation channel and the surface transmittance channel of the dual-spectral fusion image, identifying continuous dark areas in the color saturation channel and detecting local transmittance mutation points in the surface transmittance channel, and generating mapping data containing spatial coordinates associated with potential moldy areas and potential insect-damaged cavity locations; S5. Receive an externally input grain variety identifier, call a pre-stored variety feature library to combine and generate a dynamic judgment template including a mold threshold condition and an insect-damaged threshold condition; S6. Based on the mildew threshold condition and the insect-eaten threshold condition of the dynamic judgment template, compare the potential mildew area and the potential insect-eaten cavity in the spatial coordinate mapping data to generate a defect distribution map including the defect position coordinates.

2. The method for automatically detecting cereal quality defects based on machine vision according to claim 1, characterized in that: Controlling the deflection illumination directions of multiple LED modules of a ring light source according to a compensation angle includes the following steps: After calculating the compensation angle, the multiple LED modules of the ring light source are controlled to synchronously deflect the illumination direction in the opposite direction of the vibration displacement according to the compensation angle; Synchronously match the camera exposure time window so that the deflection action of the ring light source based on the compensation angle completely covers the camera exposure cycle.

3. The method for automatic detection of cereal quality defects based on machine vision according to claim 1, characterized in that: Generating mapping data containing spatial coordinates correlating potential mold infestation areas with potential insect-infested cavity locations includes the following steps: The adjacent pixel set with a saturation value lower than a preset mildew threshold in the color saturation channel is marked as a potential mildew area; The position points where the rate of change of the transmittance gradient in the surface transmittance channel exceeds the preset mutation threshold are marked as potential worm-eaten cavities; The pixel coordinates of all potential moldy areas and potential insect-eaten cavities are traversed, their overlapping positions on the image plane are identified and associated, and mapping data containing the spatial coordinates associated with the potential moldy areas and the potential insect-eaten cavities are generated.

4. The method for automatically detecting cereal quality defects based on machine vision according to claim 1, characterized in that: Combining and generating a dynamic judgment template including a mildew threshold condition and an insect-eaten threshold condition includes the following steps: According to the received grain variety identification, the corresponding mildew threshold and the corresponding insect-eaten threshold are retrieved and extracted from the pre-stored variety feature library, where the insect-eaten threshold is the mutation threshold; The mold threshold and insect-eaten threshold of the current variety are extracted and combined to generate a dynamic judgment template containing the mold threshold conditions and the insect-eaten threshold conditions.

5. The method for automatically detecting cereal quality defects based on machine vision according to claim 1, characterized in that: Comparing the potential moldy areas and potential insect-infested cavities in the spatial coordinate mapping data includes the following steps: The color saturation value of the potential moldy area marked in the spatial coordinate mapping data is compared with the mold threshold in the dynamic judgment template. The location of the moldy defect is marked if the saturation value is less than the threshold. The density of light transmission mutation points of potential worm-eaten cavities marked in the spatial coordinate mapping data is compared with the worm-eaten threshold in the dynamic judgment template, and the area exceeding the threshold is marked as the worm-eaten defect location.

6. The method for automatically detecting cereal quality defects based on machine vision according to claim 5, characterized in that: Generating a defect distribution map containing defect location coordinates includes the following steps: Detect the coordinate intersection of mold defects and insect-eaten defects on the image plane, and merge the spatially overlapping mold-eaten and insect-eaten areas as the composite defect location; Finally, all defect marking results are integrated to generate coordinate information including the locations of mildew defects, insect damage defects, and composite defects, forming a complete defect distribution map.

7. A system for automatically detecting cereal quality defects based on machine vision, according to the method for automatically detecting cereal quality defects based on machine vision in claim 1, characterized in that: Includes the following modules: The vibration spectrum feature acquisition module acquires the three-axis vibration data of the conveyor belt and generates a vibration spectrum diagram based on the three-axis vibration data; The dynamic illumination compensation control module analyzes the amplitude of the main resonance peak of the vibration spectrum to calculate the compensation angle, and controls the deflection illumination direction of the multiple LED modules of the ring light source according to the compensation angle; The dual-spectral image fusion imaging module uses the LED module to deflect the illumination direction to compensate for the light, driving the coaxially arranged visible light camera and near-infrared camera to synchronously shoot and generate a dual-spectral fusion image; A multi-dimensional defect feature separation and extraction module is used to extract the color saturation channel and surface transmittance channel of the dual-spectral fusion image. By identifying continuous dark areas in the color saturation channel and detecting local transmittance mutation points in the surface transmittance channel, mapping data containing the spatial coordinates linking potential moldy areas and potential insect-damaged cavities is generated; A dynamic judgment template generation module is used to receive an external input grain variety identifier and call a pre-stored variety feature library to generate a dynamic judgment template containing a mold threshold condition and an insect-damaged threshold condition; The defect precision classification and positioning module compares potential moldy areas and potential insect-eaten cavities in the spatial coordinate mapping data based on the mold and insect-eaten threshold conditions of the dynamic judgment template, and generates a defect distribution map containing the defect location coordinates.

Citation Information

Patent Citations

  • Rice disease and pest identification method and system based on machine vision technology

    CN120219861A

  • Multi-scene self-adaptive visual acquisition system and method

    CN120434509A