Method for detecting appearance defects of polygonatum sibiricum rhizome based on computer vision

CN122906016APending Publication Date: 2026-10-13河南国医学院
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202611124021.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

该方案说明了基于灰度阈值、像素统计和质量指数对块茎作物进行综合评价的可行性,但其表面缺陷信息主要以灰度均值差异及像素数量为基础,难以充分区分黄精块茎表面的正常环节纹、皱缩纹、表面附着物、局部色差与真实腐烂、霉变、裂口等缺陷之间的边界关系和纹理延续关系

Benefits of technology

[0019]本发明通过获取待检测黄精块茎的外观图像并进行图像分割,先确定黄精块茎主体区域,再在主体区域内提取满足灰度、颜色、纹理或边缘预设异常条件的疑似异常区域,使后续判断限定在有效检测对象范围内,能够减少背景、光照及非主体区域对缺陷识别结果的干扰,提高图像处理的针对性和检测效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122906016A_ABST
    Figure CN122906016A_ABST
Patent Text Reader

Abstract

The present application relates to a computer vision-based polygonatum sibiricum rhizome appearance defect detection method, comprising: acquiring the appearance image of the polygonatum sibiricum rhizome to be detected, performing image segmentation on the appearance image to obtain the polygonatum sibiricum rhizome main body area, and extracting a suspected abnormal area in which the gray level, color, texture or edge feature of the polygonatum sibiricum rhizome main body area meets a preset abnormal condition; extracting defect features and normal texture features of the suspected abnormal area, wherein the defect features include at least one of skin texture interruption, edge mutation, linear cracking and surface diffusion; calculating defect matching degree and normal texture matching degree according to the defect features and the normal texture features respectively, and rejudging the suspected abnormal area according to the comparison result to determine a real defect area, a normal texture area or a non-defect interference area; thereby reducing the false detection rate caused by non-defect interference such as normal wrinkling, surface attachments and local color difference, and improving the recognition stability of appearance defects such as mildew, rot and cracking.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of appearance defect detection technology for Chinese medicinal materials, specifically a method for detecting appearance defects in Polygonatum rhizome based on computer vision. Background Technology

[0002] In existing technologies, root and tuber crops, which are both medicinal and edible, are prone to appearance abnormalities such as cracking, holes, mold, rot, abrasions, adhering mud and sand, and local color differences during harvesting, washing, drying, and distribution. Traditional manual selection mainly relies on experience-based judgment, which suffers from high labor intensity, inconsistent inspection standards, missed detection of minor defects, and misjudgment of normal wrinkles as defects. In recent years, machine vision has been used for appearance inspection of root and tuber agricultural products. For example, patent publication number CN114354628A and authorization announcement number CN114354628B disclose a defect detection method for root and tuber agricultural products based on machine vision. It achieves screening by capturing images during the falling process, image preprocessing, machine learning image analysis, and sending rejection instructions based on defect type and size. This solution also assists in judging the appearance abnormalities of root and tuber agricultural products by comparing the contour curvature with a threshold. This type of solution can improve sorting efficiency, but its focus is mainly on detecting overall surface defects and shape abnormalities in root and tuber agricultural products. It does not adequately consider the differences of specific objects such as obvious wrinkling of the epidermal segment of Polygonatum rhizome, strong texture continuity, and visual similarity between natural depressions and cracks.

[0003] Existing technologies also disclose schemes for grading tuber crops using image and spectral information. For example, patent CN118883544A discloses a fruit grading method and device using machine vision for taro harvesting equipment. It acquires images of taro appearance and near-infrared spectral data, extracts color, size, and surface defect information from the appearance images, and combines this with internal quality information to generate a comprehensive quality index for fruit grading. This scheme demonstrates the feasibility of comprehensively evaluating tuber crops based on grayscale thresholds, pixel statistics, and quality indices. However, its surface defect information is mainly based on differences in grayscale mean and the number of pixels, making it difficult to fully distinguish the boundary relationships and texture continuity between normal segmental lines, wrinkles, surface attachments, local color differences, and actual defects such as rot, mold, and cracks on the surface of Polygonatum tubers.

[0004] The tubers of Polygonatum sibiricum have irregular shapes, and their epidermal segments, wrinkles, color gradients, and processing marks exhibit strong natural differences. If suspected defect areas are extracted solely based on grayscale, color, or edge anomalies, normal textures continuously distributed along the segment direction, granular attachments, or localized color differences caused by lighting are easily misjudged as defects. Furthermore, using only general agricultural product defect classification models makes it difficult to specifically re-evaluate low-confidence anomalous areas. Therefore, there is an urgent need for a method for detecting appearance defects based on the epidermal texture characteristics of Polygonatum sibiricum tubers. After initially extracting suspected anomalous areas, this method should further compare and judge based on defect morphological features and normal texture features, thereby improving the accuracy and stability of identifying true defects. Summary of the Invention

[0005] The purpose of this invention is to provide a computer vision-based method for detecting appearance defects in Polygonatum rhizomes, thereby addressing some of the drawbacks and shortcomings mentioned in the background art.

[0006] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:

[0007] Obtain an appearance image of the rhizome of Polygonatum to be detected, perform image segmentation on the appearance image to obtain the main body region of the rhizome, and extract suspected abnormal regions in the main body region of the rhizome whose grayscale, color, texture or edge features meet preset abnormality conditions.

[0008] Extract the defect features and normal texture features of the suspected abnormal area. The defect features include at least one of the following: epidermal texture interruption, edge abruptness, hole morphology, linear cracking, and planar diffusion. The normal texture features include at least one of the following: continuous distribution along the segment direction of Polygonatum tuber, consistent with the direction of adjacent wrinkles, continuous epidermal texture, and color gradient change satisfying a preset smooth condition.

[0009] Based on the defect features and the normal texture features, the defect matching degree and the normal texture matching degree are calculated respectively. Based on the comparison results of the defect matching degree and the normal texture matching degree, the suspected abnormal region is re-judged to determine whether the suspected abnormal region is a real defect region, a normal texture region or a non-defect interference region.

[0010] Furthermore, when acquiring the defect features and normal texture features of the suspected abnormal region, the boundary of the suspected abnormal region is used as the dividing line, and the epidermal texture on both sides of the boundary is extracted; when the difference in texture direction on both sides of the boundary is less than a preset direction threshold, the color gradient change meets a preset smooth condition, and there is granular or sheet-like covering information in the suspected abnormal region, the suspected abnormal region is determined to be a surface attachment region; when the epidermal texture on both sides of the boundary is misaligned, terminated, or discontinuous, the suspected abnormal region is determined to be a real defect region.

[0011] Furthermore, when re-evaluating the suspected abnormal area, if the suspected abnormal area is linear or concave, it is determined whether the suspected abnormal area extends continuously with the adjacent wrinkles along the direction of the Polygonatum tuber segment; if the extension direction, width change, and edge gradient of the suspected abnormal area meet the preset consistent conditions with the adjacent wrinkles, it is determined to be a normal texture area; if the suspected abnormal area cuts off the adjacent epidermal texture or makes the epidermal textures on both sides discontinuous, it is determined to be a real defect area.

