A corrugated carton appearance defect detection method based on image recognition
Patent Information
- Application Number
- CN202610574340.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-28
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2046-04-28
AI Technical Summary
[0005]因此,本发明提供了一种基于图像识别的瓦楞纸盒外观缺陷检测方法解决瓦楞纸盒图像识别检测中纸纹纹理干扰导致真实外观缺陷判定准确性不足的问题
[0045]本发明有益效果为:通过对异常残差区域进行瓦楞纸纹方向场解耦识别,能够在图像识别结果中分离纸纹方向变化、纹理连续性波动及局部成像扰动,降低非缺陷纹理因素对异常区域判定的影响;将当前纸纹特征与正常纸纹基准进行匹配确认,为真实缺陷区域提供明确的纹理一致性判断依据,提升异常区域边界提取的精细程度和局部外观异常识别的稳定性,从而提高瓦楞纸盒外观缺陷检测整体结果的准确性和可靠性。
Smart Images

Figure CN122335829B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial vision technology, and in particular to a method for detecting appearance defects in corrugated cardboard boxes based on image recognition. Background Technology
[0002] With the development of packaging manufacturing automation, industrial vision acquisition equipment, and image recognition algorithms, the appearance inspection of corrugated boxes is gradually evolving from manual sampling to online, intelligent, and refined processes. These technologies have been widely applied in scenarios such as packaging printing quality monitoring, formed structure inspection, and surface anomaly identification. Through image registration, texture analysis, and feature extraction, the appearance of corrugated boxes is digitally characterized and their quality assessed.
[0003] However, existing corrugated cardboard box appearance inspection technologies often struggle to establish stable, regionalized appearance discrimination criteria when faced with various cardboard box models, complex printed patterns, and natural paper textures. Because the image feature distribution varies across different structural regions, and paper grain direction, lighting changes, and local anomalies easily generate similar visual responses during image recognition, existing methods are prone to problems such as unclear sources of abnormal residuals and misidentification of normal textures as defects, affecting the accuracy of locating and determining true defects. Summary of the Invention
[0004] In view of the aforementioned existing problems, the present invention is proposed.
[0005] Therefore, this invention provides an image recognition-based method for detecting appearance defects in corrugated cardboard boxes, which solves the problem of insufficient accuracy in judging true appearance defects caused by paper texture interference in image recognition detection of corrugated cardboard boxes.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] This invention provides a method for detecting appearance defects in corrugated cardboard boxes based on image recognition, which includes obtaining the model information of the corrugated cardboard box to be detected and generating a corresponding structural reference template;
[0008] Retrieve the standard appearance image set corresponding to the model information, register and divide the standard appearance image set into image blocks according to the structural reference template, extract the image recognition information of each standard image block, and construct a structural constraint memory library according to the regional position of each standard image block in the structural reference template.
[0009] Based on the region location and image recognition information in the structural constraint memory, a normal appearance reconstruction template is established, and the normal paper texture reference corresponding to the region location is determined.
[0010] The current appearance image of the corrugated cardboard box to be inspected is acquired, and the current appearance image is registered and divided into image blocks according to the structural reference template to form a set of image blocks to be inspected with structural region labels.
[0011] Based on the structural region label of each image block to be detected, the corresponding normal appearance reconstruction template is called to generate the normal appearance reconstruction image block at the corresponding position, and image difference recognition is performed with the image block to be detected to determine the abnormal residual region.
[0012] The corrugated paper texture direction field is decoupled and identified in the abnormal residual area to obtain the current paper texture features. These features are then compared with the normal paper texture reference to confirm the real defect area and output the appearance defect detection information.
[0013] As a preferred embodiment of the image recognition-based corrugated cardboard box appearance defect detection method of the present invention, the specific steps for generating the corresponding structural reference template are as follows:
[0014] Obtain the model information of the corrugated cardboard box to be tested, parse the model information of the corrugated cardboard box to be tested, and obtain the model identifier of the corrugated cardboard box to be tested;
[0015] Based on the model identifier of the corrugated cardboard box to be tested, the corresponding cardboard box structure unfolding relationship is retrieved, and the structural area distribution corresponding to the model information of the corrugated cardboard box to be tested is obtained.
[0016] Based on the structural area distribution corresponding to the model information of the corrugated cardboard box to be tested, the position of the appearance area of the corrugated cardboard box to be tested is marked, and the corresponding structural reference template is generated.
[0017] As a preferred embodiment of the image recognition-based method for detecting appearance defects in corrugated cardboard boxes according to the present invention, the specific steps for extracting image recognition information from each standard image block are as follows:
[0018] Based on the model information, retrieve the standard appearance image set corresponding to the corrugated cardboard box to be tested, and register the standard appearance images in the standard appearance image set with the structural reference template to obtain the standard registration image.
[0019] Based on the structural region distribution information, the standard registration image is divided into image blocks to obtain each standard image block carrying the region location;
[0020] Image normalization is performed on each standard image block, and the corresponding normal appearance feature vector is extracted. The normal appearance feature vector is then associated with the region location corresponding to the standard image block to obtain the image recognition information of each standard image block.
[0021] The image recognition information of each standard image block is associated with the region position in the structural reference template to form a region feature record, which is then classified and stored according to the region position to obtain the structural constraint memory.
[0022] As a preferred embodiment of the image recognition-based corrugated cardboard box appearance defect detection method of the present invention, the specific steps for establishing the normal appearance reconstruction template are as follows:
[0023] Image recognition information corresponding to standard image blocks at the same location is read from the structural constraint memory and merged to obtain the normal appearance reference features corresponding to the location.
[0024] Using the region location as a constraint, a correspondence is established between the image recognition information of the image block to be detected and the normal appearance reference features, thus obtaining the normal appearance reconstruction template corresponding to the region location.
[0025] As a preferred embodiment of the image recognition-based corrugated cardboard box appearance defect detection method of the present invention, wherein: determining the normal paper texture reference corresponding to the region location refers to performing paper texture direction field recognition on the standard image blocks corresponding to each standard image block under the same region location to obtain the region paper texture direction distribution, and determining the normal paper texture reference corresponding to the region location based on the direction stability, texture spacing and texture continuity in the region paper texture direction distribution.
[0026] As a preferred embodiment of the image recognition-based corrugated cardboard box appearance defect detection method of the present invention, the specific steps for forming a set of image blocks to be detected with structural region labels are as follows:
[0027] Acquire the current appearance image of the corrugated cardboard box to be inspected, perform image correction on the current appearance image to obtain the current corrected image, and register the current corrected image with the structural reference template to obtain the current registered image;
[0028] Based on the structural reference template, the current registered image is divided into image blocks and assigned structural region labels to form a set of image blocks to be detected with structural region labels.
[0029] As a preferred embodiment of the image recognition-based corrugated cardboard box appearance defect detection method of the present invention, the specific steps for generating the normal appearance reconstruction image block at the corresponding position are as follows:
[0030] Based on the structural region label of the image block to be detected, determine the region position of the image block to be detected in the structural reference template, and call the corresponding normal appearance reconstruction template from the structural constraint memory.
[0031] Based on the normal appearance reconstruction template, the image block to be detected is matched with the normal appearance reference features corresponding to the region location to determine the normal appearance reconstruction parameters at the corresponding location.
[0032] The normal appearance content of the corresponding region of the image block to be detected is reconstructed according to the normal appearance reconstruction parameters to obtain a normal appearance reconstructed image block that is in the same region as the image block to be detected.
[0033] As a preferred embodiment of the image recognition-based corrugated cardboard box appearance defect detection method of the present invention, the specific steps for determining the abnormal residual region are as follows:
[0034] The image block to be detected is compared with the image block reconstructed from the normal appearance at the corresponding position to obtain the initial difference image;
[0035] Based on the structural region labels and structural reference templates of the image blocks to be detected, the structural difference responses related to the regions corresponding to the structural region labels in the initial difference image are suppressed to obtain a structural constraint difference image.
[0036] Based on the normal paper texture reference corresponding to the region location, the paper texture residuals in the structural constraint difference image that are consistent with the normal paper texture direction are weakened to obtain candidate abnormal residual images.
[0037] Connectivity processing is performed on coherent regions in candidate anomalous residual images. Based on boundary changes, color deviations, and texture continuity changes of coherent regions, anomalous residual regions are identified and associated with the structural region labels of the corresponding image blocks to be detected, thus obtaining anomalous residual regions with structural region labels.
[0038] As a preferred embodiment of the image recognition-based corrugated cardboard box appearance defect detection method of the present invention, the specific steps for obtaining the current paper texture features are as follows:
[0039] Based on the structural region label of the abnormal residual region, determine the region location corresponding to the abnormal residual region, and obtain the abnormal local image in the corresponding image block to be detected.
[0040] Image component separation and orientation field recognition are performed on abnormal local images to obtain a mixed orientation field containing paper texture orientation components and non-paper texture orientation components;
[0041] Based on the normal paper texture reference corresponding to the region location, the mixed direction field is decoupled, and the non-paper texture direction components are stripped to obtain the paper texture direction field. Based on the direction continuity, texture clarity and texture arrangement of the paper texture direction field in the abnormal residual region, the current paper texture features are determined.
[0042] As a preferred embodiment of the image recognition-based corrugated cardboard box appearance defect detection method of the present invention, the specific steps for outputting appearance defect detection information are as follows:
[0043] Based on the structural region label of the abnormal residual region, the corresponding region location is determined. The current paper texture feature is compared with the normal paper texture benchmark corresponding to the region location to obtain the paper texture deviation information.
[0044] Cross-check the paper texture deviation information with the image difference information of the abnormal residual area to identify the real defect area. Based on the location of the real defect area in the current appearance image, the structural area label and the defect type, generate appearance defect detection information.
[0045] The beneficial effects of this invention are as follows: by decoupling and identifying the corrugated paper texture direction field in abnormal residual areas, it is possible to separate changes in paper texture direction, fluctuations in texture continuity, and local imaging disturbances in the image recognition results, thereby reducing the influence of non-defect texture factors on the determination of abnormal areas; by matching and confirming the current paper texture features with the normal paper texture benchmark, it provides a clear basis for judging the texture consistency of real defect areas, improves the precision of abnormal area boundary extraction and the stability of local appearance anomaly identification, thereby improving the accuracy and reliability of the overall results of corrugated cardboard box appearance defect detection. Attached Figure Description
[0046] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 This is a flowchart of an image recognition-based method for detecting appearance defects in corrugated cardboard boxes.
[0048] Figure 2 A flowchart for constructing a structural constraint memory library.
[0049] Figure 3 A flowchart for identifying abnormal residual regions.
[0050] Figure 4 A flowchart for identifying the actual defect area. Detailed Implementation
[0051] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0052] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0053] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0054] Reference Figures 1-4 This is one embodiment of the present invention, which provides a method for detecting appearance defects in corrugated cardboard boxes based on image recognition, including the following steps:
[0055] S1: Obtain the model information of the corrugated cardboard box to be tested and generate the corresponding structural reference template.
[0056] S1.1: Obtain the model information of the corrugated cardboard box to be tested, parse the model information of the corrugated cardboard box to be tested, and obtain the model identifier of the corrugated cardboard box to be tested.
[0057] When the corrugated cardboard box to be inspected enters the appearance defect inspection station, the production flow barcode bound to the corrugated cardboard box to be inspected is read to obtain the model information string. The model information string includes the customer part number field, structure version field, cardboard box specification field, flute type field and production batch field arranged in sequence.
[0058] The model information string is normalized by removing leading and trailing spaces, converting all English letters to uppercase, and replacing all different separators used to separate fields with hyphens.
[0059] The standardized model information string is segmented into fields using a hyphen connector to obtain the field segmentation results.
[0060] According to the field validation rules stored in the paper box structure process data table, the field segmentation results are validated. When the field segmentation results do not meet the requirements for the number of fields, field order, or field format, model parsing exception information is generated, and the generation of structural baseline template is stopped.
[0061] When the field segmentation result meets the field validation rules, the customer part number field, structure version field, carton specification field, and flute type field are extracted from the field segmentation result, and combined in order to obtain the model identifier of the corrugated carton to be tested; and the production batch field is used as the batch auxiliary index.
[0062] It should be noted that the pre-stored paper box structure process data sheet is compiled based on the finalized die-cutting file, production process sheet, and model coding rules of the corrugated paper box to be tested before mass production. The die-cutting file provides the cutting outline, crease line, slotting line, and bonding boundary line; the production process sheet provides the model identification, paper box specifications, and flute type information; and the model coding rules provide the number of fields, field order, and field format requirements corresponding to the model information string.
[0063] S1.2: Based on the model identifier of the corrugated cardboard box to be tested, retrieve the corresponding cardboard box structure unfolding relationship, and obtain the structural area distribution corresponding to the model information of the corrugated cardboard box to be tested.
[0064] The model identifier of the corrugated cardboard box to be tested is used to search the pre-stored cardboard box structure and process data table to retrieve the corresponding cardboard box structure unfolding relationship.
[0065] The unfolding relationship of the paper box structure includes the unfolding coordinate reference, cutting outline, crease line, slotting line, bonding boundary line, structural area name, and the correspondence between structural area name and boundary point.
[0066] Based on the unfolding coordinate reference in the unfolding relationship of the paper box structure, read the endpoints and intersections formed between the cutting outline, crease line, slotting line and bonding boundary line, take the endpoints and intersections as structural boundary points, and record the horizontal and vertical coordinates of each structural boundary point in the unfolding relationship of the paper box structure.
[0067] Based on the correspondence between structural region names and structural boundary points, the structural boundary points with the same structural region name are connected sequentially according to the connection order recorded in the paper box structure unfolding relationship to obtain the closed structural region boundary corresponding to each structural region name.
[0068] Record the region attributes of the closed structural region boundary. The region attribute record includes the structural region name, structural boundary point order, line type attribute, and adjacent structural region names; the line type attribute includes the trim outline attribute, crease line attribute, slot line attribute, and bonding boundary line attribute.
[0069] S1.3: Based on the structural region distribution corresponding to the model information of the corrugated cardboard box to be inspected, the external areas of the corrugated cardboard box to be inspected are calibrated to generate the corresponding structural reference template. The names of each structural region, the boundaries of closed structural regions, the coordinates of structural boundary points, the line type attributes, and the names of adjacent structural regions are summarized.
[0070] Extract the coordinates of each structural boundary point from the structural region distribution, and statistically analyze the minimum and maximum values of the horizontal coordinates, the minimum and maximum values of the vertical coordinates.
[0071] The minimum and maximum values of the horizontal coordinates, the minimum and maximum values of the vertical coordinates are used to determine the expanded bounding rectangle of the enclosing structural region.
[0072] Using the expanded bounding rectangle as the position calibration reference, the minimum-maximum normalization method is used to normalize the horizontal and vertical coordinates of each structural boundary point, thereby obtaining the normalized horizontal and vertical positions of each structural boundary point in the structural reference template.
[0073] By sequentially connecting the normalized lateral and longitudinal positions of each structural boundary point in the structural region distribution corresponding to the model information of the corrugated cardboard box to be tested, the normalized structural region boundary corresponding to each structural region name is obtained.
[0074] Based on the normalized structural region boundary, determine the normalized location range corresponding to each structural region name. The normalized location range is the area enclosed by the normalized structural region boundary.
[0075] By associating the names of each structural region, the normalized structural region boundary, the normalized position range, the line type attribute, the names of adjacent structural regions, and the region boundary tolerance range, the positional calibration content of the appearance area of the corrugated cardboard box to be detected is obtained.
[0076] The location marking information is associated with and saved according to the model identifier of the corrugated cardboard box to be tested, and the corresponding structural reference template is generated.
[0077] The structural baseline template includes the expanded bounding rectangle, the normalized structural region boundary corresponding to each structural region name, the normalized position range, the line type attribute, the names of adjacent structural regions, and the region boundary tolerance range.
[0078] S2: Retrieve the standard appearance image set corresponding to the model information, register and divide the standard appearance image set into image blocks according to the structural reference template, extract the image recognition information of each standard image block, and construct a structural constraint memory library according to the regional position of each standard image block in the structural reference template.
[0079] S2.1: Retrieve the standard appearance image set corresponding to the corrugated cardboard box to be tested based on the model information, and register the standard appearance images in the standard appearance image set with the structural reference template to obtain the standard registration image.
[0080] The model identifier of the corrugated cardboard box to be tested is used as the search criterion to retrieve the standard appearance image set corresponding to the corrugated cardboard box to be tested.
[0081] The standard appearance image set consists of appearance images of corrugated boxes of the same model that have been confirmed as qualified before or in the early stage of mass production, and is pre-associated and saved with the model identification of the corrugated box to be tested.
[0082] The images in the standard appearance image set were acquired under the same imaging parameters and shooting position conditions, and images with blurriness, abnormal exposure, structural obstruction, and obvious printing fluctuations were removed.
[0083] The bounding rectangle is used as the reference range for standard appearance image registration, and the normalized structural region boundary is used as the basis for the position of the structural region after standard appearance image registration. Each standard appearance image in the standard appearance image set is converted to grayscale to obtain the corresponding grayscale image.
[0084] The foreground and background are segmented using the Otsu's method for grayscale images. The closed connected region with the largest area is retained as the outer contour of the cardboard box, and the outer contour of the outer contour of the cardboard box is extracted to obtain the outer contour of the cardboard box.
[0085] Determine the four corner points in the standard appearance image based on the outline of the cardboard box, and record the image coordinates of the four corner points in the order of upper left, upper right, lower right, and lower left; record the template coordinates of the four reference corner points in the same order based on the expanded bounding rectangle in the structural reference template.
[0086] Based on the image coordinates of the four exterior corner points and the template coordinates of the four reference corner points, the homography transformation matrix from the standard exterior image to the structural reference template is calculated, and expressed as:
[0087] ;
[0088] In the formula, Number the corner points. For the number The horizontal image coordinates of the corner points in the standard appearance image. For the number The vertical image coordinates of the exterior corner points in the standard exterior image. For the number The horizontal template coordinates of the reference corner point in the structural reference template. For the number The longitudinal template coordinates of the reference corner point in the structural reference template. These are homogeneous coordinate scale values. This is the homography transformation matrix from the standard appearance image to the structural reference template.
[0089] The standard appearance image is subjected to perspective transformation based on the homography transformation matrix, and the pixel value of each pixel position after transformation is determined by bilinear interpolation to obtain the standard registration image.
[0090] S2.2: Based on the structural region distribution information, the standard registration image is divided into image blocks to obtain each standard image block carrying the region location.
[0091] Read the image dimensions of the standard registration image to obtain the horizontal and vertical pixel counts of the standard registration image.
[0092] Based on the horizontal and vertical pixel counts of the standard registration image, the normalized structural region boundaries in the structural reference template are converted into pixel boundaries in the standard registration image, as follows:
[0093] ;
[0094] In the formula, Number the structural boundary points in the normalized structural region boundary. For the number The normalized lateral positions of the structural boundary points in the structural reference template. For the number The normalized longitudinal position of the structural boundary points in the structural reference template. The number of horizontal pixels in the standard registered image. The vertical pixel count of the standard registered image. For the number The lateral pixel positions of the structural boundary points in the standard registration image. For the number The vertical pixel positions of the structural boundary points in the standard registration image.
[0095] Based on the pixel coordinates after transformation of each normalized structural boundary point, the pixel boundaries corresponding to each structural region name are obtained by connecting the structural boundary points in order. Then, the standard registered image is cropped according to the pixel boundaries to obtain the standard region image corresponding to each structural region name.
[0096] Standard region images retain the corresponding structural region names, normalized location ranges, pixel boundaries, line type attributes, and names of adjacent structural regions.
[0097] The image block division size is determined based on the minimum detectable defect size (in millimeters) specified in the product inspection specifications and the pixel resolution obtained from the image acquisition equipment calibration.
[0098] Based on pixel resolution, the minimum detectable defect size is converted into the number of horizontal and vertical pixels in the standard registered image and used as the horizontal and vertical pixel sizes of the image block, respectively.
[0099] The pixel area corresponding to the smallest detectable defect size is determined based on the horizontal and vertical pixel dimensions of the image block.
[0100] Using the standard region image corresponding to each structural region name as the dividing object, the image blocks are divided sequentially according to the horizontal pixel size and the vertical pixel size of the image blocks to obtain multiple standard image blocks corresponding to each structural region name; the standard image blocks located at the edge of the structural region are cropped according to the pixel boundary corresponding to the structural region name, and the cropped standard image blocks still belong to the corresponding structural region name.
[0101] The region location of each standard image block is recorded. The region location record includes the name of the structural region to which the standard image block belongs, the horizontal division number, the vertical division number, the normalized position range, the pixel boundary, the line type attribute, and the names of the adjacent structural regions.
[0102] Based on the model identifier of the corrugated cardboard box to be tested, the image sequence number of the standard appearance image in the standard appearance image set, and the regional location record of the standard image block, a standard image block identifier is generated, and the standard image block identifier is associated with the corresponding standard image block.
[0103] The standard image blocks that have completed the regional location recording and are associated with the standard image block identifier are used as standard image blocks carrying regional locations, thus obtaining each standard image block carrying the regional location.
[0104] S2.3: Perform image normalization processing on each standard image block, extract the corresponding normal appearance feature vector, associate the normal appearance feature vector with the corresponding region position of the standard image block to obtain the image recognition information of each standard image block, and associate it with the region position in the structural reference template to form a region feature record, and classify and store it according to the region position to obtain the structural constraint memory library.
[0105] Based on each standard image block carrying the region location, each standard image block is processed into grayscale to obtain the corresponding standard grayscale image block.
[0106] Read the gray values of all pixel positions involved in feature extraction within the standard grayscale image block, and perform an arithmetic average to obtain the grayscale mean of the standard grayscale image block. Calculate the grayscale standard deviation based on the grayscale mean. Use the grayscale mean and grayscale standard deviation as the grayscale statistical features of the standard image block.
[0107] The standard grayscale image block is normalized by performing grayscale normalization processing based on the grayscale mean and grayscale standard deviation to obtain a normalized standard image block; when the grayscale standard deviation is zero, the normalized grayscale value of each pixel position in the standard grayscale image block is set to zero.
[0108] Based on normalized standard image blocks, the Sobel operator is used to calculate the horizontal and vertical gradient values at each pixel location, thereby obtaining the gradient magnitude and gradient direction at each pixel location.
[0109] The pixel positions within a standard image patch are classified and statistically analyzed according to the magnitude of the gradient direction. The gradient magnitude of the pixel position is used as the statistical weight of the corresponding category to obtain the gradient direction histogram of the standard image patch.
[0110] Local texture features are extracted from normalized standard image blocks using local binary mode. Local binary mode codes are generated based on the grayscale relationship between the center pixel position and the neighboring pixel positions. The local binary mode codes are statistically analyzed to obtain the local texture histogram of the standard image block.
[0111] The grayscale statistical features, gradient orientation histogram, and local texture histogram of the standard image patch are concatenated in sequence to obtain the normal appearance feature vector corresponding to the standard image patch.
[0112] By associating the normal appearance feature vector with the corresponding region location of the standard image block, the image recognition information of the standard image block is obtained.
[0113] S2.4: Associate the image recognition information of each standard image block with the region position in the structural reference template to form a region feature record, and classify and store it according to the region position to obtain the structural constraint memory library.
[0114] Read the image recognition information of each standard image block and match the region location carried in the image recognition information with the region location in the structural reference template.
[0115] When the region location in the image recognition information matches the region location in the structural reference template, the normal appearance feature vector in the image recognition information is associated with the corresponding region location in the structural reference template, and the structural region name, normalized position range, normalized structural region boundary, line type attribute, adjacent structural region name, standard image block identifier, and normal appearance feature vector corresponding to the region location are recorded to form a region feature record.
[0116] Regional feature records are categorized and stored according to their regional location. Regional feature records corresponding to the same regional location are grouped into the same storage entry, while regional feature records corresponding to different regional locations are grouped into different storage entries, thus obtaining a structural constraint memory.
[0117] S3: Based on the region location and image recognition information in the structural constraint memory, establish a normal appearance reconstruction template and determine the normal paper texture reference corresponding to the region location.
[0118] S3.1: Read the image recognition information corresponding to the same region location from the structural constraint memory, merge the image recognition information, and obtain the normal appearance reference features corresponding to the region location.
[0119] Read the regional feature records from the structural constraint memory according to the regional location, and extract the normal appearance feature vector under the same regional location.
[0120] The normal appearance feature vectors at the same location are dimensionally aligned according to the concatenation order of gray-level statistical features, gradient direction histogram, and local texture histogram.
[0121] The normal appearance feature vectors that have completed dimension alignment are merged according to the median of each dimension to obtain the baseline feature value corresponding to each feature dimension. The baseline feature values are then arranged in order of feature dimension to obtain the normal appearance baseline feature corresponding to the region location.
[0122] The region location, structural region name, normalized location range, and normal appearance reference features are associated and saved.
[0123] S3.2: Using the region location as a constraint, establish the correspondence between the image recognition information of the image block to be detected and the normal appearance reference features to obtain the normal appearance reconstruction template corresponding to the region location.
[0124] By using the region location as a constraint, a correspondence is established between the image recognition information of subsequent image blocks to be detected and the normal appearance reference features of the same region location.
[0125] The correspondence is used to limit the subsequent image blocks to be detected to only perform region constraint matching with the normal appearance reference features corresponding to the same region location, and to call the normal appearance content corresponding to the same region location according to the matching result.
[0126] Based on the region feature records corresponding to the same region location in the structural constraint memory, read the normal appearance reference features corresponding to the region location, and associate the region location, normal appearance reference features, and their corresponding relationships.
[0127] The associated region location, normal appearance reference features, and corresponding relationships are used as the normal appearance reconstruction template corresponding to the region location and stored in the structural constraint memory.
[0128] S3.3: Perform paper texture orientation field recognition on standard image blocks corresponding to the same region location to obtain the regional paper texture orientation distribution. Based on the orientation stability, texture spacing and texture continuity in the regional paper texture orientation distribution, determine the normal paper texture reference corresponding to the region location.
[0129] Based on the standard image block identifiers recorded in the structural constraint memory, the standard image blocks corresponding to the same region are read and grayscaled to obtain standard grayscale image blocks for paper texture orientation field recognition.
[0130] The Sobel operator is used to obtain the horizontal and vertical gradient values of the standard grayscale image blocks. Based on the horizontal and vertical gradient values, the structure tensor method is used to statistically analyze the grayscale change relationship in the local neighborhood. The direction with the weakest grayscale change in the local neighborhood is determined as the paper texture direction of the corresponding pixel position, thus obtaining the paper texture direction field corresponding to each standard image block.
[0131] By summing up the paper texture direction fields corresponding to each standard image block at the same location, the distribution of paper texture direction in the region corresponding to the location is obtained.
[0132] Based on the distribution of paper grain direction in the region, the concentration of paper grain direction is statistically analyzed. The paper grain direction angle is converted into radian angle and processed as a double angle. The average cumulative result of the paper grain direction angle after double angle processing is calculated in the cosine and sine directions respectively. The directional stability is determined based on the average cumulative result in the cosine and sine directions. The greater the directional stability, the more concentrated the paper grain direction is in the same region.
[0133] Based on the paper texture direction distribution in the region, the gray-level change sequence of the standard gray-level image block is extracted along the direction perpendicular to the paper texture direction. The local gray-level maximum position in the gray-level change sequence is taken as the paper texture peak position, and the distance between adjacent paper texture peak positions is calculated. The median of the distance is taken as the texture spacing corresponding to the region position.
[0134] Based on the paper grain direction distribution in the region, the paper grain direction difference between adjacent pixel positions within the same standard image block is calculated sequentially along the paper grain direction. The paper grain direction difference corresponding to each standard image block under the same region position is then summarized to obtain the standard direction difference set corresponding to the region position.
[0135] The median of each directional difference in the standard directional difference set is obtained by statistically analyzing the median of the directional differences. The absolute deviation between each directional difference and the median of the directional differences is calculated, and the median of the absolute deviation is statistically analyzed to obtain the directional difference dispersion. The sum of the median of the directional differences and the directional difference dispersion is used as the threshold for determining the directional continuity of the region.
[0136] Based on the directional continuity determination threshold, the number of adjacent pixel pairs whose paper texture direction difference is less than or equal to the directional continuity determination threshold at the same location is counted, and the ratio of the number of adjacent pixel pairs to the total number of adjacent pixel pairs participating in the comparison is calculated to obtain the texture continuity corresponding to the location.
[0137] Based on the grayscale difference between the peak position and the adjacent valley position of the paper texture in the standard grayscale image block, the range of grayscale variation of the paper texture in the same region is statistically analyzed to obtain the normal grayscale variation state of the paper texture corresponding to the region.
[0138] The normal paper texture reference corresponding to the region location is determined by associating the region's paper texture direction distribution, texture spacing, texture continuity, normal paper texture grayscale change state, direction stability, normal direction deviation range, and direction continuity judgment threshold.
[0139] S4: Acquire the current appearance image of the corrugated cardboard box to be inspected, register the current appearance image and divide it into image blocks according to the structural reference template, forming a set of image blocks to be inspected with structural region labels.
[0140] S4.1: Acquire the current appearance image of the corrugated cardboard box to be inspected, perform image correction on the current appearance image to obtain the current corrected image, and register the current corrected image with the structural reference template to obtain the current registered image.
[0141] When the corrugated cardboard box to be inspected enters the appearance defect inspection station and reaches the shooting position, the appearance surface of the corrugated cardboard box to be inspected is photographed to obtain the current appearance image of the corrugated cardboard box to be inspected.
[0142] The camera intrinsic parameters and distortion parameters obtained by the image acquisition device through the checkerboard calibration plate before detection are read, and lens distortion correction is performed on the current appearance image to correct radial and tangential distortion, thus obtaining the current corrected image.
[0143] The current corrected image is converted to grayscale, and the foreground and background are segmented using the Otsu's method. The closed connected region with the largest area is retained as the current cardboard box appearance region. The outer contour of the current cardboard box appearance region is extracted to obtain the current cardboard box appearance contour.
[0144] Based on the current outline of the cardboard box, determine the four current appearance corner points in the current calibration image, and record the image coordinates of the four current appearance corner points in the order of upper left, upper right, lower right, and lower left; read the expanded bounding rectangle in the structural reference template, and record the template coordinates of the four reference corner points corresponding to the expanded bounding rectangle in the same order.
[0145] Based on the image coordinates of the four current appearance corner points and the template coordinates of the four reference corner points, calculate the homography transformation matrix from the current corrected image to the structural reference template; perform perspective transformation on the current corrected image according to the homography transformation matrix, and use bilinear interpolation to determine the pixel values of each pixel position after transformation to obtain the current registered image, and save the registration transformation and inverse transformation relationship from the current appearance image to the current registered image.
[0146] The cardboard box appearance area in the current registration image is aligned with the expanded bounding rectangle in the structural reference template, and each structural region in the current registration image corresponds to the normalized structural region boundary in the structural reference template.
[0147] S4.2: Based on the structural reference template, divide the current registered image into image blocks and assign structural region labels to form a set of image blocks to be detected with structural region labels.
[0148] Read the image size of the current registration image to obtain the horizontal and vertical pixel counts, and convert the normalized structural region boundaries in the structural reference template into pixel boundaries in the current registration image.
[0149] Based on the pixel boundaries corresponding to each structural region name, the current registered image is cropped to obtain the current region image corresponding to each structural region name; the current region image retains the corresponding structural region name, normalized position range, pixel boundary, line type attribute and adjacent structural region names.
[0150] Based on the horizontal and vertical pixel dimensions of the image blocks, the current region image is sequentially divided to obtain the image blocks to be detected corresponding to the names of each structural region.
[0151] The image block to be detected located at the edge of the structural region is cropped according to the corresponding pixel boundary. The cropped image block to be detected still belongs to the corresponding structural region name.
[0152] For each image block to be detected, the region location is recorded. The region location record includes the name of the structural region to which the image block to be detected belongs, the horizontal division number, the vertical division number, the normalized position range, the pixel boundary, the line type attribute, and the names of the adjacent structural regions.
[0153] Based on the location of the image block to be detected, a corresponding structural region label is generated, and the structural region label is assigned to the corresponding image block to be detected, thus obtaining the image block to be detected with structural region label.
[0154] Based on the location of the image block to be detected, a corresponding structural region label is generated, and the structural region label is assigned to the corresponding image block to be detected, thus obtaining the image block to be detected with structural region label.
[0155] All image blocks to be detected with structural region labels are summarized according to structural region name, horizontal division number and vertical division number to form a set of image blocks to be detected with structural region labels.
[0156] S5: Based on the structural region label of each image block to be detected, call the corresponding normal appearance reconstruction template, generate the normal appearance reconstruction image block at the corresponding position, and perform image difference recognition with the image block to be detected to determine the abnormal residual region.
[0157] S5.1: Based on the structural region label of the image block to be detected, determine the region position of the image block to be detected in the structural reference template, and call the corresponding normal appearance reconstruction template from the structural constraint memory.
[0158] Based on a set of image blocks to be detected with structural region labels, the structural region labels corresponding to each image block to be detected are read one by one. The structural region labels include the name of the structural region to which the image block to be detected belongs, the horizontal division number, the vertical division number, and the normalized position range.
[0159] The structural region name, horizontal division number, vertical division number, and normalized position range recorded in the structural region label are determined as the region position of the image block to be detected in the structural reference template.
[0160] Using the region location of the image block to be detected as the retrieval basis, the normal appearance reconstruction template corresponding to the same region location is called from the structural constraint memory; the normal appearance reconstruction template is associated with the region location, normal appearance reference features and region constraint matching rules.
[0161] S5.2: Based on the normal appearance reconstruction template, perform region constraint matching between the image block to be detected and the normal appearance reference features corresponding to the region location to determine the normal appearance reconstruction parameters at the corresponding location.
[0162] The image block to be detected is converted to grayscale to obtain the grayscale image block to be detected.
[0163] Read the gray values of all pixel positions involved in feature extraction within the grayscale image block to be detected, and perform an arithmetic average to obtain the grayscale mean of the grayscale image block to be detected; calculate the grayscale standard deviation of the grayscale values based on the grayscale mean, and use the grayscale mean and grayscale standard deviation as the grayscale statistical features of the image block to be detected.
[0164] The grayscale image block to be detected is normalized based on the grayscale mean and grayscale standard deviation to obtain a normalized image block to be detected; when the grayscale standard deviation is zero, the normalized grayscale value of each pixel position in the grayscale image block to be detected is set to zero.
[0165] Using the same feature extraction method as standard image blocks, gradient orientation histograms and local texture histograms are extracted from the normalized image blocks to be detected. The gray-level statistical features, gradient orientation histograms, and local texture histograms are then concatenated in sequence to obtain the image recognition information of the image blocks to be detected.
[0166] The region location of the image block to be detected is used as a constraint condition. The normal appearance reconstruction template corresponding to the same region location is read, and the normal appearance baseline features and region constraint matching rules are obtained from the normal appearance reconstruction template.
[0167] Based on the region constraint matching rules, the image recognition information of the image block to be detected is matched with the normal appearance reference features corresponding to the same region location. According to the feature difference between the image block to be detected and the normal appearance reference features of the corresponding region location, feature deviation information of the corresponding position of the image block to be detected is generated. Combined with the identification of the standard image block participating in reconstruction, the region constraint matching conditions and the pixel reconstruction method recorded in the normal appearance reconstruction template, the normal appearance reconstruction parameters of the corresponding position of the image block to be detected are determined.
[0168] S5.3: Reconstruct the normal appearance content of the corresponding region of the image block to be detected according to the normal appearance reconstruction parameters to obtain a normal appearance reconstructed image block that is in the same region as the image block to be detected.
[0169] Read the region location and the pixel boundary corresponding to the image block to be detected from the normal appearance reconstruction parameters.
[0170] Based on the normal appearance reconstruction parameters, standard image blocks for reconstruction are selected from the standard image blocks corresponding to the same region position, and the selected standard image blocks are size-aligned and pixel-aligned. The median value of the pixel value at the same pixel position in the aligned standard image blocks is statistically analyzed to generate the initial normal appearance reconstruction image block for the corresponding region position. Then, the initial normal appearance reconstruction image block is locally compensated according to the feature deviation information in the normal appearance reconstruction parameters to obtain the candidate normal appearance reconstruction image block.
[0171] When the image block to be detected is located at the edge of the structural region, or when the pixel range of the candidate normal appearance reconstruction image block is inconsistent with the pixel range of the image block to be detected, the candidate normal appearance reconstruction image block is uniformly cropped according to the pixel boundary corresponding to the image block to be detected, so that the cropped candidate normal appearance reconstruction image block has the same pixel range as the image block to be detected.
[0172] Candidate normal appearance reconstructed image blocks with consistent pixel ranges are identified as normal appearance reconstructed image blocks located in the same region as the image block to be detected.
[0173] S5.4: Compare the image differences between the image block to be detected and the corresponding normal appearance reconstructed image block to obtain the initial difference image.
[0174] The image block to be detected and the corresponding normal appearance reconstructed image block are converted to the same grayscale space, and the grayscale values at the same pixel position are calculated pixel by pixel to obtain the grayscale difference value corresponding to each pixel position. The grayscale difference values corresponding to each pixel position are arranged according to the pixel position relationship in the image block to be detected to form an initial difference image.
[0175] The image block to be detected and the corresponding normal appearance reconstructed image block are converted to the same color space, and the difference value of the same pixel position in each color channel is calculated to obtain the color channel difference record.
[0176] By associating the initial difference image, grayscale difference values, and color channel difference records, image difference information corresponding to the image block to be detected is obtained.
[0177] S5.5: Based on the structural region labels and structural reference templates of the image blocks to be detected, the structural difference responses related to the location of the regions corresponding to the structural region labels in the initial difference image are suppressed to obtain a structural constraint difference image.
[0178] Read the region location record of the image block to be detected, obtain the pixel boundary corresponding to the image block to be detected, and extract the pixel position on the pixel boundary. With each pixel position as the center, read the pixel position directly adjacent to it according to the eight-neighbor relationship in the digital image.
[0179] The pixel positions on the pixel boundary and the positions of directly adjacent pixels are jointly determined as the structural boundary neighborhood in the image block to be detected; in the initial difference image, the gray-level difference response continuously distributed along the pixel boundary within the structural boundary neighborhood is read.
[0180] Read the line type attribute corresponding to the structural boundary neighborhood; when the line type attribute is a crease line attribute, slot line attribute, adhesive boundary line attribute, or cut outline line attribute, determine the gray-scale difference response continuously distributed along the pixel boundary within the corresponding structural boundary neighborhood as the structural difference response related to the region location corresponding to the structural region label.
[0181] Based on the pixel differences between the standard image block and the image block reconstructed from the normal appearance at the same location, the median value of the residual at the same location under the normal appearance state is calculated to obtain the median value of the normal residual at the same location.
[0182] Structural difference responses that are continuously distributed along the pixel boundary within the structural boundary neighborhood and are not accompanied by obvious color deviation, boundary discontinuity, or abnormal paper texture direction are replaced with the median value of the normal residual at the same location to obtain a structural constraint difference image. When the difference response within the structural boundary neighborhood is accompanied by obvious color deviation, boundary discontinuity, or abnormal paper texture direction, the corresponding difference response is retained and is not replaced with the median value of the normal residual at the same location.
[0183] S5.6: Based on the normal paper texture reference corresponding to the region location, weaken the paper texture residuals in the structural constraint difference image that are consistent with the normal paper texture direction to obtain candidate abnormal residual images.
[0184] Based on the region location of the image block to be detected, the corresponding normal paper texture reference is read, and the region paper texture direction distribution, direction stability, texture spacing, texture continuity and direction continuity judgment threshold are obtained.
[0185] Local gradient statistics are performed on the structural constraint difference image to obtain the local direction, local spacing, and continuous extension state of the residual response.
[0186] The deviation range between the main direction and the normal direction of the paper grain is determined based on the distribution of the paper grain direction in the region. The local direction of the residual response is compared with the main direction of the paper grain to obtain the residual direction deviation.
[0187] When the residual direction deviation is within the normal direction deviation range, the local spacing matches the texture spacing, and the continuous extension state meets the requirements of the direction continuity determination threshold and texture continuity, the corresponding residual response is determined as the paper texture residual consistent with the normal paper texture direction.
[0188] The grayscale difference value of the pixel position corresponding to the paper texture residual is replaced with the median value of the normal residual in the same region to obtain the candidate abnormal residual image.
[0189] S5.7: Connect and organize the coherent regions in the candidate abnormal residual image. Based on the boundary changes, color deviations and texture continuity changes of the coherent regions, determine the abnormal residual regions and associate them with the structural region labels of the corresponding image blocks to be detected to obtain abnormal residual regions with structural region labels.
[0190] Based on the pixel differences between standard image patches and reconstructed image patches with normal appearance at the same location, a normal residual sequence corresponding to the location is formed, and the region residual judgment value is determined, expressed as:
[0191] ;
[0192] In the formula, For the location of the region The normal residual sequence is formed by the pixel differences between standard image patches and image patches reconstructed from normal appearance. These are the residual values in the normal residual sequence. This is the median value of the normal residual sequence; This represents the absolute deviation of the median of the normal residual sequence. For the location of the region The regional residual judgment value at that time.
[0193] Pixels in the candidate abnormal residual image whose gray-level difference value is greater than the region residual judgment value are marked as candidate abnormal pixel locations.
[0194] Eight-neighbor connectivity sorting is used to perform connectivity analysis on candidate abnormal pixel locations, and interconnected candidate abnormal pixel locations are merged into coherent regions.
[0195] Based on the pixel area corresponding to the minimum detectable defect size, continuous regions are filtered by area, and continuous regions with pixel areas smaller than the minimum detectable defect size are removed as isolated noise regions.
[0196] Boundary change judgment is performed on the preserved continuous region, the outer contour of the continuous region is extracted, and the outer contour of the continuous region is compared with the pixel boundary of the image block to be detected; when the outer contour of the continuous region is not continuously distributed along the pixel boundary, it is determined that there is a boundary change in the continuous region.
[0197] Color deviation is judged for the preserved continuous region, and the color channel difference between the image block to be detected and the normal appearance reconstructed image block at the corresponding position in the continuous region is read.
[0198] Based on the color channel differences between standard image blocks and reconstructed image blocks with normal appearance in the same region, the difference values of each color channel are statistically analyzed to obtain a color difference set. The median of the color difference set is statistically analyzed to obtain the median value of the color difference. The absolute deviation between the difference values of each color channel in the color difference set and the median value of the color difference is calculated and statistically analyzed to obtain the color difference dispersion.
[0199] The sum of the median value of color difference and the dispersion of color difference is determined as the normal color fluctuation level; when the color channel difference in a continuous region is higher than the normal color fluctuation level, it is determined that there is a color deviation in the continuous region.
[0200] The texture continuity of the preserved continuous area is judged, the extension state of the paper texture direction in the continuous area is read, and it is compared with the texture continuity in the normal paper texture reference of the corresponding area.
[0201] When the extension of the paper grain direction within a continuous area is lower than the texture continuity in the normal paper grain reference, it is determined that there is a change in texture continuity in the continuous area.
[0202] The results of boundary change judgment, color deviation judgment, and texture continuity change judgment corresponding to the continuous region are written into the image difference information of the abnormal residual region. The continuous region that exhibits at least one of the following changes—boundary change, color deviation, or texture continuity change—is identified as the abnormal residual region.
[0203] By associating the abnormal residual regions and their image difference information with the structural region labels of the corresponding image blocks to be detected, abnormal residual regions with structural region labels are obtained.
[0204] S6: Decouple and identify the corrugated paper texture direction field in the abnormal residual area to obtain the current paper texture features, compare them with the normal paper texture benchmark, confirm the real defect area, and output the appearance defect detection information.
[0205] S6.1: Based on the structural region label of the abnormal residual region, determine the region location corresponding to the abnormal residual region, and obtain the abnormal local image in the corresponding image block to be detected.
[0206] Based on the abnormal residual regions with structural region labels, the structural region name, horizontal division number, vertical division number, and normalized position range in the structural region label are read, and the structural region name, horizontal division number, vertical division number, and normalized position range are determined as the region location corresponding to the abnormal residual region.
[0207] Based on the location of the abnormal residual region, search for the image block with the same location in the set of image blocks to be detected with structured region labels, and obtain the image block to be detected corresponding to the abnormal residual region.
[0208] Based on the pixel coordinates of the abnormal residual region in the image block to be detected, determine the minimum bounding rectangle that surrounds the constant residual region.
[0209] The texture spacing in the normal paper texture reference corresponding to the region location is read as the boundary expansion distance. The minimum bounding rectangle is expanded outward within the image block to obtain the cropping range of the abnormal local image.
[0210] Based on the cropping range of the abnormal local image, the image is cropped from the image block to be detected corresponding to the abnormal residual region to obtain the abnormal local image.
[0211] S6.2: Perform image component separation and orientation field recognition on abnormal local images to obtain a mixed orientation field containing paper texture orientation components and non-paper texture orientation components.
[0212] The abnormal local image is converted to grayscale to obtain an abnormal local grayscale image. The normal paper texture reference at the corresponding location of the abnormal residual region is read, the texture spacing in the normal paper texture reference is obtained, and the window range of the guided filter is determined based on the texture spacing.
[0213] Within the window range, the gray values of each pixel in the abnormal local grayscale image are read, the average value of the gray values is calculated, and the gray variance within the window range is determined based on the deviation between the gray values of each pixel and the average value, which is then used as the smoothing control parameter for the guided filter.
[0214] Guided filtering is applied to the abnormal local grayscale image according to the window range and smoothing control parameters to obtain the low-frequency appearance components of the abnormal local image; then, the abnormal local grayscale image and the low-frequency appearance components are differentially processed to obtain the high-frequency texture components of the abnormal local image.
[0215] The Sobel operator is used to obtain the horizontal and vertical gradient values of the high-frequency texture components, and the structure tensor method is used to statistically analyze the gray-level variation relationship in the local neighborhood based on the horizontal and vertical gradient values.
[0216] Based on the gray-level variation relationship within the local neighborhood, the local orientation of each pixel position in the abnormal local image is determined, and the mixed orientation field corresponding to the abnormal local image is obtained.
[0217] The mixed orientation field includes the paper grain orientation component formed by the corrugated paper grain, and the non-paper grain orientation component formed by the damaged edge, indentation edge, stain edge, or printing abnormality edge.
[0218] S6.3: Based on the normal paper texture reference corresponding to the region location, decouple the mixed direction field, remove the non-paper texture direction components, obtain the paper texture direction field, and determine the current paper texture features based on the direction continuity, texture clarity and texture arrangement of the paper texture direction field in the abnormal residual region.
[0219] Based on the normal paper texture reference corresponding to the region location, the consistency of each directional component in the mixed direction field is judged. The directional components that are consistent with the normal paper texture reference are retained as paper texture directional components, and the directional components that are inconsistent with the normal paper texture reference are stripped as non-paper texture directional components.
[0220] Read the normal unidirectional deviation range, texture spacing, directional continuity judgment threshold and texture continuity in the normal paper texture reference, and judge each directional component in the mixed directional field one by one;
[0221] When the unidirectional difference corresponding to a certain directional component is within the normal unidirectional deviation range, the local texture spacing matches the texture spacing in the normal paper texture reference, and the local extension continuity state meets the directional continuity determination threshold and texture continuity requirements, the directional component is determined as the paper texture directional component; the remaining directional components are determined as non-paper texture directional components and are stripped to obtain the paper texture direction field.
[0222] The current paper texture features are determined based on the directional continuity, texture clarity, and texture arrangement of the paper texture direction field within the abnormal residual region.
[0223] S6.4: Determine the corresponding region location based on the structural region label of the abnormal residual region, compare the current paper texture feature with the normal paper texture benchmark corresponding to the region location to obtain paper texture deviation information.
[0224] The region location is determined based on the structural region label of the abnormal residual region, and the corresponding normal paper texture reference is called; the directional continuity in the current paper texture feature is compared with the texture continuity in the normal paper texture reference, and when the directional continuity is lower than the texture continuity, a directional continuity deviation result is generated.
[0225] The texture clarity in the current paper texture feature is compared with the grayscale change state of the normal paper texture in the normal paper texture benchmark. When the texture clarity exceeds the grayscale change range corresponding to the grayscale change state of the normal paper texture, a texture clarity deviation result is generated.
[0226] The texture arrangement state in the current paper texture feature is compared with the texture spacing and regional paper texture direction distribution in the normal paper texture reference. When the spacing of the paper texture peak lines in the texture arrangement state deviates from the texture spacing, or the extension direction of the paper texture peak lines deviates from the regional paper texture direction distribution, a texture arrangement state deviation result is generated.
[0227] The paper texture deviation information is obtained by summarizing the deviation results of directional continuity, texture clarity, and texture arrangement.
[0228] S6.5: Cross-confirm the paper texture deviation information with the image difference information of the abnormal residual area to confirm the real defect area. Based on the position of the real defect area in the current appearance image, the structural area label and the defect type, generate appearance defect detection information.
[0229] Read the image difference information of the abnormal residual region. The image difference information includes the boundary changes, color deviations and texture continuity changes of the abnormal residual region.
[0230] Cross-validation is performed between paper texture deviation information and image difference information. When the paper texture deviation information shows that the current paper texture feature deviates from the normal paper texture reference, and the image difference information shows that the abnormal residual area has at least one of the following: boundary change, color deviation, or texture continuity change, the abnormal residual area is confirmed as a real defect area.
[0231] When the paper texture deviation information does not include the results of directional continuity deviation, texture clarity deviation, and texture arrangement deviation, and the image difference information only shows the paper texture residual that is consistent with the normal paper texture direction, the corresponding area will be identified as a normal paper texture difference area and will not be output as a real defect area.
[0232] The defect type is determined based on the paper texture deviation information and image difference information of the actual defect area;
[0233] When color deviation, directional continuity deviation, and texture arrangement deviation coexist, the defect type of the real defect area is determined to be a broken defect; when texture arrangement deviation and boundary changes exist, the defect type of the real defect area is determined to be an indentation deformation defect; when directional continuity deviation and texture clarity deviation coexist, the defect type of the real defect area is determined to be a paper texture damage defect; when color deviation exists but directional continuity does not deviate, the defect type of the real defect area is determined to be a surface color defect; when the same real defect area simultaneously meets two or more defect type determination conditions, the final defect type is determined in the order of broken defect, indentation deformation defect, paper texture damage defect, and surface color defect.
[0234] The location of the real defect region in the current appearance image is determined based on the pixel position of the real defect region in the image block to be detected, the pixel boundary of the image block to be detected in the current registered image, and the inverse registration transformation relationship from the current registered image to the current appearance image.
[0235] The location of the actual defect area in the current appearance image, the structural area label, the defect type, the paper texture deviation information, and the image difference information are summarized to generate appearance defect detection information.
[0236] In summary, this invention achieves the following by: decoupling and identifying the corrugated paper texture direction field in abnormal residual regions, which separates paper texture direction changes, texture continuity fluctuations, and local imaging disturbances in the image recognition results, reducing the impact of non-defect texture factors on abnormal region determination; and by matching and confirming the current paper texture features with normal paper texture benchmarks, providing a clear basis for judging the texture consistency of real defect regions, improving the precision of abnormal region boundary extraction and the stability of local appearance anomaly identification, thereby improving the overall accuracy and reliability of corrugated cardboard box appearance defect detection results.
[0237] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for detecting appearance defects in corrugated cardboard boxes based on image recognition, characterized in that, include: Obtain the model information of the corrugated cardboard box to be tested, parse the model information of the corrugated cardboard box to be tested, and obtain the model identifier of the corrugated cardboard box to be tested; Based on the model identifier of the corrugated cardboard box to be tested, the corresponding cardboard box structure unfolding relationship is retrieved, and the structural area distribution corresponding to the model information of the corrugated cardboard box to be tested is obtained. Based on the structural area distribution corresponding to the model information of the corrugated cardboard box to be tested, the position of the appearance area of the corrugated cardboard box to be tested is marked, and the corresponding structural reference template is generated. Based on the model information, retrieve the standard appearance image set corresponding to the corrugated cardboard box to be tested, and register the standard appearance images in the standard appearance image set with the structural reference template to obtain the standard registration image. Based on the structural region distribution information, the standard registration image is divided into image blocks to obtain each standard image block carrying the region location; Image normalization is performed on each standard image block, and the corresponding normal appearance feature vector is extracted. The normal appearance feature vector is then associated with the region location corresponding to the standard image block to obtain the image recognition information of each standard image block. The image recognition information of each standard image block is associated with the region position in the structural reference template to form a region feature record, which is then classified and stored according to the region position to obtain the structural constraint memory library. Image recognition information corresponding to standard image blocks at the same location is read from the structural constraint memory and merged to obtain the normal appearance reference features corresponding to the location. Using the region location as a constraint, a correspondence is established between the image recognition information of the image block to be detected and the normal appearance reference features, so as to obtain the normal appearance reconstruction template corresponding to the region location and determine the normal paper texture reference corresponding to the region location. Acquire the current appearance image of the corrugated cardboard box to be inspected, perform image correction on the current appearance image to obtain the current corrected image, and perform registration with the structural reference template to obtain the current registered image; Based on the structural reference template, the current registered image is divided into image blocks and assigned structural region labels to form a set of image blocks to be detected with structural region labels; based on the structural region labels of the image blocks to be detected, the regional position of the image blocks to be detected in the structural reference template is determined, and the corresponding normal appearance reconstruction template is called from the structural constraint memory. Based on the normal appearance reconstruction template, the image block to be detected is matched with the normal appearance reference features corresponding to the region location to determine the normal appearance reconstruction parameters at the corresponding location. The normal appearance content of the corresponding region of the image block to be detected is reconstructed according to the normal appearance reconstruction parameters to obtain a normal appearance reconstructed image block that is in the same region as the image block to be detected. Image difference recognition is performed between the image block to be detected and the image block to be detected to determine the abnormal residual region. The corrugated paper texture direction field is decoupled and identified in the abnormal residual area to obtain the current paper texture features. These features are then compared with the normal paper texture reference to confirm the real defect area and output the appearance defect detection information.
2. The method for detecting appearance defects of corrugated cardboard boxes based on image recognition as described in claim 1, characterized in that, The determination of the normal paper texture reference corresponding to the region location refers to performing paper texture direction field recognition on the standard image block corresponding to the same region location to obtain the regional paper texture direction distribution, and determining the normal paper texture reference corresponding to the region location based on the directional stability, texture spacing and texture continuity in the regional paper texture direction distribution.
3. The method for detecting appearance defects of corrugated cardboard boxes based on image recognition as described in claim 1, characterized in that, The specific steps for determining the abnormal residual region are as follows: The image block to be detected is compared with the image block reconstructed from the normal appearance at the corresponding position to obtain the initial difference image; Based on the structural region labels and structural reference templates of the image blocks to be detected, the structural difference responses related to the regions corresponding to the structural region labels in the initial difference image are suppressed to obtain a structural constraint difference image. Based on the normal paper texture reference corresponding to the region location, the paper texture residuals in the structural constraint difference image that are consistent with the normal paper texture direction are weakened to obtain candidate abnormal residual images. Connectivity processing is performed on coherent regions in candidate anomalous residual images. Based on boundary changes, color deviations, and texture continuity changes of coherent regions, anomalous residual regions are identified and associated with the structural region labels of the corresponding image blocks to be detected, thus obtaining anomalous residual regions with structural region labels.
4. The method for detecting appearance defects of corrugated cardboard boxes based on image recognition as described in claim 1, characterized in that, The specific steps for obtaining the current paper texture feature are as follows: Based on the structural region label of the abnormal residual region, determine the region location corresponding to the abnormal residual region, and obtain the abnormal local image in the corresponding image block to be detected. Image component separation and orientation field recognition are performed on abnormal local images to obtain a mixed orientation field containing paper texture orientation components and non-paper texture orientation components; Based on the normal paper texture reference corresponding to the region location, the mixed direction field is decoupled, and the non-paper texture direction components are stripped to obtain the paper texture direction field. Based on the direction continuity, texture clarity and texture arrangement of the paper texture direction field in the abnormal residual region, the current paper texture features are determined.
5. The method for detecting appearance defects of corrugated cardboard boxes based on image recognition as described in claim 1, characterized in that, The specific steps for outputting the appearance defect detection information are as follows: Based on the structural region label of the abnormal residual region, the corresponding region location is determined. The current paper texture feature is compared with the normal paper texture benchmark corresponding to the region location to obtain the paper texture deviation information. Cross-check the paper texture deviation information with the image difference information of the abnormal residual area to identify the real defect area. Based on the location of the real defect area in the current appearance image, the structural area label and the defect type, generate appearance defect detection information.
Citation Information
Patent Citations
Corrugated carton pressing line defect detection optimization method based on artificial intelligence system
CN114782475A
Packaging carton defect detection method based on machine vision
CN117474909A