A method for detecting defects in potatoes
Patent Information
- Application Number
- CN202611053182.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-15
- Publication Date
- 2026-09-29
AI Technical Summary
[0004]但是,马铃薯外形不规则且在输送中姿态持续变化,泥斑、阴影、芽眼纹理和表皮自然色差又容易与真实缺陷形成相似外观
本申请通过在待检测马铃薯滚动过程中获取多个滚动姿态下的可见光图像和多个近红外波段图像,并基于滚动位移信息、采集时序信息以及相邻帧表皮纹理特征点建立表面展开坐标,使同一马铃薯在不同滚动姿态下被采集到的表面区域能够映射至统一坐标基准中。由此,检测过程不再依赖单帧图像或单一固定视角的判断结果,能够在马铃薯外形不规则、局部反光、滚动姿态变化的情况下,对同一疑似区域进行连续追踪,达到减少视角遮挡、区域错配和重复计数的效果。
Smart Images

Figure CN122836076A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of agricultural product quality testing, specifically to a method for detecting defects in potatoes. Background Technology
[0002] Potatoes are prone to defects such as skin damage, green skin, sprouting, rotting, and internal discoloration during harvesting, cleaning, transportation, and storage. These defects can affect subsequent grading, storage, and processing quality. Therefore, continuous and stable defect detection is necessary for individual potatoes during the sorting process.
[0003] Current detection methods mostly employ manual visual inspection, single-view visible light image recognition, thermal imaging, or near-infrared detection. Some solutions expand the field of view through multiple cameras or mirror imaging and use color thresholds, texture features, or learning models to identify defect areas.
[0004] However, potatoes have irregular shapes and their posture changes continuously during transportation. Mud spots, shadows, bud textures, and natural skin color differences can easily resemble real defects. Existing methods typically lack verification of the correspondence between the same suspected area under different postures, different wavelengths, and before and after rescanning. This leads to unstable spatial correspondences of suspected areas, thus affecting the reliability of defect identification. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a method for detecting defects in potatoes, thereby solving the technical problems existing in the prior art.
[0006] The above-mentioned technical objective of the present invention is achieved through the following technical solution: A method for detecting defects in potatoes, comprising the following steps: S1: Make the potato to be tested rotate along the rolling support component in the conveying channel, and acquire visible light images, multiple near-infrared band images and attitude association information corresponding to each frame image of the potato under multiple rolling postures according to the acquisition time sequence. The attitude association information includes rolling displacement information and acquisition time sequence information. S2: Perform contour segmentation on the visible light image. Based on the contour boundaries, epidermal texture feature points and pose association information in adjacent visible light images, map the image regions acquired under multiple rolling poses to the same surface unfolding coordinates to generate the surface unfolding map of the potato to be detected. S3: In the surface unfolded image, visible light candidate anomalous areas are extracted based on color deviation features, texture change features, and edge abrupt change features; in multiple near-infrared band images, near-infrared candidate anomalous areas are extracted based on the response differences between different near-infrared bands; the visible light candidate anomalous areas and near-infrared candidate anomalous areas are matched according to the surface unfolded coordinates to form suspected defect areas; S4: For suspected defect areas, calculate the spatial position consistency, visible light boundary stability, and near-infrared response direction consistency of the adjacent rolling postures. Based on the spatial position consistency, visible light boundary stability, and near-infrared response direction consistency, the suspected defect areas are divided into directly confirmed defect areas, directly excluded interference areas, and suspected defect areas to be resampled. S5: For suspected defect areas to be re-sampled, the re-sampling attitude range is determined according to the position of the suspected defect area in the surface unfolding coordinates; when the suspected defect area to be re-sampled rolls with the potato to be inspected into the re-sampling field of view, the supplementary lighting unit is controlled to switch to the re-sampling band corresponding to the suspected defect area to be re-sampled, and the re-sampling image of the suspected defect area to be re-sampled is acquired. S6: Map the supplementary image onto the surface unfolding coordinates, compare the spatial overlap, boundary change amplitude, and multi-band response change direction of the same suspected defect area to be supplemented before and after supplementation, and obtain the defect area confirmed by supplementation and the interference-free area by supplementation based on the comparison results. S7: The directly confirmed defect area and the supplementary confirmed defect area are used as the confirmed defect area. Based on the area, position, connectivity and multi-band near-infrared response intensity of the confirmed defect area in the surface unfolded coordinates, the defect category and defect level of the potato to be tested are determined, and the corresponding test results are output.
[0007] Preferably, the acquisition of the attitude association information includes: setting a displacement detection component on the rolling support component, and the displacement detection component records the rolling displacement of the potato to be detected when it passes through the acquisition field of view; Whenever the increment of the rolling displacement relative to the previous acquisition trigger position reaches the preset acquisition interval, the visible light acquisition unit and the near-infrared acquisition unit are triggered to acquire images synchronously, and a correspondence is established between the visible light image, multiple near-infrared band images, rolling displacement value and acquisition time obtained at the same trigger moment.
[0008] Preferably, the surface unfolding coordinates include circumferential coordinates and length coordinates; When generating the surface unfolded map, the contour of the potato to be detected is extracted along the principal axis, and the line connecting the center point of the first end and the center point of the second end of the contour in the principal axis direction is used as the length reference line. The length coordinates are established along the length baseline, and the circumferential coordinates are established along the cross-sectional profile direction that intersects the length baseline. The corresponding epidermal texture feature points in adjacent visible light images are used as circumferential matching points, and the arrangement position of each image region in the circumferential coordinates is determined by combining the rolling displacement value.
[0009] Preferably, when determining the circumferential matching point, the gray-level gradient direction, local texture descriptor, and distance to the length-direction baseline are calculated for the epidermal texture feature points in adjacent visible light images. The local texture descriptor is a local binary pattern histogram within the neighborhood of the feature points of the skin texture; When the difference in grayscale gradient direction between two epidermal texture feature points is less than the first direction threshold, the distance between local texture descriptors is less than the first descriptor threshold, and the difference in distance to the length-direction baseline is less than the first distance threshold, the two epidermal texture feature points are determined to be epidermal texture feature points with a corresponding relationship.
[0010] Preferably, when extracting candidate anomalous regions in visible light, the surface unfolded map is first subjected to illumination correction and background normalization, and then a local comparison window is set in the surface unfolded coordinates. The local comparison window is centered on the pixel region to be judged, and the pixel region within the local comparison window that is not marked as abnormal is used as the local reference region. For the pixel region to be judged, calculate the color deviation parameter, texture change parameter, and edge abruptness parameter. The color deviation parameter is the mean distance between the pixel region to be judged and the local reference region in the color space. The texture change parameter is the local binary pattern histogram distance between the pixel region to be judged and the local reference region. The edge abruptness parameter is the gradient magnitude difference between the pixel region to be judged and the local reference region. When any one of the following conditions is met: color deviation parameter is greater than the first color threshold, texture change parameter is greater than the first texture threshold, or edge mutation parameter is greater than the first edge threshold, the corresponding pixel region will be merged into the visible light candidate anomaly region.
[0011] Preferably, the plurality of near-infrared band images include a first near-infrared band image, a second near-infrared band image, and a third near-infrared band image arranged in order of increasing wavelength; When extracting near-infrared candidate anomaly regions, the first near-infrared band image, the second near-infrared band image, and the third near-infrared band image acquired under the same rolling posture are mapped to the surface unfolding coordinates, and the response difference between the first near-infrared band image and the second near-infrared band image, the response difference between the second near-infrared band image and the third near-infrared band image, and the response ratio between the first near-infrared band image and the third near-infrared band image are calculated respectively. When the response difference or response ratio falls into the abnormal response range, the corresponding pixel area is identified as a near-infrared candidate abnormal area. The abnormal response range is determined by the near-infrared response statistics of the defect-free sample set, the surface defect sample set, and the internal defect sample set.
[0012] Preferably, when matching the visible light candidate anomaly region and the near-infrared candidate anomaly region according to the surface unfolded coordinates, the region overlap ratio and the center point distance of the two are calculated respectively. The region overlap ratio is the ratio of the intersection area of the visible light candidate anomaly region and the near-infrared candidate anomaly region in the surface unfolded coordinates to the union area. When the overlap ratio of regions is greater than the first overlap threshold and the distance between the center points is less than the second distance threshold, the corresponding visible light candidate anomaly region and near-infrared candidate anomaly region will be merged into the same suspected defect region. When the visible light candidate anomaly region does not meet the position matching condition with the near-infrared candidate anomaly region, the visible light candidate anomaly region is marked as a visible light single-source suspected defect region. When the near-infrared candidate anomaly region does not meet the position matching condition with the visible light candidate anomaly region, the near-infrared candidate anomaly region is marked as a near-infrared single-source suspected defect region.
[0013] Preferably, when determining the initial processing state of a suspected defect area, the following rules shall be followed: When the spatial position consistency of the same suspected defect area is greater than the first consistency threshold, the visible light boundary stability is greater than the first boundary threshold, and the near-infrared response direction consistency is greater than the first response threshold in at least two adjacent rolling postures, the suspected defect area is determined as a directly confirmed defect area. When the near-infrared response difference corresponding to the suspected defect area of a single visible light source does not fall into the abnormal response range, and the boundary change amplitude of the suspected defect area of a single visible light source under adjacent rolling postures is greater than the third boundary threshold, the suspected defect area of a single visible light source is determined as the area to be directly excluded from interference. When a suspected defect area does not meet the criteria for dividing into a directly confirmed defect area and a directly excluded interference area, the suspected defect area is designated as a suspected defect area to be re-sampled.
[0014] Preferably, when determining the supplementary mining attitude range, the starting supplementary mining rolling displacement when the suspected defect area to be supplemented enters the supplementary mining field of view and the ending supplementary mining rolling displacement when leaving the supplementary mining field of view are calculated based on the circumferential coordinates of the suspected defect area to be supplemented in the surface unfolded coordinates, the current rolling displacement value, and the coverage range of the supplementary mining field of view in the surface unfolded coordinates. When the real-time rolling displacement is between the starting and ending rolling displacements, the supplementary lighting unit and the image acquisition unit are triggered to perform supplementary sampling. When the suspected defect area to be sampled originates from a single-source suspected defect area in visible light, the sampling band will be determined as the near-infrared sampling band. When the suspected defect area to be supplemented originates from the near-infrared single-source suspected defect area, the supplementation band is determined to be the visible light supplementation band and the near-infrared band corresponding to the near-infrared single-source suspected defect area.
[0015] Preferably, when performing rescan consistency confirmation, the rescanned area in the rescanned image is mapped to the surface unfolding coordinates, and the spatial overlap, boundary change amplitude, and multi-band response change direction between the rescanned area and the suspected defect area to be rescanned before rescanning are calculated. When the spatial overlap is greater than the second overlap threshold, the boundary change amplitude is less than the second boundary threshold, and the multi-band response change direction is consistent with that before the supplementary mining, the suspected defect area to be supplemented is identified as the confirmed defect area for supplementary mining. When any of the following conditions are met: spatial overlap is not greater than the second overlap threshold, boundary change amplitude is not less than the second boundary threshold, or the multi-band response change direction is inconsistent with that before the supplementary mining, the suspected defect area to be supplemented is determined as the supplementary mining interference elimination area.
[0016] In summary, the present invention has the following main beneficial effects: This application acquires visible light images and near-infrared images under multiple rolling postures of a potato during its rolling process. Based on rolling displacement information, acquisition timing information, and surface texture feature points from adjacent frames, it establishes surface unfolding coordinates, enabling the surface areas of the same potato acquired under different rolling postures to be mapped to a unified coordinate reference. Therefore, the detection process no longer relies on the judgment results of a single frame image or a single fixed viewpoint. It can continuously track the same suspected area even when the potato has irregular shape, localized reflections, or changing rolling postures, thereby reducing viewpoint occlusion, area mismatch, and duplicate counting.
[0017] By extracting visible light and near-infrared candidate anomalous regions from the surface unfolded coordinates, and performing co-domain matching based on the region overlap ratio and center point distance, visible light and near-infrared anomalies can be mapped to the same potato surface location for judgment. This allows for the combined analysis of surface color anomalies, texture interruptions, edge abrupt changes, and near-infrared response differences, avoiding misjudging mud spots, shadows, bud textures, and natural skin color differences as defects based solely on color thresholds or single image features. Simultaneously, it preserves candidate regions for internal defects that show weak visible light performance but persistent near-infrared anomalies, thereby improving the accuracy of distinguishing between surface and internal defects.
[0018] By dividing the suspected defect area into a direct confirmation defect area, a direct exclusion interference area, and a suspected defect area requiring resampling, and determining the resampling posture range for the suspected defect area requiring resampling based on its circumferential coordinates, current rolling displacement value, and resampling field of view coverage, the corresponding resampling band is switched for directional resampling when the area enters the resampling field of view. Therefore, the detection process does not involve repeatedly sampling the entire potato, nor does it output the result directly after a single identification. Instead, it involves rescanning the same suspected area that is difficult to confirm for consistency verification, and determining the final result based on the spatial overlap before and after resampling, the magnitude of boundary changes, and the consistency of multi-band response change directions. This achieves the effects of reducing misjudgments due to non-defect interference, reducing missed detections, and improving the stability of online sorting results. Attached Figure Description
[0019] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Example 1 refer to Figure 1 A method for detecting defects in potatoes, comprising the following steps: S1: Make the potato to be tested rotate along the rolling support component in the conveying channel, and acquire visible light images, multiple near-infrared band images and attitude association information corresponding to each frame image of the potato under multiple rolling postures according to the acquisition time sequence. The attitude association information includes rolling displacement information and acquisition time sequence information. S2: Perform contour segmentation on the visible light image. Based on the contour boundaries, epidermal texture feature points and pose association information in adjacent visible light images, map the image regions acquired under multiple rolling poses to the same surface unfolding coordinates to generate the surface unfolding map of the potato to be detected. S3: In the surface unfolded image, visible light candidate anomalous areas are extracted based on color deviation features, texture change features, and edge abrupt change features; in multiple near-infrared band images, near-infrared candidate anomalous areas are extracted based on the response differences between different near-infrared bands; the visible light candidate anomalous areas and near-infrared candidate anomalous areas are matched according to the surface unfolded coordinates to form suspected defect areas; S4: For suspected defect areas, calculate the spatial position consistency, visible light boundary stability, and near-infrared response direction consistency of the adjacent rolling postures. Based on the spatial position consistency, visible light boundary stability, and near-infrared response direction consistency, the suspected defect areas are divided into directly confirmed defect areas, directly excluded interference areas, and suspected defect areas to be resampled. S5: For suspected defect areas to be re-sampled, the re-sampling attitude range is determined according to the position of the suspected defect area in the surface unfolding coordinates; when the suspected defect area to be re-sampled rolls with the potato to be inspected into the re-sampling field of view, the supplementary lighting unit is controlled to switch to the re-sampling band corresponding to the suspected defect area to be re-sampled, and the re-sampling image of the suspected defect area to be re-sampled is acquired. S6: Map the supplementary image onto the surface unfolding coordinates, compare the spatial overlap, boundary change amplitude, and multi-band response change direction of the same suspected defect area to be supplemented before and after supplementation, and obtain the defect area confirmed by supplementation and the interference-free area by supplementation based on the comparison results. S7: The directly confirmed defect area and the supplementary confirmed defect area are used as the confirmed defect area. Based on the area, position, connectivity and multi-band near-infrared response intensity of the confirmed defect area in the surface unfolded coordinates, the defect category and defect level of the potato to be tested are determined, and the corresponding test results are output.
[0022] The defect detection method in this embodiment is executed by a detection system. The detection system includes a conveying channel, a rolling support component, a visible light acquisition unit, a near-infrared acquisition unit, a supplementary lighting unit, a displacement detection component, a controller, and a sorting execution component.
[0023] The conveying channel allows the potatoes to be tested to enter the testing area one by one. A rolling support component is located within the conveying channel to support the potatoes and cause them to roll during forward conveying. The rolling support component can be a roller assembly, a roller assembly with guide surfaces, or a support structure that causes the potatoes to roll along their outer surface. This embodiment does not require the potatoes to roll in a regular sphere or cylinder shape, as long as their different surface areas enter the field of view sequentially during rolling.
[0024] The visible light acquisition unit is used to acquire visible light images of the potato under inspection in multiple rolling postures. The near-infrared acquisition unit is used to acquire images of the potato under inspection in multiple near-infrared bands. These multiple near-infrared band images include a first near-infrared band image, a second near-infrared band image, and a third near-infrared band image arranged in ascending order of wavelength. When the near-infrared acquisition unit is configured with more than three near-infrared bands, the controller selects three bands in ascending order of wavelength as the first, second, and third near-infrared band images, or selects three near-infrared bands as the first, second, and third near-infrared band images based on the distinguishability of different defect categories in the calibration sample set.
[0025] The displacement detection component records the rolling displacement of the potato being inspected as it passes through the acquisition field of view. The displacement detection component can be an encoder, a photoelectric displacement detection component, or an angle detection component connected to the rolling support component. The controller establishes a correspondence between the rolling displacement value, the acquisition time, the visible light image, and multiple near-infrared band images to form attitude correlation information. This attitude correlation information is used to map image regions under different rolling attitudes to the same surface unfolded coordinate system.
[0026] Before formal testing, a calibration sample set is established. The calibration sample set includes a defect-free sample set, a surface defect sample set, and an internal defect sample set. The defect-free sample set consists of potatoes that, after manual visual inspection, show no surface damage, green skin, sprouting, or rot. The surface defect sample set consists of potatoes that, after manual visual inspection, are confirmed to have surface damage, green skin, sprouting, rot, or shallow bruising. The internal defect sample set consists of potatoes that, after near-infrared spectroscopy and subsequent slice verification or quality inspection, are confirmed to have internal dark discoloration, internal rot, or internal tissue abnormalities.
[0027] In this embodiment, the first direction threshold, first descriptor threshold, first distance threshold, first color threshold, first texture threshold, first edge threshold, first overlap threshold, second distance threshold, first consistency threshold, first boundary threshold, first response threshold, third boundary threshold, second overlap threshold, second boundary threshold, and second response threshold are all obtained by statistical calibration from the calibration sample set.
[0028] Specifically, the controller divides the calibration sample set into a training and calibration section and a validation section. The training and calibration section is used to statistically analyze the distribution range of defect-free samples, surface defect samples, and internal defect samples in terms of color deviation, texture variation, edge abruptness, region overlap, boundary variation, near-infrared response differences, and response direction consistency. The validation section is used to validate candidate thresholds. The controller selects the corresponding threshold based on the defect sample recognition rate, the defect-free sample misclassification rate, and actual quality inspection requirements. This threshold is not an arbitrarily set empirical value, but is jointly determined by the calibration sample set and the validation section.
[0029] The abnormal response interval is determined by the near-infrared response statistics of the defect-free sample set, the surface defect sample set, and the internal defect sample set. For the response difference between the first and second near-infrared band images, the response difference between the second and third near-infrared band images, and the response ratio between the first and third near-infrared band images, the controller statistically analyzes the parameter distributions in the defect-free, surface defect, and internal defect sample sets, respectively. When a parameter's distribution interval in the defect sample set has a distinguishable boundary with the main distribution interval in the defect-free sample set, the defect sample distribution interval corresponding to that parameter is defined as the abnormal response interval; when a parameter exhibits a unilateral anomaly, the range greater than or less than the corresponding boundary value is defined as the abnormal response interval.
[0030] The Level 1, Level 2, and Level 3 defect ranges are determined by a combination of manual quality inspection conclusions, the area percentage of confirmed defective areas, and the multi-band near-infrared response intensity. The controller uses samples judged as minor defects, usable defects, and rejectable defects in the manual quality inspection as level calibration samples, and calculates the area percentage range and multi-band near-infrared response intensity range corresponding to each level of samples, thereby determining the defect level range.
[0031] During detection, the potato to be tested enters the conveyor channel and rolls continuously under the action of the rolling support component. The displacement detection component records the rolling displacement of the potato as it passes through the acquisition field of view. The controller uses the previous acquisition trigger position as a reference, and when the increment of the current rolling displacement relative to the previous acquisition trigger position reaches the preset acquisition interval, it triggers the visible light acquisition unit and the near-infrared acquisition unit to synchronously acquire images.
[0032] At the same trigger moment, the visible light acquisition unit acquires one frame of visible light image, while the near-infrared acquisition unit acquires images in the first, second, and third near-infrared bands. The controller binds the visible light image, the first near-infrared image, the second near-infrared image, the third near-infrared image, the rolling displacement value, and the acquisition time at the same trigger moment into a set of attitude data. As the potato to be detected continues to roll, the controller acquires multiple sets of attitude data, each set corresponding to a rolling posture of the potato to be detected.
[0033] Using the acquisition method described above, subsequent processing does not rely on all surface information in a single frame image, but rather on a continuous sequence of images under multiple rolling postures. This avoids localized missed detections caused by irregular potato shapes, partial occlusion, or reflections from a single viewpoint.
[0034] The controller performs contour segmentation on each frame of the visible light image to obtain the contour region of the potato to be detected. Contour segmentation can be performed using a combination of background subtraction, color space segmentation, edge extraction, and morphological closing operations. After contour segmentation, the controller extracts the principal axis of the contour region, using the line connecting the center points of the first and second ends of the contour along the principal axis as the length reference line.
[0035] The first end center point and the second end center point are the end section center points of the contour at both ends in the main axis direction, respectively. Specifically, the controller intercepts the contour end region along a direction perpendicular to the main axis direction, and takes the midpoint of the contour width direction within the end region as the corresponding end center point.
[0036] The surface unfolded coordinate system includes circumferential and longitudinal coordinates. The longitudinal coordinates are established along a longitudinal baseline, while the circumferential coordinates are established along the cross-sectional contour direction intersecting the longitudinal baseline. For a pixel within the contour region, the controller determines the longitudinal coordinate based on the pixel's projection position along the longitudinal baseline. Due to the irregular shape of potatoes, the surface unfolded coordinate system in this embodiment does not require reconstructing the absolute area of the true three-dimensional surface. Instead, it is used to normalize the image regions of the same potato under different rolling postures to the same two-dimensional coordinate reference, so as to compare the performance of the same suspected region under different postures and different wavelengths.
[0037] When establishing the circumferential coordinates, the controller first extracts the effective unfolded band located in the center region of the acquisition field of view in each frame of visible light image. The effective unfolded band is an image strip-shaped region distributed around the length-direction baseline and located within the clear imaging area. The controller uses the roll displacement value corresponding to the k-th frame as the base position of this effective unfolded band in the circumferential coordinates, and then uses skin texture feature point matching between adjacent frames to correct the circumferential position.
[0038] Specifically, for skin texture feature points in adjacent visible light images, the gray-level gradient direction, local texture descriptor, and distance to the length-direction baseline are calculated respectively. The local texture descriptor uses the local binary pattern histogram within the neighborhood of the skin texture feature point. If the difference in gray-level gradient direction between two skin texture feature points is less than a first direction threshold, the distance between local texture descriptors is less than a first descriptor threshold, and the difference in distance to the length-direction baseline is less than a first distance threshold, then the controller determines the two skin texture feature points as corresponding skin texture feature points and uses them as circumferential matching points.
[0039] The controller determines the circumferential offset between adjacent frames based on corresponding epidermal texture feature points in adjacent frames, and uses this circumferential offset to correct the basic circumferential position obtained from the roll displacement. The controller determines the arrangement position of each image region in the circumferential coordinate system based on the roll displacement value and the circumferential offset, and stitches together each effective unfolded zone to form a surface unfolded map. Thus, the image regions of the potato under detection acquired under multiple rolling postures are mapped to the same surface unfolded coordinate system.
[0040] After obtaining the surface unfolded map, the controller first performs illumination correction and background normalization on the map. Illumination correction is used to eliminate brightness differences caused by uneven lighting and surface curvature, while background normalization is used to ensure that the skin background color of different batches of potatoes is within a comparable range.
[0041] Subsequently, the controller sets up a local comparison window in the surface unfolding coordinates. The local comparison window is centered on the pixel region to be judged, and uses the pixel regions within the local comparison window that are not marked as abnormal as the local reference region. During the initial execution, the controller first performs an initial screening based on the median of the color and texture values within the window, designating regions that deviate significantly from the median as temporary abnormal regions, and using the remaining regions as the local reference region; after completing one round of abnormal region marking, the local reference region is updated with the pixel regions that are not marked as abnormal.
[0042] For each pixel region to be judged, the controller calculates a color deviation parameter, a texture variation parameter, and an edge abruptness parameter. The color deviation parameter is the mean distance between the pixel region to be judged and the local reference region in the color space. The texture variation parameter is the local binary pattern histogram distance between the pixel region to be judged and the local reference region. The edge abruptness parameter is the difference in gradient magnitude between the pixel region to be judged and the local reference region.
[0043] When any one of the following conditions is met: color deviation parameter is greater than the first color threshold, texture change parameter is greater than the first texture threshold, or edge abrupt change parameter is greater than the first edge threshold, the controller merges the corresponding pixel region into the visible light candidate anomaly region. Adjacent or interconnected anomaly pixel regions are merged into a single visible light candidate anomaly region after connecting region merging.
[0044] In this way, visible light candidate anomaly regions are not determined solely by a single color threshold, but rather by a combination of color deviation, texture variation, and edge abrupt changes. For local anomalies caused by mud spots, shadows, and natural skin color differences, this embodiment will further evaluate them using near-infrared response, adjacent pose consistency, and rescanning.
[0045] The controller maps the first, second, and third near-infrared band images acquired under the same rolling posture to surface unfolding coordinates. The mapping uses the same posture association information and circumferential correction as the visible light images, ensuring that the same potato surface location has consistent coordinates in both the visible light images and the multiple near-infrared band images.
[0046] For the region to be determined in the surface unfolding coordinates The controller calculates the response difference between the first near-infrared band image and the second near-infrared band image, the response difference between the second near-infrared band image and the third near-infrared band image, and the response ratio between the first near-infrared band image and the third near-infrared band image, respectively. ; ; ; in, Indicates the region to be judged The response difference between the first near-infrared band image and the second near-infrared band image; Indicates the region to be judged The response difference between the second near-infrared band image and the third near-infrared band image; Indicates the region to be judged The response ratio between the first near-infrared band image and the third near-infrared band image; , and These represent the regions to be judged. Mean response in the first near-infrared band image, the second near-infrared band image, and the third near-infrared band image; This indicates a positive number used to avoid a denominator of zero.
[0047] when , or When the error falls into the corresponding abnormal response range, the controller will determine the area to be judged. A candidate near-infrared anomalous region is identified. Adjacent or interconnected near-infrared anomalous pixel regions are merged into a single near-infrared candidate anomalous region after connecting region merging.
[0048] By extracting near-infrared candidate anomalous regions, we can preserve candidate regions of internal defects that are not obvious in visible light images but have persistent abnormalities in near-infrared response; at the same time, we can also distinguish regions that are obvious only in visible light images but do not show abnormalities in near-infrared response.
[0049] The controller performs position matching between visible light candidate anomalous regions and near-infrared candidate anomalous regions according to surface unfolding coordinates. For a visible light candidate anomalous region... and a near-infrared candidate anomaly region The controller calculates the overlap ratio of their regions and the distance between their center points. The overlap ratio is calculated using the following formula: ; in, Indicates candidate anomalous regions in visible light With near-infrared candidate anomaly region The percentage of overlap between the regions; This represents the area of intersection of the two in the surface unfolded coordinate system; This represents the area of the union of the two in the surface unfolded coordinate system.
[0050] The center-point distance is the Euclidean distance between the center points of the visible light candidate anomaly area and the near-infrared candidate anomaly area. When the area overlap ratio is greater than a first overlap threshold and the center-point distance is less than a second distance threshold, the controller merges the corresponding visible light candidate anomaly area and near-infrared candidate anomaly area into the same suspected defect area. When the visible light candidate anomaly area does not meet the position matching condition with the near-infrared candidate anomaly area, the controller marks the visible light candidate anomaly area as a visible light single-source suspected defect area. When the near-infrared candidate anomaly area does not meet the position matching condition with the visible light candidate anomaly area, the controller marks the near-infrared candidate anomaly area as a near-infrared single-source suspected defect area.
[0051] The aforementioned location matching process ensures that visible light anomalies and near-infrared anomalies are not simply output side-by-side, but rather that they are determined within the same surface coordinate system to determine whether they correspond to the same potato surface region. This avoids region mismatch due to changes in viewing angle and also prevents anomalies from different surface locations from being mistakenly merged into the same defect.
[0052] For each suspected defect area, the controller calculates its spatial position consistency, visible light boundary stability, and near-infrared response direction consistency under adjacent rolling postures.
[0053] Spatial location consistency is determined by the degree of overlap of the same suspected defect area after mapping to surface unfolded coordinates in adjacent rolling postures. Visible light boundary stability is determined by the changes in boundary length and boundary position of the suspected defect area under adjacent rolling postures. Near-infrared response direction consistency is determined by the similarity of the directions of the near-infrared response vectors under adjacent rolling postures. The near-infrared response vector consists of the response difference between the first and second near-infrared band images, the response difference between the second and third near-infrared band images, and the response ratio between the first and third near-infrared band images.
[0054] When the spatial position consistency of the same suspected defect area is greater than the first consistency threshold, the visible light boundary stability is greater than the first boundary threshold, and the near-infrared response direction consistency is greater than the first response threshold in at least two adjacent rolling postures, the controller determines the suspected defect area as a directly confirmed defect area.
[0055] When the near-infrared response difference corresponding to a suspected defective region of a single visible light source does not fall within the abnormal response range, and the boundary change amplitude of the suspected defective region of a single visible light source under adjacent rolling attitudes is greater than the third boundary threshold, the controller determines the suspected defective region of a single visible light source as a region to be directly excluded from interference. The boundary change amplitude here can be represented by a value minus the visible light boundary stability.
[0056] When a suspected defect area does not meet the criteria for being classified as a directly confirmed defect area or a directly excluded interference area, the controller designates the suspected defect area as a suspected defect area to be supplemented. This suspected defect area is not directly output as a defect but instead enters the subsequent targeted supplementary sampling process.
[0057] For a suspected defect area to be replenished, the controller calculates the initial replenishment rolling displacement when the suspected defect area enters the replenishment field of view and the final replenishment rolling displacement when it leaves the replenishment field of view, based on its circumferential coordinates in the surface unfolded coordinates, the current rolling displacement value, and the coverage area of the replenishment field of view in the surface unfolded coordinates.
[0058] When calculating the replenishment attitude range, the controller uses the current rolling displacement value when determining the suspected defect area to be replenished as the calculation benchmark. Let the current rolling displacement value be... The center position of the suspected defect area to be re-mined in the circumferential coordinate system is: The coverage area of the supplementary mining site in the circumferential coordinate system is: The initial rolling displacement and the final rolling displacement are respectively: ; ; in, Indicates the initial rolling displacement for replenishment; This indicates the termination of the rolling displacement for supplementary mining; This indicates the current rolling displacement value when a suspected defect area to be re-mined is identified; This indicates the center position of the suspected defect area to be re-sampled in the circumferential coordinate system. Indicates the starting circumferential coordinates of the coverage area at the supplementary mining site; This indicates the circumferential coordinates of the termination of the coverage area at the supplementary mining site.
[0059] When the real-time rolling displacement is between the initial and final rolling displacements, the controller triggers the supplementary lighting unit and image acquisition unit to perform supplementary sampling. If the calculated initial rolling displacement is greater than the final rolling displacement, the controller divides the corresponding interval according to the periodic boundary of the surface unfolding coordinates and determines whether the real-time rolling displacement enters the divided supplementary sampling interval.
[0060] When the suspected defect area to be sampled originates from a single-source visible light defect area, the controller determines the sampling band to be the near-infrared sampling band to determine whether there is a corresponding near-infrared anomalous response to the visible light anomaly. When the suspected defect area to be sampled originates from a single-source near-infrared defect area, the controller determines the sampling band to be both the visible light sampling band and the near-infrared band corresponding to the suspected near-infrared defect area to determine whether the near-infrared anomaly has a visible light boundary or whether it persists in the near-infrared band. When the suspected defect area to be sampled has both visible light and near-infrared anomalies but the consistency parameters do not meet the direct confirmation criteria, the controller selects the visible light sampling band and the near-infrared band with the highest corresponding anomaly degree for sampling.
[0061] In this way, the re-sampling does not involve repeatedly photographing the entire potato. Instead, the timing and wavelength of the re-sampling are determined based on the surface coordinates of the suspected defective area to be re-sampled, so that the re-sampling process is performed on the suspected area.
[0062] After the supplementary sampling is completed, the controller maps the supplementary sampling area in the supplementary sampling image to the surface unfolding coordinates, and calculates the spatial overlap, boundary change amplitude, and consistency of multi-band response change direction between the supplementary sampling area and the suspected defect area to be supplemented before supplementary sampling.
[0063] Spatial overlap is determined by the degree of overlap between the re-mining area and the suspected defect area to be re-mined before re-mining in the surface unfolding coordinates. Boundary change amplitude is determined by the changes in boundary length and boundary position between the re-mining area and the suspected defect area to be re-mined before re-mining. Consistency of multi-band response change direction is determined by the consistency of the angle between the near-infrared response vectors before and after re-mining.
[0064] Let the near-infrared response vector before the supplementary sampling be... The near-infrared response vector after supplementary sampling is The consistency of the direction of change in multi-band response is calculated using the following formula: ; in, This indicates that the direction of change in the multi-band response is consistent before and after the supplementary sampling; This represents the near-infrared response vector of the suspected defect area to be sampled before the supplementary sampling; This represents the near-infrared response vector of the area after the supplementary sampling; This indicates a positive number used to avoid a denominator of zero. The near-infrared response vector includes the response difference between the first and second near-infrared band images, the response difference between the second and third near-infrared band images, and the response ratio between the first and third near-infrared band images.
[0065] The consistency of the direction of change in the multi-band response before and after the supplementary extraction refers to the consistency of the direction of change in the multi-band response before and after the supplementary extraction. The response threshold is greater than the second response threshold. The second response threshold is obtained by statistically analyzing confirmed defect samples and non-defect interference samples in the calibration sample set. Since defect samples usually maintain similar near-infrared response directions before and after re-sampling, while non-defect interference samples usually show changes in response direction or disappearance of abnormal response before and after re-sampling, the controller uses the second response threshold as the dividing line between the two.
[0066] When the spatial overlap is greater than the second overlap threshold, the boundary change amplitude is less than the second boundary threshold, and the consistency of the multi-band response change direction is greater than the second response threshold, the controller determines the suspected defect area to be supplemented as a confirmed defect area for supplementation. When any one of the following conditions is met: spatial overlap is not greater than the second overlap threshold, boundary change amplitude is not less than the second boundary threshold, and the consistency of the multi-band response change direction is not greater than the second response threshold, the controller determines the suspected defect area to be supplemented as a region for interference elimination during supplementation.
[0067] This rescan consistency verification process is used to distinguish between real defects and non-defect interference. Real defects have relatively stable spatial positions, boundary morphologies, and near-infrared response directions at the same surface coordinate positions; mud spots, shadows, reflections, and local water marks tend to exhibit unstable spatial positions, significant boundary changes, or inconsistent response directions during rescanning.
[0068] The controller designates directly identified defect areas and re-identified defect areas as confirmed defect areas, and directly excluded interference areas and re-identified interference areas as non-defect interference areas. For confirmed defect areas, the controller determines the defect type and defect level of the potato to be inspected based on its area, location, connectivity, and multi-band near-infrared response intensity in the surface unfolded coordinate system.
[0069] The area ratio of the confirmed defect region is the ratio between the area of the confirmed defect region and the effective unfolded area of the potato to be inspected. The multi-band near-infrared response intensity is jointly determined by the response difference between the first and second near-infrared band images, the response difference between the second and third near-infrared band images, and the response ratio between the first and third near-infrared band images. The weights of each parameter are determined by the calibration sample set.
[0070] When determining the defect category, if the defect area is confirmed to primarily exhibit abrupt changes in visible light boundaries and texture interruptions, and its near-infrared response intensity falls within the response range corresponding to the surface defect sample set, the controller classifies it as a surface damage defect. If the defect area is confirmed to primarily exhibit color deviation and a patchy distribution in the surface unfolding coordinates, the controller classifies it as a green skin defect. If the defect area is confirmed to have protruding boundaries or bud textures in the visible light image, and its position remains stable under adjacent rolling postures, the controller classifies it as a sprouting defect. If the defect area is confirmed to simultaneously exhibit visible light dark color anomalies, boundary diffusion characteristics, and near-infrared response anomalies, the controller classifies it as a decay defect. If the visible light anomaly of the defect area is weak, but the near-infrared response consistently falls within the abnormal response range corresponding to the internal defect sample set before and after re-sampling, the controller classifies it as an internal darkening defect.
[0071] The defect level is determined based on the area proportion of the confirmed defective region and the multi-band near-infrared response intensity. The controller pre-determines the first-level defect interval, second-level defect interval, and third-level defect interval based on the calibration sample set. When the area proportion of the confirmed defective region and the multi-band near-infrared response intensity fall within the first-level defect interval, a first-level defect level is output; when they fall within the second-level defect interval, a second-level defect level is output; and when they fall within the third-level defect interval, a third-level defect level is output. If multiple confirmed defective regions exist for the same potato to be inspected, the controller uses the highest defect level as the final defect level for that potato and retains the category, area, location, and response intensity of each confirmed defective region as a detection record.
[0072] The test results include the defect type, defect level, confirmed location of the defect area in the surface unfolding coordinates, and sorting instructions for the potatoes to be tested. Based on the test results, the sorting unit guides the potatoes to be tested into the qualified channel, surface defect channel, internal defect channel, or re-inspection channel.
[0073] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for detecting defects in potatoes, characterized in that, Includes the following steps: S1: Make the potato to be tested rotate along the rolling support component in the conveying channel, and acquire visible light images, multiple near-infrared band images and attitude association information corresponding to each frame image of the potato under multiple rolling postures according to the acquisition time sequence. The attitude association information includes rolling displacement information and acquisition time sequence information. S2: Perform contour segmentation on the visible light image. Based on the contour boundaries, epidermal texture feature points and pose association information in adjacent visible light images, map the image regions acquired under multiple rolling poses to the same surface unfolding coordinates to generate the surface unfolding map of the potato to be detected. S3: In the surface unfolded image, visible light candidate anomalous areas are extracted based on color deviation features, texture change features, and edge abrupt change features; in multiple near-infrared band images, near-infrared candidate anomalous areas are extracted based on the response differences between different near-infrared bands; the visible light candidate anomalous areas and near-infrared candidate anomalous areas are matched according to the surface unfolded coordinates to form suspected defect areas; S4: For suspected defect areas, calculate the spatial position consistency, visible light boundary stability, and near-infrared response direction consistency of the adjacent rolling postures. Based on the spatial position consistency, visible light boundary stability, and near-infrared response direction consistency, the suspected defect areas are divided into directly confirmed defect areas, directly excluded interference areas, and suspected defect areas to be resampled. S5: For suspected defect areas to be re-sampled, the re-sampling attitude range is determined according to the position of the suspected defect area in the surface unfolding coordinates; when the suspected defect area to be re-sampled rolls with the potato to be inspected into the re-sampling field of view, the supplementary lighting unit is controlled to switch to the re-sampling band corresponding to the suspected defect area to be re-sampled, and the re-sampling image of the suspected defect area to be re-sampled is acquired. S6: Map the supplementary image onto the surface unfolding coordinates, compare the spatial overlap, boundary change amplitude, and multi-band response change direction of the same suspected defect area to be supplemented before and after supplementation, and obtain the defect area confirmed by supplementation and the interference-free area by supplementation based on the comparison results. S7: The directly confirmed defect area and the supplementary confirmed defect area are used as the confirmed defect area. Based on the area, position, connectivity and multi-band near-infrared response intensity of the confirmed defect area in the surface unfolded coordinates, the defect category and defect level of the potato to be tested are determined, and the corresponding test results are output.
2. The method for detecting defects in potatoes according to claim 1, characterized in that, The acquisition of the attitude association information includes: setting a displacement detection component on the rolling support component, and the displacement detection component recording the rolling displacement of the potato to be detected when it passes through the acquisition field of view; Whenever the increment of the rolling displacement relative to the previous acquisition trigger position reaches the preset acquisition interval, the visible light acquisition unit and the near-infrared acquisition unit are triggered to acquire images synchronously, and a correspondence is established between the visible light image, multiple near-infrared band images, rolling displacement value and acquisition time obtained at the same trigger moment.
3. The method for detecting defects in potatoes according to claim 2, characterized in that, The surface unfolding coordinates include circumferential coordinates and length coordinates; When generating the surface unfolded map, the contour of the potato to be detected is extracted along the principal axis, and the line connecting the center point of the first end and the center point of the second end of the contour in the principal axis direction is used as the length reference line. The length coordinates are established along the length baseline, and the circumferential coordinates are established along the cross-sectional profile direction that intersects the length baseline. Corresponding epidermal texture feature points in adjacent visible light images are used as circumferential matching points, and the arrangement position of each image region in the circumferential coordinates is determined by combining the rolling displacement value.
4. The method for detecting defects in potatoes according to claim 3, characterized in that, When determining the circumferential matching point, the gray-level gradient direction, local texture descriptor and distance to the length baseline are calculated for the epidermal texture feature points in adjacent visible light images; The local texture descriptor is a local binary pattern histogram within the neighborhood of the feature points of the skin texture; When the difference in grayscale gradient direction between two epidermal texture feature points is less than the first direction threshold, the distance between local texture descriptors is less than the first descriptor threshold, and the difference in distance to the length-direction baseline is less than the first distance threshold, the two epidermal texture feature points are determined to be epidermal texture feature points with a corresponding relationship.
5. The method for detecting defects in potatoes according to claim 4, characterized in that, When extracting candidate anomalous regions in visible light, first perform illumination correction and background normalization on the surface unfolded map, and then set a local comparison window in the surface unfolded coordinates. The local comparison window is centered on the pixel region to be judged, and the pixel region within the local comparison window that is not marked as abnormal is used as the local reference region. For the pixel region to be judged, calculate the color deviation parameter, texture change parameter, and edge abruptness parameter. The color deviation parameter is the mean distance between the pixel region to be judged and the local reference region in the color space. The texture change parameter is the local binary pattern histogram distance between the pixel region to be judged and the local reference region. The edge abruptness parameter is the gradient magnitude difference between the pixel region to be judged and the local reference region. When any one of the following conditions is met: color deviation parameter is greater than the first color threshold, texture change parameter is greater than the first texture threshold, or edge mutation parameter is greater than the first edge threshold, the corresponding pixel region will be merged into the visible light candidate anomaly region.
6. The method for detecting defects in potatoes according to claim 5, characterized in that, The plurality of near-infrared band images include a first near-infrared band image, a second near-infrared band image, and a third near-infrared band image arranged in order of increasing wavelength; When extracting near-infrared candidate anomaly regions, the first near-infrared band image, the second near-infrared band image, and the third near-infrared band image acquired under the same rolling posture are mapped to the surface unfolding coordinates, and the response difference between the first near-infrared band image and the second near-infrared band image, the response difference between the second near-infrared band image and the third near-infrared band image, and the response ratio between the first near-infrared band image and the third near-infrared band image are calculated respectively. When the response difference or response ratio falls into the abnormal response range, the corresponding pixel area is identified as a near-infrared candidate abnormal area. The abnormal response range is determined by the near-infrared response statistics of the defect-free sample set, the surface defect sample set, and the internal defect sample set.
7. The method for detecting defects in potatoes according to claim 6, characterized in that, When matching the visible light candidate anomaly region and the near-infrared candidate anomaly region according to the surface unfolded coordinates, the region overlap ratio and the center point distance of the two are calculated respectively. The region overlap ratio is the ratio of the intersection area of the visible light candidate anomaly region and the near-infrared candidate anomaly region to the union area in the surface unfolded coordinates. When the overlap ratio of regions is greater than the first overlap threshold and the distance between the center points is less than the second distance threshold, the corresponding visible light candidate anomaly region and near-infrared candidate anomaly region will be merged into the same suspected defect region. When the visible light candidate anomaly region does not meet the position matching condition with the near-infrared candidate anomaly region, the visible light candidate anomaly region is marked as a visible light single-source suspected defect region. When the near-infrared candidate anomaly region does not meet the position matching condition with the visible light candidate anomaly region, the near-infrared candidate anomaly region is marked as a near-infrared single-source suspected defect region.
8. The method for detecting defects in potatoes according to claim 7, characterized in that, When determining the initial processing status of suspected defect areas, the following rules shall be followed: When the spatial position consistency of the same suspected defect area is greater than the first consistency threshold, the visible light boundary stability is greater than the first boundary threshold, and the near-infrared response direction consistency is greater than the first response threshold in at least two adjacent rolling postures, the suspected defect area is determined as a directly confirmed defect area. When the near-infrared response difference corresponding to the suspected defect area of a single visible light source does not fall into the abnormal response range, and the boundary change amplitude of the suspected defect area of a single visible light source under adjacent rolling postures is greater than the third boundary threshold, the suspected defect area of a single visible light source is determined as the area to be directly excluded from interference. When a suspected defect area does not meet the criteria for dividing into a directly confirmed defect area and a directly excluded interference area, the suspected defect area is designated as a suspected defect area to be re-sampled.
9. A method for detecting defects in potatoes according to claim 8, characterized in that, When determining the supplementary mining attitude range, the starting supplementary mining rolling displacement when the suspected defect area to be supplemented enters the supplementary mining field of view and the ending supplementary mining rolling displacement when leaving the supplementary mining field of view are calculated based on the circumferential coordinates of the suspected defect area to be supplemented in the surface unfolded coordinates, the current rolling displacement value, and the coverage range of the supplementary mining field of view in the surface unfolded coordinates. When the real-time rolling displacement is between the starting and ending rolling displacements, the supplementary light unit and the image acquisition unit are triggered to perform supplementary sampling. When the suspected defect area to be sampled originates from a single-source suspected defect area in visible light, the sampling band will be determined as the near-infrared sampling band. When the suspected defect area to be supplemented originates from the near-infrared single-source suspected defect area, the supplementation band is determined to be the visible light supplementation band and the near-infrared band corresponding to the near-infrared single-source suspected defect area.
10. A method for detecting defects in potatoes according to claim 9, characterized in that, When performing rescan consistency verification, the rescanned area in the rescanned image is mapped to the surface unfolding coordinates, and the spatial overlap, boundary change amplitude, and multi-band response change direction between the rescanned area and the suspected defect area to be rescanned before rescanning are calculated. When the spatial overlap is greater than the second overlap threshold, the boundary change amplitude is less than the second boundary threshold, and the multi-band response change direction is consistent with that before the supplementary mining, the suspected defect area to be supplemented is identified as the confirmed defect area for supplementary mining. When any of the following conditions are met: spatial overlap is not greater than the second overlap threshold, boundary change amplitude is not less than the second boundary threshold, or the multi-band response change direction is inconsistent with that before the supplementary mining, the suspected defect area to be supplemented is determined as the supplementary mining interference elimination area.