[0012] Furthermore, regions with a classification confidence level lower than a preset confidence threshold in the suspected abnormal regions are designated as low-confidence abnormal regions. When re-judging these low-confidence abnormal regions, they are divided into a central region, a boundary region, and an outer reference region. When abnormal information is distributed in the central region and the surface texture of the outer reference region is continuous, it is determined to be surface adhesion or local color difference. When abnormal information spreads from the central region through the boundary region to the outer reference region, and the surface texture clarity of the outer reference region is lower than a preset clarity threshold or is interrupted, it is determined to be a real defect region.

[0013] Furthermore, when determining whether the suspected abnormal region extends continuously with adjacent wrinkles, the texture endpoints at both ends of the suspected abnormal region and the texture endpoints of the adjacent wrinkles are extracted respectively; when the distance between the endpoints of the two types of texture endpoints is less than a preset distance threshold and the angle between the endpoint directions is less than a preset angle threshold, it is determined that the suspected abnormal region extends continuously with the adjacent wrinkles; when the distance between the endpoints reaches the preset distance threshold or the angle between the endpoint directions reaches the preset angle threshold, it is determined that the suspected abnormal region cuts off the adjacent epidermal texture.

[0014] Furthermore, when the suspected abnormal area is linear, the correspondence between the epidermal textures on both sides is compared along the length of the suspected abnormal area; when the epidermal textures on both sides maintain the same arrangement order on both sides of the suspected abnormal area, it is determined to be a normal texture area; when the epidermal textures on both sides are misaligned, missing, or have non-corresponding breakpoints on both sides of the suspected abnormal area, it is determined to be a real defect area.

[0015] Furthermore, when the suspected abnormal area is concave, the width change and edge gradient of the suspected abnormal area are compared with those of the adjacent wrinkles; when the width change rate of the suspected abnormal area is less than a preset width change threshold, and the edge gradient of the suspected abnormal area meets the preset consistency condition with the edge gradient of the adjacent wrinkles, it is determined to be a normal texture area; when the width change rate of the suspected abnormal area reaches the preset width change threshold and is accompanied by a sudden change in the edge gradient, it is determined to be a real defect area.

[0016] Furthermore, when it is determined that the abnormal information is distributed in the central area and the epidermal texture of the peripheral reference area is continuous, it is further determined whether the color change between the central area and the boundary area meets the preset mutation condition; if the preset mutation condition is met, the low-confidence abnormal area is determined to be surface adhesion; if the preset mutation condition is not met, the low-confidence abnormal area is determined to be local color difference.

[0017] Furthermore, when determining that abnormal information spreads from the central area through the boundary area to the outer reference area, the clarity of the skin texture in the central area, the boundary area, and the outer reference area is compared; if the clarity of the skin texture decreases zone by zone from the central area to the outer reference area, the low-confidence abnormal area is determined to be a mold defect; if the skin texture in the central area disappears and the boundary area shows edge collapse, the low-confidence abnormal area is determined to be a rot defect.

[0018] Furthermore, when determining that the low-confidence abnormal area is a mold defect, the distribution of point-like abnormalities in the boundary area and the peripheral reference area is further compared; when the point-like abnormalities extend discretely towards the peripheral reference area along the gaps in the epidermal texture, and the clarity of the epidermal texture in the peripheral reference area is lower than the clarity of the epidermal texture in the adjacent normal epidermal area, the mold defect is determined to be a diffuse mold defect.

[0019] This invention acquires an image of the appearance of the rhizome of Polygonatum to be detected and performs image segmentation. First, the main body area of ​​the rhizome is determined, and then suspected abnormal areas that meet the preset abnormal conditions of grayscale, color, texture or edge are extracted within the main body area. This limits the subsequent judgment to the effective detection object range, reduces the interference of background, lighting and non-main body areas on the defect identification results, and improves the pertinence of image processing and detection efficiency.

[0020] This invention further extracts defect features and normal texture features from suspected abnormal areas, and performs a re-judgment based on the comparison results of defect matching degree and normal texture matching degree. This effectively distinguishes real defects such as interrupted epidermal texture, abrupt edge changes, hole morphology, linear cracks, and planar diffusion from normal textures such as continuous distribution along the segmental direction of the Polygonatum rhizome, consistency with the direction of adjacent wrinkles, and gentle color gradient changes. This reduces the false detection rate caused by non-defect interference such as normal wrinkles, surface attachments, and local color differences, while improving the identification stability of appearance defects such as mold, rot, and cracks. Attached Figure Description

[0021] Figure 1 This is a flowchart of the method for detecting appearance defects in Polygonatum rhizome according to the present invention.

[0022] Figure 2 This is a comparison diagram of defect matching degree and normal texture matching degree in Embodiment 1 of the present invention.

[0023] Figure 3 This is a boundary texture and surface adhesion complexation diagram in Embodiment 1 of the present invention.

[0024] Figure 4 This is a verification diagram of endpoint distance and linear texture continuity in Embodiment 1 of the present invention.

[0025] Figure 5 This is a screening map of low-confidence abnormal regions in Embodiment 2 of the present invention.

[0026] Figure 6 This is a color abrupt change and surface adhesion re-judgment diagram in Embodiment 2 of the present invention.

[0027] Figure 7 This is a texture clarity and dot-like abnormal diffusion determination diagram in Embodiment 2 of the present invention. Detailed Implementation

[0028] As attached Figure 1 As shown, in one specific embodiment, an appearance image of the rhizome to be detected is first acquired. This image can be acquired by an industrial camera, area scan camera, or other image acquisition device under stable lighting conditions. During acquisition, the rhizome can be positioned against a monochrome background or a background with a color significantly different from the rhizome's epidermis. A relatively fixed shooting distance and angle are maintained between the image acquisition device and the rhizome to obtain an image that reflects the color, texture, and contour of the rhizome's outer surface. After acquisition, the appearance image is preprocessed. Preprocessing may include denoising, brightness correction, color normalization, and background suppression to reduce the impact of lighting variations, background noise, and acquisition noise on subsequent recognition results. Specifically, the appearance image can be smoothed and filtered to remove isolated noise points, the image brightness can be equalized to reduce the influence of local shadows, and non-rhizome areas can be suppressed based on background color or texture features. Subsequently, the preprocessed appearance image is segmented to separate the rhizome from the background area, obtaining the main rhizome area. Image segmentation can be achieved using thresholding, edge segmentation, region growing, semantic segmentation models, or a combination of these methods, ensuring that the obtained main body region of the Polygonatum rhizome covers the main outer surface region of the Polygonatum rhizome to be detected. After segmentation, hole filling, boundary smoothing, and removal of small-area interference regions can be performed on the main body region of the Polygonatum rhizome to match the outer contour of the actual rhizome.

[0029] After obtaining the main body of the Polygonatum rhizome, suspected abnormal regions that meet preset abnormality conditions based on grayscale, color, texture, or edge features are extracted from this main body. Specifically, the main body of the Polygonatum rhizome can be divided into multiple local regions, and the grayscale difference, color difference, texture continuity, edge intensity, and morphological features of each local region are obtained. Each local region is then compared with its surrounding adjacent epidermal regions. When a local region shows a significant color deepening, significant color deviation, significant texture breakage, significant edge abruptness, or significant morphological abnormality compared to its surrounding adjacent epidermal regions, this local region is considered a candidate abnormal region. The preset abnormality conditions can be determined in advance based on samples of undefective Polygonatum rhizome and samples of known defects, or they can be obtained by calibrating normal epidermal regions of the same batch before testing. The preset abnormality conditions can include at least one of the following: grayscale difference conditions, color difference conditions, texture continuity conditions, edge intensity conditions, and region area conditions. After connecting and merging candidate abnormal regions and removing smaller regions, suspected abnormal regions are obtained. Suspected abnormal areas can include areas of darkened color, areas of abnormal color diffusion, areas of texture breakage, areas of abrupt edge changes, areas with holes, areas of linear cracks, or other areas that may reflect appearance defects. By first extracting suspected abnormal areas, the scope of subsequent detection can be narrowed, reducing the need for repeated judgments of normal epidermal areas and improving detection efficiency.

[0030] After identifying suspected abnormal areas, defect features and normal texture features are extracted from these areas. Defect features characterize abnormal manifestations caused by epidermal damage or lesions in the Polygonatum rhizome, and may include at least one of the following: epidermal texture interruption, edge mutation, pore morphology, linear cracking, and planar diffusion. Epidermal texture interruption can manifest as the truncation or absence of previously continuous epidermal lines at the suspected abnormal area; edge mutation can manifest as a significant gradient change in the edge between the suspected abnormal area and the surrounding epidermis; pore morphology can manifest as local depressions or dark pore-like structures; linear cracking can manifest as narrow cracks extending in a certain direction; and planar diffusion can manifest as abnormal color or texture expanding outwards in a sheet-like pattern. When extracting defect features, the color depth, color uniformity, edge clarity, texture interruption location, depression outline, crack extension direction, and abnormal area expansion morphology of the suspected abnormal area can be obtained, and this information is used as the basis for judging defects. Normal texture features are used to characterize the normal appearance of the growth texture or natural wrinkles of the Polygonatum rhizome. These features may include at least one of the following: continuous distribution along the segmental direction of the Polygonatum rhizome, consistency with the direction of adjacent wrinkles, continuous epidermal texture, and color gradient changes satisfying a preset smooth condition. When extracting normal texture features, the normal epidermal texture surrounding the suspected abnormal area can be used as a reference to obtain the extension direction, texture spacing, texture width, color transition state, and texture connection state of adjacent wrinkles, in order to determine whether the suspected abnormal area is consistent with the natural growth texture of the Polygonatum rhizome.

[0031] Furthermore, defect matching degree and normal texture matching degree are calculated separately based on defect features and normal texture features. Defect matching degree represents the similarity between a suspected abnormal region and a true defect, while normal texture matching degree represents the similarity between a suspected abnormal region and normal epidermal texture or natural wrinkles. During calculation, features can be compared from aspects such as texture continuity, edge variation, color variation, morphological contour, extension direction, and regional distribution, and the corresponding matching degree is obtained based on the comparison results of each feature. Specifically, comparison rules for defect features and normal texture features can be pre-set. When a suspected abnormal region meets a certain defect feature, the defect matching degree of that region is increased; when a suspected abnormal region meets a certain normal texture feature, the normal texture matching degree of that region is increased. Alternatively, labeled defect samples and normal texture samples can be used as reference templates, and the features of the suspected abnormal region are compared item by item with the reference templates to obtain matching results. Subsequently, based on the comparison results of defect matching degree and normal texture matching degree, the suspected abnormal region is re-evaluated. When a suspected abnormal area more closely matches defect characteristics, it is identified as a true defect area; when a suspected abnormal area more closely matches normal texture characteristics, it is identified as a normal texture area; when a suspected abnormal area has local color or texture differences, but these differences are mainly caused by surface attachments, local color differences, or other non-defect factors, it is identified as a non-defect interference area. For suspected abnormal areas with close defect matching and normal texture matching, further judgment can be made by combining their boundary texture connection state, the internal coverage morphology of the abnormal area, and the color transition state of adjacent normal epidermis. Through the above methods, after the initial anomaly extraction, true defects, normal textures, and non-defect interference areas can be further distinguished, thereby reducing the probability of misjudging natural wrinkles, attachments, or local color differences as appearance defects and improving the accuracy of the appearance defect detection results for Polygonatum rhizome.

[0032] In one specific implementation, after acquiring the suspected abnormal region, the boundary of the suspected abnormal region is used as the analysis benchmark to extract and compare the epidermal texture on both sides of the boundary. Specifically, the outer contour of the suspected abnormal region can be determined first, and then texture sampling bands can be set along the outer contour inward and outward respectively. The epidermal texture direction, color gradient, texture continuity, and coverage morphology information on both sides of the boundary can be extracted through the texture sampling bands. The width of the texture sampling band can be preset according to the resolution of the appearance image, the size of the main area of ​​the Polygonatum rhizome, and the width of the epidermal texture, so that the inner texture sampling band can cover the internal area of ​​the suspected abnormal region adjacent to the boundary, and the outer texture sampling band can cover the normal epidermal reference area around the suspected abnormal region. The texture direction can be determined according to the local gradient direction, the main texture direction, or the extension direction of the texture skeleton; the color gradient can be determined according to the color change rate of pixels on both sides of the boundary; and the texture continuity can be determined according to the connection state of the texture lines on both sides of the boundary. For suspected abnormal regions with irregular boundaries, texture sampling bands can be set in segments along the outer contour, and the texture direction and color change in each segment sampling band can be judged separately to avoid the influence of local boundary curvature on the overall judgment result.

[0033] After extracting the epidermal texture on both sides of the boundary, the differences in texture direction and color gradient changes on both sides of the boundary are assessed. When the difference in texture direction on both sides of the boundary is less than a preset direction threshold, and the color gradient change meets a preset smoothness condition, it indicates that the boundary of the suspected abnormal area has not disrupted the original texture continuity of the Polygonatum rhizome epidermis. The preset direction threshold and preset smoothness condition can be predetermined based on the directional and color changes of the normal Polygonatum rhizome epidermal texture at different acquisition angles, or can be adaptively set based on the texture change status of adjacent normal epidermal areas in the current appearance image. At this time, if granular or sheet-like covering information is further identified in the suspected abnormal area, it can be considered that the area is more likely to be covered by soil, impurities, residual epidermis, medicinal dust, or other attachments, rather than damage or disease to the Polygonatum rhizome epidermis itself. Granular or sheet-like covering information can be determined by at least one of the following: the color of the covered area is inconsistent with the color of the surrounding epidermis, the edge of the covered area is discontinuous with the epidermal texture, and the texture inside the covered area does not have the natural wrinkling characteristics of the Polygonatum rhizome. Therefore, the suspected abnormal area is determined to be a surface attachment area.

[0034] When the epidermal texture on both sides of the boundary is misaligned, terminated, or discontinuous, it indicates that the suspected abnormal area has damaged the original epidermal texture. Specifically, misalignment of the epidermal texture can be manifested as the extension direction of the texture lines on both sides of the boundary not being able to connect; termination of the epidermal texture can be manifested as the texture lines stopping extending before entering the suspected abnormal area; and discontinuity of the epidermal texture can be manifested as gaps or discontinuous distribution of texture lines near the boundary. When the above situations occur, it can be further confirmed whether there are dark holes, crack edges, tissue collapse, or abnormal diffusion textures inside the suspected abnormal area; if at least one of the above situations exists, it can be considered that there is a structural difference between the suspected abnormal area and the normal epidermal texture, and this difference is not simply caused by the surface covering. Therefore, the suspected abnormal area is determined to be a real defect area.

[0035] In one specific implementation, when re-evaluating suspected abnormal areas, the morphology of the suspected abnormal areas is first identified. Morphological identification can classify suspected abnormal areas into linear, concave, porous, sheet-like, or irregular shapes based on their outer contour, length extension, width variation, depth of depression, and edge closure. When a suspected abnormal area is linear or concave, further judgment is made based on the segmental direction of the Polygonatum rhizome itself. The segmental direction can be determined based on the overall extension direction of multiple natural wrinkles in the main body of the Polygonatum rhizome, the direction of the textural skeleton, or the arrangement direction of the rhizome segments. Since natural wrinkles distributed along the segmental direction are common on the surface of Polygonatum rhizome, some normal wrinkles may appear as linear dark lines or concave lines in the image, making them easily identified as abnormal. Therefore, the extension relationship between the suspected abnormal area and adjacent wrinkles is analyzed along the segmental direction of the Polygonatum rhizome to determine whether the suspected abnormal area is part of the natural texture. If the extension direction, width variation, and edge gradient of a suspected abnormal area meet the preset consistency conditions with adjacent wrinkles, it indicates that the area and adjacent wrinkles have continuity in morphology and texture variation, and the suspected abnormal area can be determined as a normal texture area. The preset consistency conditions may include at least one of the following: similar extension direction, gentle width variation, similar edge light and dark transition, texture endpoints can connect with each other, and no abnormal abrupt color changes. If the suspected abnormal area cuts off adjacent epidermal textures or causes discontinuity in the epidermal textures on both sides, it indicates that the area disrupts the continuity of the original epidermal texture of the Polygonatum tuber, and the suspected abnormal area can be determined as a true defect area.

[0036] When determining whether a suspected abnormal region extends continuously with adjacent wrinkles, the texture endpoints at both ends of the suspected abnormal region and the texture endpoints of adjacent wrinkles can be extracted separately. Specifically, the position and direction of each texture endpoint can be obtained through texture skeletonization, edge line extraction, or principal direction analysis, and the endpoint distance and the angle between the endpoints of the two types of texture endpoints can be calculated. When the endpoint distance between the two types of texture endpoints is less than a preset distance threshold and the angle between the endpoints is less than a preset angle threshold, it indicates that the end of the suspected abnormal region can connect with the adjacent wrinkle in position and direction, thus determining that the suspected abnormal region extends continuously with the adjacent wrinkle. When the endpoint distance reaches the preset distance threshold or the angle between the endpoints reaches the preset angle threshold, it indicates that the suspected abnormal region cannot connect effectively with the adjacent wrinkle, thus determining that the suspected abnormal region cuts off the adjacent epidermal texture. The preset distance threshold and preset angle threshold can be preset based on the average spacing of natural wrinkles in Polygonatum rhizome, image resolution, and the curvature of normal wrinkles, and can be adjusted using normal samples before testing different batches of Polygonatum rhizome.

[0037] When a suspected abnormal area is linear, the correspondence between the epidermal textures on both sides can be compared along the length of the suspected abnormal area. Specifically, texture sampling bands can be set on both sides of the suspected abnormal area, and the arrangement order, texture spacing, and texture endpoint positions of the epidermal textures on both sides can be extracted. When the epidermal textures on both sides maintain the same arrangement order on both sides of the suspected abnormal area, it indicates that the linear area has not caused the epidermal textures on both sides to be misaligned or broken, and it is more likely to be a natural wrinkle on the surface of the Polygonatum tuber, and therefore it is judged as a normal texture area. When the epidermal textures on both sides of the suspected abnormal area are misaligned, missing, or the breakpoints do not correspond, it indicates that the linear area has a cutting or damaging effect on the epidermal textures on both sides, and it is more likely to be a crack, scratch, or other linear defect, and therefore it is judged as a real defect area. For cases where part of the linear area is continuous with the natural wrinkle while another part has a break or abrupt edge, the part with the break or abrupt edge can be treated as a real defect area, and the part continuous with the natural wrinkle can be treated as a normal texture area, in order to improve the re-judgment accuracy of linear suspected abnormal areas.

[0038] When a suspected abnormal area presents as a depression, the width changes and edge gradients of the suspected abnormal area can be compared with those of adjacent wrinkles. Specifically, the width change rate can be measured along the extension direction of the suspected abnormal area, and the gradient difference between the edge of the suspected abnormal area and the edge of the adjacent wrinkle can be calculated. When the width change rate of the suspected abnormal area is less than a preset width change threshold, and the edge gradient of the suspected abnormal area meets a preset consistency condition with the edge gradient of the adjacent wrinkle, it indicates that the depression is close to a natural wrinkle in terms of width and edge change, and can be identified as a normal texture area. When the width change rate of the suspected abnormal area reaches the preset width change threshold and is accompanied by a sudden change in the edge gradient, it indicates that the depression has abnormal expansion or local collapse, which is more likely to correspond to mechanical damage, rotten depression, or other real defects, and is therefore identified as a real defect area. The preset width change threshold can be preset based on the range of normal wrinkle width changes within the same Polygonatum rhizome body area; when the internal color of the depression is significantly darker than that of the adjacent wrinkle, and the edge shows irregular collapse or tissue damage, it can be preferentially identified as a real defect area.

[0039] In one specific implementation, after the initial identification of suspected anomalous regions, regions requiring further review can be selected based on their classification confidence scores. Specifically, the detection model or feature matching algorithm outputs a corresponding classification confidence score for each suspected anomalous region. The classification confidence score indicates the reliability of classifying the region as a defect or non-defect. The classification confidence score can be determined comprehensively based on the completeness of defect features, consistency of normal texture features, clarity of boundaries, stability of color changes, and regularity of region morphology. Alternatively, it can be output by a classification model trained on samples. Regions with classification confidence scores below a preset confidence threshold are designated as low-confidence anomalous regions and undergo further review. The preset confidence threshold can be pre-set based on the confidence score distribution of misclassified and correctly identified regions in historical detection results. During review, low-confidence anomalous regions can be divided into a central region, a boundary region, and an outer reference region based on their geometric center, outer contour, or anomalous response intensity distribution. The central region is used to characterize the main location of the concentrated abnormal information, and can be selected from the part with strong abnormal response or located inside the low-confidence abnormal region; the boundary region is used to characterize the transition position between the abnormal information and the surrounding epidermis, and can be selected from the part close to the outer contour of the low-confidence abnormal region; the peripheral reference region is used to characterize the surrounding epidermal region that is close to the abnormal region but has not been initially identified as abnormal, and can be selected from the epidermal region located outside the low-confidence abnormal region and adjacent to it.

[0040] After dividing the region, the distribution of abnormal information and the state of epidermal texture in the central area, boundary area, and outer reference area are analyzed separately. The distribution of abnormal information can include the location of abnormal colors, the direction of abnormal texture extension, the clarity of abnormal edges, the density of point-like abnormalities, and the diffusion range of sheet-like abnormalities. The state of epidermal texture can include whether the texture is continuous, whether the texture is clear, whether the texture direction is stable, and whether the texture is obscured or damaged by abnormal areas. When the abnormal information is distributed in the central area and the epidermal texture of the outer reference area is continuous, it indicates that the abnormal change has not spread to the surrounding epidermis, and the original epidermal texture of the Polygonatum rhizome remains continuous. Low-confidence abnormal areas are more likely caused by surface attachments or local color differences. Therefore, low-confidence abnormal areas can be identified as surface attachments or local color differences. When the abnormal information spreads from the central area through the boundary area to the outer reference area, and the clarity of the epidermal texture in the outer reference area is lower than the preset clarity threshold or is interrupted, it indicates that the abnormal change has affected the surrounding epidermal texture, exhibiting characteristics of outward expansion or damage to the epidermal structure. Therefore, low-confidence abnormal areas can be identified as true defect areas. The preset clarity threshold can be pre-set based on the texture clarity level of adjacent normal epidermal areas, so that it can reflect the visibility of normal textures under the current image acquisition conditions.

[0041] When it is determined that the abnormal information is distributed in the central area and the epidermal texture of the outer reference area is continuous, it is further possible to determine whether the color change between the central area and the boundary area meets the preset mutation conditions. Specifically, the color difference, color gradient, or color change rate between the central area and the boundary area can be calculated, and the calculation results can be compared with the preset mutation threshold. When the color change meets the preset mutation conditions, it indicates that there is a relatively clear color boundary between the abnormal area and the surrounding epidermis, and this boundary is not accompanied by the destruction of the outer epidermal texture. The low-confidence abnormal area is more likely to be soil, impurities, residues, or other attachments covering the surface of the Polygonatum tuber, so the low-confidence abnormal area is determined to be a surface attachment. When the color change does not meet the preset mutation conditions, it indicates that the color change between the central area and the boundary area is relatively gradual, and the epidermal texture of the outer reference area remains continuous. The low-confidence abnormal area is more likely to be a local color difference within the Polygonatum tuber epidermis itself, so the low-confidence abnormal area is determined to be a local color difference. The preset mutation threshold can be determined in advance based on the range of color change of the epidermis of normal Polygonatum tubers in the same batch and the range of color change of common surface attachments; when the color boundary is clear and the area covered lacks the natural texture of Polygonatum tubers, the determination result of surface attachment can be further enhanced.

[0042] When determining whether abnormal information spreads from the central area through the boundary area to the outer reference area, the clarity of the epidermal texture in the central area, boundary area, and outer reference area can be further compared. Epidermal texture clarity can be determined based on local contrast, gradient energy, texture line continuity, or texture frequency response. If the epidermal texture clarity decreases progressively from the central area to the outer reference area, it indicates that the abnormal information is spreading and gradually weakening the surrounding epidermal texture, consistent with the outward expansion of mold defects; therefore, the low-confidence abnormal area is determined to be a mold defect. If the epidermal texture disappears in the central area and the boundary area shows edge collapse, it indicates that the epidermal structure within the abnormal area has been destroyed, forming a collapsed change at the edge, consistent with the softening or localized damage caused by decay defects; therefore, the low-confidence abnormal area is determined to be a decay defect. For low-confidence anomalous areas that exhibit both color diffusion and edge collapse, the judgment can be based primarily on whether the epidermal structure has been damaged. When the epidermal structure in the central area is still identifiable and the anomalous color mainly diffuses along the texture gaps, it is judged as a mold defect. When the epidermal structure in the central area is not identifiable and there is collapse or damage at the edges, it is judged as a rot defect.

[0043] When determining a low-confidence anomalous area as a mold defect, the distribution of point anomalies in the boundary area and the surrounding reference area can be further compared. Specifically, the location, density, and extension direction of point anomalies in the boundary area and the surrounding reference area can be extracted, and it can be determined whether the point anomalies extend discretely towards the surrounding reference area along the gaps in the epidermal texture. When the point anomalies extend discretely towards the surrounding reference area along the gaps in the epidermal texture, and the clarity of the epidermal texture in the surrounding reference area is lower than that of the adjacent normal epidermal area, it indicates that the mold defect not only exists in the central part but also spreads outward along the gaps in the epidermal texture, affecting the surrounding epidermal texture. Therefore, the mold defect can be classified as a diffuse mold defect. If the point anomalies are concentrated only in the central area and the texture of the surrounding reference area is clear and continuous, the mold defect can be classified as a localized mold defect, or it can be reserved as a mold area to be reviewed for further confirmation by subsequent manual review or multi-angle images.

[0044] Example 1:

[0045] In one specific implementation, Company A uses an industrial camera to acquire an image of the rhizome of *Polygonatum sibiricum* to be detected. During acquisition, the rhizome is placed on a monochrome background that differs in color from its epidermis, and the relative position of the camera and the rhizome is kept fixed under stable lighting. After acquiring the image, noise reduction, brightness correction, color normalization, and background suppression are performed on the image to reduce the impact of lighting variations, background noise, and acquisition noise on the subsequent recognition results.

[0046] After preprocessing, image segmentation is performed on the appearance image to separate the Polygonatum rhizome from the background region, obtaining the main body region of the Polygonatum rhizome. Image segmentation can be achieved using color thresholding, edge segmentation, region growing, or semantic segmentation models. The segmentation results are then subjected to small-area interference removal, boundary smoothing, and hole filling to ensure that the main body region of the Polygonatum rhizome covers the main outer surface area of ​​the Polygonatum rhizome to be detected.

[0047] After obtaining the main body area of ​​the Polygonatum rhizome, the main body area of ​​the Polygonatum rhizome is divided into multiple local detection areas, and the grayscale difference, color difference, texture continuity, edge intensity, and morphological contour of each local detection area are extracted. When a local detection area shows color deepening, texture breakage, edge abruptness, hole-like dark areas, or linear dark lines relative to its surrounding epidermal area, the local detection area is regarded as a candidate abnormal area. Adjacent candidate abnormal areas are connected and merged, and isolated noise areas with too small area are removed to obtain suspected abnormal areas.

[0048] After identifying suspected abnormal areas, defect features and normal texture features are extracted from these areas. Defect features include at least one of the following: interrupted epidermal texture, abrupt edge changes, pore morphology, linear cracks, and planar diffusion. Normal texture features include at least one of the following: continuous distribution along the segmental direction of the Polygonatum rhizome, consistency with the direction of adjacent wrinkles, continuous epidermal texture, and color gradient changes meeting preset smooth conditions. During extraction, the normal epidermal texture surrounding the suspected abnormal area can be used as a reference to compare the texture direction, texture endpoints, color transitions, and edge clarity between the suspected abnormal area and adjacent epidermal areas.

[0049] In this embodiment, defect matching degree and normal texture matching degree can be obtained based on defect features and normal texture features, respectively. Defect matching degree represents the similarity between a suspected abnormal area and the actual defect, while normal texture matching degree represents the similarity between a suspected abnormal area and the normal wrinkles or natural texture of a Polygonatum rhizome. The defect matching degree can be expressed using the following formula:

[0050]

[0051] in, Indicates the degree of defect matching. Indicates the texture interruption feature score. Indicates the marginal mutation feature score, Indicates the score of color anomaly features. This represents the score for morphological abnormality features. Each feature score can be normalized based on the degree of difference between the suspected abnormal area and the surrounding normal epidermal area. The derivation of this formula is based on using texture disruption, edge abruptness, color abnormality, and morphological abnormality, which are commonly manifested in real defects, as evaluation items, and assigning weights according to their importance in defect identification, thereby obtaining a matching result that can comprehensively reflect the degree of defect similarity. Figure 2 The weighted contribution values ​​of the four defect feature items are expressed in bar chart form, and the scores of each feature are displayed in superimposed line chart form, so that the contribution of defect features and the original strength of features can be observed in the same view; at the same time, the relative position of the defect matching degree line and the normal texture matching degree line can intuitively reflect whether the suspected abnormal area is closer to the real defect or the normal texture.

[0052] For example, if a suspected abnormal region has a texture interruption feature score of 0.86, an edge abrupt change feature score of 0.78, a color anomaly feature score of 0.71, and a morphological anomaly feature score of 0.69, then its defect matching degree is:

[0053]

[0054] If the normal texture matching degree obtained by the same region based on the consistency of extension direction, texture continuity, color smoothness, and width stability is 0.52, then the defect matching degree is greater than the normal texture matching degree, indicating that the region is more consistent with the image representation of a real defect and can be output as a real defect region. If the normal texture matching degree is greater than the defect matching degree, it is determined as a normal texture region; if the two are close and there is granular or sheet-like coverage information inside the region, it is further determined whether it belongs to surface adhesion or other non-defect interference regions.

[0055] In one specific implementation, the boundary of the suspected abnormal region can be used as a dividing line, and texture sampling bands can be set along the boundary inward and outward respectively to extract the surface texture direction, color gradient, texture continuity, and coverage morphology information on both sides of the boundary. The texture direction can be determined by the local gradient direction or the extension direction of the texture skeleton, the color gradient can be determined by the strength of the color change of the pixels on both sides of the boundary, and the texture continuity can be determined by whether the texture lines on both sides of the boundary can be connected. Figure 3 The verification items on both sides of the boundary are divided into two categories: texture direction difference and color gradient change. The detection values ​​and preset thresholds are compared separately to observe whether the boundary of the suspected abnormal area still maintains the continuity of the normal epidermis.

[0056] When the difference in texture direction on both sides of the boundary is 8.5°, the preset direction threshold is 12°, the color gradient change value is 0.06, and the preset smoothness threshold is 0.10, it indicates that the difference in texture direction on both sides of the boundary is small and the color transition is smooth. Figure 3The detection values ​​were all below the corresponding thresholds. Combined with the granular or sheet-like covering information identified inside the suspected abnormal area, and the texture of this covering information did not extend along the direction of the Polygonatum tuber segment, it can be considered that the area was mainly formed by soil, impurities, residual epidermis or medicinal dust, rather than damage or disease to the surface of the Polygonatum tuber itself. Therefore, the suspected abnormal area was determined to be a surface attachment area.

[0057] When the epidermal texture on both sides of the boundary is misaligned, terminated, or discontinuous, it indicates that the suspected abnormal area has disrupted the continuity of the original epidermal texture of the Polygonatum tuber. Specifically, misalignment of the epidermal texture can be manifested as the texture lines on both sides of the boundary not connecting in direction; termination of the epidermal texture can be manifested as the texture lines stopping extending before entering the suspected abnormal area; and discontinuity of the epidermal texture can be manifested as gaps or missing texture lines near the boundary. If dark pores, crack edges, or planar diffusion textures are simultaneously detected within the suspected abnormal area, then the suspected abnormal area is determined to be a true defect area.

[0058] When re-evaluating suspected linear or concave abnormal areas, it can be determined whether the suspected abnormal area extends continuously with adjacent wrinkles along the segmental direction of the Polygonatum rhizome. Specifically, the texture endpoints at both ends of the suspected abnormal area and the texture endpoints of adjacent wrinkles are extracted, and the endpoint distance is obtained based on the lateral and longitudinal distances between the endpoints. The endpoint distance can be expressed by the following formula:

[0059]

[0060] in, This indicates the endpoint distance between the endpoint of the suspected abnormal area and the endpoint of the adjacent shrinkage line. This represents the pixel difference between the two endpoints in the horizontal direction of the image. This represents the pixel difference between two endpoints along the vertical axis of the image. The derivation of this formula involves decomposing the positional difference between the two endpoints in the image plane into a horizontal difference and a vertical difference, and then using these two differences to determine the spatial proximity of the two endpoints. The smaller the distance between the endpoints, the more likely the suspected anomalous region is to connect with adjacent wrinkles in terms of location. Figure 4 The formation process of endpoint distance is shown by the correspondence between adjacent shrinkage lines, linear suspected abnormal areas and texture sampling bands. The lateral difference, longitudinal difference and texture endpoints with consistent order are used to help explain whether the linear area belongs to the continuous part of the natural shrinkage line.

[0061] For example, if the horizontal pixel difference between the endpoint of a suspected linear abnormal region and the endpoint of an adjacent wrinkle is 2.4 pixels, and the vertical pixel difference is 2.1 pixels, then the endpoint distance is:

[0062]

[0063] If the preset distance threshold is 5 pixels, the angle between the endpoints is 9°, and the preset angle threshold is 15°, then the suspected abnormal region can connect with the adjacent wrinkles in both endpoint position and direction. If the width of the suspected abnormal region changes gently, the edge gradient is close to that of the adjacent wrinkles, and the skin texture on both sides remains continuous, then it is determined to be a normal texture region. Figure 4 The distance between the midpoints is less than the distance threshold, and multiple sets of texture endpoints maintain the same order, which indicates that the linear suspected abnormal area does not significantly cut off the epidermal texture on both sides.

[0064] In another detection example, if six sets of texture endpoints are extracted from both sides of a linear suspected abnormal region, and only three sets of endpoints maintain a consistent arrangement order, while the remaining endpoints are misaligned, missing, or have mismatched breakpoints, and the edge gradient of this linear region is significantly higher than that of adjacent wrinkles, it indicates that the linear region is cutting or damaging the epidermal texture on both sides, and is more likely to be a crack, scratch, or other linear defect. Therefore, it is determined to be a real defect region. For a concave suspected abnormal region, if its width change rate is less than a preset width change threshold and its edge gradient meets a preset consistency condition with adjacent wrinkles, it is determined to be a normal texture region; if its width change rate reaches the preset width change threshold and is accompanied by a sudden change in edge gradient, it is determined to be a real defect region.

[0065] Example 2:

[0066] In one specific implementation, Company A uses an industrial camera to acquire an image of the appearance of the Polygonatum rhizome to be inspected, and performs noise reduction, brightness correction, color normalization, and background suppression processing on the appearance image. Subsequently, image segmentation is performed on the preprocessed appearance image to separate the Polygonatum rhizome from the background area, obtaining the main body area of ​​the Polygonatum rhizome, and extracting suspected abnormal areas in the main body area of ​​the Polygonatum rhizome that meet preset abnormality conditions in terms of grayscale, color, texture, or edge features.

[0067] After identifying suspected anomalous regions, the detection model or feature matching algorithm outputs the classification confidence score for each region. The classification confidence score indicates the reliability of classifying the suspected anomalous region as a defect or non-defect, and can be determined comprehensively based on the completeness of defect features, consistency with normal textures, clarity of boundaries, stability of color changes, and regularity of region morphology. When the classification confidence score of a suspected anomalous region is 0.58, and the preset confidence threshold is 0.70, since the classification confidence score is lower than the preset threshold, the initial judgment result for this region is deemed unreliable, and this suspected anomalous region is treated as a low-confidence anomalous region for further review. Figure 5The diagram shows the correspondence between the classification confidence scores of multiple suspected abnormal regions and the preset confidence thresholds. Among them, suspected region C is below the threshold line and is marked separately as a region that enters the re-judgment. This shows that this embodiment does not repeat the processing of all suspected abnormal regions, but only performs subsequent fine judgment on regions with insufficient reliability.

[0068] When re-evaluating low-confidence anomaly regions, they can be divided into a central region, a boundary region, and a peripheral reference region based on the region's geometric center, outer contour, and anomaly response intensity distribution. The central region represents the main location where the anomaly information is concentrated, the boundary region represents the transitional location between the anomaly information and the surrounding epidermis, and the peripheral reference region represents the surrounding epidermal region that is close to the anomaly region but has not yet been initially identified as an anomaly.

[0069] After completing the region division, the distribution of anomalous information and the state of epidermal texture in the central region, boundary region, and outer reference region are analyzed separately. The distribution of anomalous information can include the distribution location of anomalous colors, the extension direction of anomalous textures, the clarity of anomalous edges, the density of point-like anomalous features, and the diffusion range of patchy anomalous features. The state of epidermal texture can include whether the texture is continuous, whether the texture is clear, whether the texture direction is stable, and whether the texture is obscured or destroyed by anomalous regions.

[0070] When the abnormal information is mainly distributed in the central area, and the epidermal texture of the outer reference area is continuous, it indicates that the abnormal change has not significantly spread to the surrounding epidermis, and the original epidermal texture of the Polygonatum tuber remains continuous. At this point, it can be further determined whether the color change between the central area and the boundary area meets the preset mutation conditions. The color change can be characterized by the difference between the average color intensity of the central area and the average color intensity of the boundary area, calculated as follows:

[0071]

[0072] in, This indicates the color change value between the center area and the boundary area. Indicates the average color intensity of the central area. This represents the average color intensity of the boundary area. The derivation of this formula is based on treating the central area and the boundary area as two adjacent color regions, and using the absolute difference in their average color intensity to characterize the degree of abrupt change in the color boundary. The larger the difference, the more obvious the color boundary between the abnormal area and the surrounding epidermis. Figure 6 The average color of the central area, the average color of the boundary area, the color change value, and the mutation threshold are compared in the same coordinate system, and the difference between the color change value and the threshold is used to show whether the color mutation is sufficient to support the judgment of surface adhesion.

[0073] For example, if the average color intensity of the central region of a low-confidence outlier is 86 and the average color intensity of the boundary region is 124, then the color change value is:

[0074]

[0075] When the preset mutation threshold is 30, since the color change value 38 is greater than the preset mutation threshold of 30, and the epidermal texture of the outer reference area is continuous, it indicates that there is a relatively clear color boundary between the low-confidence anomalous area and the surrounding epidermis, but this boundary is not accompanied by the destruction of the outer epidermal texture. Therefore, the low-confidence anomalous area can be identified as surface adhesion. If the color change value does not reach the preset mutation threshold, and the epidermal texture of the outer reference area remains continuous, it indicates that the color change between the central area and the boundary area is relatively gradual, and it is more likely to be a local color difference within the epidermis of the Polygonatum rhizome itself. The low-confidence anomalous area can be identified as a local color difference.

[0076] When abnormal information spreads from the central area through the boundary area to the outer reference area, and the clarity of the skin texture in the outer reference area is lower than the preset clarity threshold or is interrupted, it indicates that the abnormal change has affected the surrounding skin texture and has the characteristics of outward expansion or damage to the skin structure. This low-confidence abnormal area can be identified as a real defect area. Skin texture clarity can be determined based on local contrast, gradient energy, texture line continuity, or texture frequency response.

[0077] After identifying the true defect area, the clarity of the epidermal texture in the central area, boundary area, and peripheral reference area can be further compared. If the clarity of the epidermal texture in the central area of ​​a low-confidence anomalous region is 0.31, the clarity in the boundary area is 0.43, the clarity in the peripheral reference area is 0.56, and the clarity in the adjacent normal epidermal area is 0.72, then the clarity of the epidermal texture in the central area, boundary area, and peripheral reference area is lower than that in the adjacent normal epidermal area, and the degree of clarity impairment gradually decreases from the central area to the peripheral reference area, indicating that the abnormal effect is most obvious in the central area. If, at the same time, the epidermal texture in the central area is almost completely lost, and the boundary area shows edge collapse, then this is consistent with the manifestation of tissue softening or local damage caused by decay defects, and the low-confidence anomalous region can be identified as a decay defect. Figure 7 The columnar sections show the differences in texture clarity between the central area, boundary area, peripheral reference area and adjacent normal epidermis, demonstrating that each region of the abnormal area has varying degrees of texture attenuation compared to the normal epidermis.

[0078] In another detection scenario, if abnormal color or dot-like anomalies extend discretely from the central area along the gaps in the epidermal texture towards the boundary area and the outer reference area, and the clarity of the epidermal texture in the outer reference area is lower than that of the adjacent normal epidermal area, then the distribution of dot-like anomalies in the boundary area and the outer reference area can be further compared. The distribution of dot-like anomalies can be represented by dot-like anomaly density, the calculation formula of which is:

[0079]

[0080] in, Indicates point-like abnormal density. This indicates the number of point-like anomalies identified within the corresponding area. This represents the area of ​​the corresponding region. The derivation of this formula is based on the idea of ​​correlating the number of point anomalies with the area of ​​their respective regions, using the number of point anomalies per unit area to reflect the degree of dispersion of the anomalies, thereby avoiding the influence of the diffusion judgment solely on the size of the region.

[0081] For example, if 18 point anomalies are identified within a boundary region, and the boundary region area is 1200 pixels, then the point anomaly density within the boundary region is:

[0082]

[0083] The number of point anomalies identified within the outer reference area is 22. The area of ​​the outer reference area is 1800 pixels. Therefore, the point anomaly density within the outer reference area is:

[0084]

[0085] When punctate anomalies are present in both the boundary area and the outer reference area, and these anomalies extend discretely from the boundary area to the outer reference area along the gaps in the epidermal texture, even if the density of punctate anomalies in the outer reference area is lower than that in the boundary area, it still indicates that the punctate anomalies have crossed the boundary area and entered the outer reference area. Simultaneously, the epidermal texture clarity of the outer reference area (0.56) is lower than that of the adjacent normal epidermal area (0.72), indicating that the mold abnormality not only exists in the central part but has also spread outward along the gaps in the epidermal texture, affecting the outer epidermal texture. Therefore, the mold defect can be classified as a diffuse mold defect. Figure 7 The broken line section further illustrates the changes in point anomaly density between the boundary area and the outer reference area, and combines it with the texture clarity bar information, so that the criteria for re-judging point anomalies entering the outer reference area and the outer texture being lower than the normal epidermis can be presented simultaneously.

[0086] By using the above method, when the confidence level of the preliminary identification results of suspected abnormal areas is insufficient, the color abrupt change, texture continuity, texture clarity change and point-like abnormal discrete extension relationship between the central area, boundary area and the outer reference area can be used for re-judgment, thereby distinguishing surface adhesion, local color difference, mold defects, rot defects and diffuse mold defects, and improving the reliability of the detection results of appearance defects of Polygonatum rhizome.

Claims

1. A method for detecting appearance defects in Polygonatum rhizome based on computer vision, characterized in that, include: Obtain an appearance image of the rhizome of Polygonatum to be detected, perform image segmentation on the appearance image to obtain the main body region of the rhizome, and extract suspected abnormal regions in the main body region of the rhizome whose grayscale, color, texture or edge features meet preset abnormality conditions. Extract the defect features and normal texture features of the suspected abnormal area. The defect features include at least one of the following: epidermal texture interruption, edge abruptness, hole morphology, linear cracking, and planar diffusion. The normal texture features include at least one of the following: continuous distribution along the segment direction of Polygonatum tuber, consistent with the direction of adjacent wrinkles, continuous epidermal texture, and color gradient change satisfying a preset smooth condition. Based on the defect features and the normal texture features, the defect matching degree and the normal texture matching degree are calculated respectively. Based on the comparison results of the defect matching degree and the normal texture matching degree, the suspected abnormal region is re-judged to determine whether the suspected abnormal region is a real defect region, a normal texture region or a non-defect interference region.

2. The method for detecting appearance defects in Polygonatum rhizome based on computer vision according to claim 1, characterized in that, Using the boundary of the suspected abnormal region as a dividing line, the epidermal texture on both sides of the boundary is extracted; when the difference in texture direction on both sides of the boundary is less than a preset direction threshold, the color gradient change meets a preset smooth condition, and there is granular or sheet-like covering information in the suspected abnormal region, the suspected abnormal region is determined to be a surface attachment region; when the epidermal texture on both sides of the boundary is misaligned, terminated, or discontinuous, the suspected abnormal region is determined to be a real defect region.

3. The method for detecting appearance defects in Polygonatum rhizome based on computer vision according to claim 1, characterized in that, When the suspected abnormal area is linear or concave, determine whether the suspected abnormal area extends continuously with the adjacent wrinkles along the segment direction of the Polygonatum tuber. If the extension direction, width variation, and edge gradient of the suspected abnormal area meet the preset consistency conditions with the adjacent wrinkles, it is determined to be a normal texture area; if the suspected abnormal area cuts off the adjacent epidermal texture or makes the epidermal textures on both sides discontinuous, it is determined to be a real defect area.

4. The method for detecting appearance defects in Polygonatum rhizome based on computer vision according to claim 1, characterized in that, Regions with a classification confidence level lower than a preset confidence threshold in the suspected abnormal regions are classified as low-confidence abnormal regions. When re-judging the low-confidence abnormal regions, the low-confidence abnormal regions are divided into a central region, a boundary region, and an outer reference region. When abnormal information is distributed in the central area and the surface texture of the outer reference area is continuous, it is determined to be surface adhesion or local color difference; when abnormal information spreads from the central area through the boundary area to the outer reference area, and the clarity of the surface texture of the outer reference area is lower than the preset clarity threshold or is interrupted, it is determined to be a real defect area.

5. The method for detecting appearance defects in Polygonatum rhizome based on computer vision according to claim 3, characterized in that, When determining whether the suspected abnormal region extends continuously with the adjacent wrinkle, the texture endpoints at both ends of the suspected abnormal region and the texture endpoints of the adjacent wrinkle are extracted respectively. When the distance between the endpoints of two types of textures is less than a preset distance threshold and the angle between the endpoint directions is less than a preset angle threshold, it is determined that the suspected abnormal area and the adjacent wrinkle form a continuous extension. When the distance between the endpoints reaches a preset distance threshold, or the angle between the endpoints reaches a preset angle threshold, the suspected abnormal area is determined to cut off the adjacent epidermal texture.

6. The method for detecting appearance defects in Polygonatum rhizome based on computer vision according to claim 3, characterized in that, When the suspected abnormal area is linear, the correspondence of the epidermal textures on both sides is compared along the length of the suspected abnormal area; when the epidermal textures on both sides maintain the same arrangement order on both sides of the suspected abnormal area, it is determined to be a normal texture area; when the epidermal textures on both sides are misaligned, missing, or have non-corresponding breakpoints on both sides of the suspected abnormal area, it is determined to be a real defect area.

7. The method for detecting appearance defects in Polygonatum rhizome based on computer vision according to claim 3, characterized in that, When the suspected abnormal area is concave, the width change and edge gradient of the suspected abnormal area are compared with those of the adjacent wrinkles. When the width change rate of the suspected abnormal area is less than a preset width change threshold, and the edge gradient of the suspected abnormal area meets the preset consistency condition with the edge gradient of the adjacent wrinkles, it is determined to be a normal texture area. When the width change rate of the suspected abnormal area reaches the preset width change threshold and is accompanied by a sudden change in the edge gradient, it is determined to be a real defect area.

8. The method for detecting appearance defects in Polygonatum rhizome based on computer vision according to claim 4, characterized in that, When it is determined that the abnormal information is distributed in the central area and the epidermal texture of the peripheral reference area is continuous, it is further determined whether the color change between the central area and the boundary area meets the preset mutation condition; if the preset mutation condition is met, the low confidence abnormal area is determined to be surface adhesion; if the preset mutation condition is not met, the low confidence abnormal area is determined to be local color difference.

9. The method for detecting appearance defects in Polygonatum rhizome based on computer vision according to claim 4, characterized in that, When it is determined that abnormal information spreads from the central area through the boundary area to the outer reference area, the clarity of the skin texture in the central area, the boundary area, and the outer reference area is compared. If the clarity of the skin texture decreases from the central area to the outer reference area, the low-confidence abnormal area is determined to be a mold defect. If the skin texture in the central area disappears and the boundary area shows edge collapse, the low-confidence abnormal area is determined to be a rot defect.

10. The method for detecting appearance defects in Polygonatum rhizome based on computer vision according to claim 9, characterized in that, When determining that the low-confidence abnormal area is a mold defect, the distribution of point-like abnormalities in the boundary area and the peripheral reference area is further compared; when the point-like abnormalities extend discretely along the gaps in the epidermal texture towards the peripheral reference area, and the clarity of the epidermal texture in the peripheral reference area is lower than the clarity of the epidermal texture in the adjacent normal epidermal area, the mold defect is determined to be a diffuse mold defect.

Citation Information

Patent Citations

  • Rhizome agricultural product defect detection method based on machine vision

    CN114354628A

  • A Machine Vision-Based Defect Detection Method for Root and Tuber Agricultural Products

    CN114354628B

  • Fruit grading method and device for machine vision of taro harvesting equipment

    CN118883544A