A corrugated box color difference region detection method based on interconnection
By using an interconnected corrugated cardboard box detection marking board and a coding recognition matrix, sub-pixel-level precise positioning and regional detection of color difference areas in corrugated cardboard boxes are achieved, solving the problem of unstable color difference detection in traditional methods and improving the accuracy and adaptability of detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHAOQING ABRAM PACKAGING CO LTD
- Filing Date
- 2026-01-30
- Publication Date
- 2026-06-05
AI Technical Summary
Traditional methods for color difference detection in corrugated boxes lack a stable global coordinate system, resulting in inaccurate positioning of color difference areas, distorted area calculations, inability to adapt to uneven lighting and differences in printing batches, and inability to distinguish different color areas, which easily leads to false alarms or missed alarms.
An interconnected corrugated cardboard box inspection marking board is adopted. Through the array of interconnected coded patterns and positioning mark groups, combined with the coding recognition matrix to match world coordinates, pose calculation and color space conversion are performed, and color deviation threshold is dynamically calculated to achieve sub-pixel level accurate positioning and regional color difference detection.
It effectively eliminates perspective distortion and scale error, improves the stability and reliability of color difference detection, accurately locates continuous color difference areas, adapts to changes in lighting and printing batches, and reduces noise interference.
Smart Images

Figure CN122156066A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of color difference detection technology, specifically to a method for detecting color difference areas in corrugated cardboard boxes based on interconnection. Background Technology
[0002] Currently, traditional methods typically perform color difference analysis directly on captured images, lacking a stable and accurate global coordinate system as a reference. When camera angles or distances change, or when the cardboard surface has slight undulations or bends, perspective distortion and scale errors occur. This leads to inaccurate localization of color difference areas, distorted area calculations, and even misjudging normal geometric shadows as color differences. Furthermore, traditional methods often use fixed, global color thresholds or compare against a standard color chart. This approach cannot adapt to uneven lighting, changes in ambient light, and natural fluctuations in base color caused by different printing batches. This easily results in large-scale false alarms or missed alarms.
[0003] Furthermore, traditional methods typically process the entire image or large area globally, failing to distinguish the expected color differences between different patterns and color areas on a cardboard box. For example, they may misjudge deviations between inherent red areas in the design and standard yellow areas as defects. At the same time, they are highly sensitive to image noise and minor blemishes, easily generating a large number of meaningless alerts. Summary of the Invention
[0004] To achieve the above objectives, the present invention provides the following technical solution: a method for detecting color difference areas in corrugated cardboard boxes based on interconnection, comprising: Acquire images of the interconnected corrugated box inspection marking board; the surface array of the interconnected corrugated box inspection marking board is distributed with interconnected coding patterns and corresponding areas are distributed with standard color difference reference patterns, and positioning mark groups are equidistantly placed between adjacent interconnected coding patterns; The images captured by the marker board are preprocessed and the smallest detection unit of the target is extracted. The world coordinates of the positioning marker are matched according to the encoding recognition matrix of the smallest detection unit of the target to determine the center pixel coordinates of the target positioning marker, the pixel coordinates of the target reference center point, and the pixel coordinates of the target encoding center point. Based on the target localization marker center pixel coordinates, the target reference center point pixel coordinates, the target encoding center point pixel coordinates, and the camera intrinsic parameter matrix, the pose calculation is performed on the image captured by the marker board to obtain the initial detection pose. Based on the color parameter distribution of the standard color difference reference pattern to which the target minimum detection unit belongs, the pixel coordinates of the target reference center point and the pixel coordinates of the target encoding center point, determine the color deviation threshold between the co-line points of the reference center point and the encoding center point; The original two-dimensional image set of the corrugated cardboard box is mapped to the coordinate system of the marker board using the initial detection pose. The original two-dimensional image set is then subjected to color space conversion and brightness correction to obtain the corresponding image set to be detected. Based on the initial detection pose and color deviation threshold, color difference pixels are extracted from the image set to be detected to determine the color difference pixel set corresponding to each corrugated cardboard box region. Based on the color difference pixel set corresponding to each corrugated cardboard box region and the initial detection pose, an initial color difference distribution map corresponding to the image set to be detected is constructed.
[0005] Preferably, after constructing an initial color difference distribution map corresponding to the image set to be detected based on the color difference pixel set corresponding to each corrugated cardboard box region and the initial detection pose, the method further includes: Based on the category of each corrugated cardboard box area and its corresponding distribution range in the initial color difference distribution map, the coordinates of each pixel in the initial color difference distribution map are corrected to obtain the target color difference distribution map. The target color difference distribution map is processed by merging regions, and the regions that exceed the deviation range are located by combining the color deviation threshold, thus obtaining the corresponding color difference region detection results.
[0006] Preferably, the image captured by the marker board is preprocessed and the smallest target detection unit is extracted. The world coordinates of the positioning marker are matched with the encoding recognition matrix of the smallest target detection unit to determine the center pixel coordinates of the target positioning marker, the pixel coordinates of the target reference center point, and the pixel coordinates of the target encoding center point. This includes: After extracting the smallest target detection unit from the image captured by the marker board, corner point recognition is performed to determine the corner point coordinates of the actual coded pattern. Based on the actual coded pattern corner coordinates, the smallest positioning and recognition area containing the positioning mark group is delineated in the smallest target detection unit; The corner coordinates of the designed coding pattern are determined by searching the preset detection board coding table based on the coding recognition matrix of the target's smallest detection unit. Based on the transformation relationship between the corner coordinates of the actual coded pattern and the corner coordinates of the associated designed coded pattern, perspective transformation is performed on the image captured by the marking board to determine the transformed image; Extract the initial center pixel coordinates of the positioning markers and the initial reference center pixel coordinates of the positioning marker groups in each minimum positioning recognition region from the transformed image; Geometric center fitting is performed using the center pixel coordinates of each initial positioning marker to determine the initial encoding center pixel coordinates of the encoding center point of the smallest detection unit of the target; The initial positioning marker center pixel coordinates, initial reference center point pixel coordinates, and initial encoding center point pixel coordinates are inversely transformed to the image captured by the marker board to determine the target positioning marker center pixel coordinates, target reference center point pixel coordinates, and target encoding center point pixel coordinates.
[0007] Preferably, the initial detection pose is obtained by calculating the pose of the image captured by the marker based on the pixel coordinates of the target positioning marker center point, the pixel coordinates of the target reference center point, the pixel coordinates of the target encoding center point, and the camera intrinsic parameter matrix, including: The encoding and recognition matrix based on the smallest detection unit of the target is searched in the preset detection board encoding table to match the world coordinates of the positioning mark; Using the world coordinates of the positioning marker, the center pixel coordinates of the target positioning marker, and the camera intrinsic parameter matrix, a linear transformation is performed based on the imaging model to determine the homography matrix; The initial rotation matrix and initial translation matrix are decomposed from the homography matrix to serve as the initial detection pose.
[0008] Preferably, based on the color parameter distribution of the standard color difference reference pattern to which the target minimum detection unit belongs, the pixel coordinates of the target reference center point, and the pixel coordinates of the target encoding center point, the color deviation threshold between the reference center point and the encoding center point is determined, including: A reference image is cropped from the image captured by the marker plate to extract the area containing the standard color difference reference pattern of the smallest detection unit of the target; The color space conversion, noise suppression, and color parameter extraction are performed sequentially on the reference image to determine the color parameter distribution. Based on the pixel coordinates of the target encoding center point, determine the first color parameter of the corresponding encoding center point associated with the same line of sight from the color parameter distribution; The second color parameter of the corresponding reference center point is determined from the color parameter distribution based on the pixel coordinates of the target reference center point; The degree of color deviation is determined by using the difference between the first color parameter and the second color parameter; Based on the degree of color deviation and the preset acceptable deviation range, determine the color deviation threshold between the line of sight and the reference center point.
[0009] Preferably, the original two-dimensional image set of the corrugated cardboard box is mapped to the coordinate system of the marker board using the initial detection pose. Color space conversion and brightness correction are then performed on the original two-dimensional image set to obtain the corresponding image set to be detected, including: Based on the initial detection pose and camera intrinsic parameters, calculate the mapping transformation matrix between the original 2D image set and the marker coordinate system; The pixel coordinates of each frame in the original two-dimensional image set are converted into actual physical coordinates in the marker coordinate system using a mapping transformation matrix; The converted images are then subjected to Lab color space conversion and brightness correction to eliminate the effects of lighting and shooting angle, resulting in the corresponding set of images to be detected.
[0010] Preferably, based on the initial detection pose and color deviation threshold, color difference pixels are extracted from the image set to be detected to determine the color difference pixel set corresponding to each corrugated cardboard box region, including: The region of interest (ROI) in the corrugated cardboard box area of the image to be detected is determined based on the initial detection pose. Within the region of interest, perform color difference pixel detection in Lab color space frame by frame to obtain the preliminary color difference pixel set corresponding to each frame image; The positions of each preliminary color difference pixel in each frame of the image are matched with the positions of each preliminary color difference pixel in the next frame of the image, and the pixel displacement vector corresponding to each frame of the image is calculated based on the matching results. Based on the pixel displacement vector and the initial detection pose, the actual color difference coordinate point set corresponding to the preliminary color difference pixel set of each frame image is calculated respectively; The actual color difference coordinate point set is filtered based on the color deviation threshold, and points within the deviation range are removed to determine the color difference pixel set corresponding to each corrugated cardboard box area.
[0011] Preferably, based on the color difference pixel set corresponding to each corrugated cardboard box region and the initial detection pose, an initial color difference distribution map corresponding to the image set to be detected is constructed, including: Based on the set of color difference pixels corresponding to each corrugated cardboard box area, calculate the chromaticity coordinates of each color difference pixel after mapping, and then construct the initial color difference mapping point set corresponding to each corrugated cardboard box area. According to the preset color difference threshold rule, the initial color difference mapping point set corresponding to each corrugated cardboard box area is filtered by coordinates to obtain the color difference mapping point set corresponding to each corrugated cardboard box area. Based on each color difference mapping point set and the initial detection pose, the initial color difference distribution map corresponding to the image set to be detected is determined.
[0012] Preferably, based on the category of each corrugated cardboard box area and its corresponding distribution range in the initial color difference distribution map, the pixel coordinates in the initial color difference distribution map are corrected to obtain the target color difference distribution map, including: Based on the category of each corrugated cardboard box area, the corresponding standard color card model is extracted from several preset standard color card models. For any first target area in each corrugated cardboard box area, based on the position and color value range of each standard color block in the first standard color card model corresponding to the first target area, the coordinates of each pixel in the first distribution range in the initial color difference distribution map are corrected, so that the coordinates of each pixel in the first distribution range are more in line with the first standard color card model. After coordinate correction, the target color difference distribution map is obtained.
[0013] Preferably, the target color difference distribution map is processed by region merging, and regions exceeding the deviation range are located by combining the color deviation threshold to obtain the corresponding color difference region detection results, including: The target color difference distribution map is segmented into superpixels and transformed into a set consisting of several pixel nodes, adjacency relationships and weights. The similarity weight of each pixel node is calculated according to preset rules; Based on the similarity weights and the spatial location of each pixel node, the graph cut algorithm is used to segment the set and generate preliminary color difference regions. The initial color difference area is compared with the color deviation threshold, and the area that exceeds the deviation threshold is taken as the final color difference area detection result.
[0014] Compared with the prior art, the beneficial effects of the present invention are: This invention achieves sub-pixel-level precise positioning of each detection unit by arraying interconnected coded patterns and positioning marker groups, and matching world coordinates with the coded recognition matrix. By mapping the camera image to the marker plate coordinate system through pose calculation, it effectively eliminates perspective distortion and scale error caused by inconsistent shooting angles and distances, and provides a stable spatial reference for color difference detection.
[0015] This invention provides localized color references for different regions through a standard color difference reference pattern, and dynamically calculates the color deviation threshold by combining the encoding information, overcoming environmental interference such as uneven lighting and differences in printing batches. Moreover, in color space conversion and brightness correction, it makes adaptive adjustments based on the reference information of the marking plate, improving the reliability and consistency of color judgment.
[0016] This invention achieves regional color difference detection by establishing a correspondence between the encoding center point and the reference center point, avoiding misjudgment of overall color deviation. It is especially suitable for corrugated cardboard boxes with multiple colors and patterns. Furthermore, by mapping the color difference pixels to a color difference distribution map through the initial detection pose, it intuitively presents the spatial distribution and severity of the color difference. Through pixel coordinate correction and region merging, it integrates the cardboard box structure and color difference distribution characteristics, reduces the interference of sporadic noise points, and accurately locates continuous color difference areas. Attached Figure Description
[0017] Figure 1 This is a schematic flowchart of the overall method in one embodiment of the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] Example 1, please refer to Figure 1 This invention provides a technical solution: a method for detecting color difference areas in corrugated cardboard boxes based on interconnection, comprising: S1. Acquire the image of the interconnected corrugated carton inspection marking board; the surface array of the interconnected corrugated carton inspection marking board is distributed with interconnected coding patterns and corresponding areas are distributed with standard color difference reference patterns, and positioning mark groups are set at equal intervals between adjacent interconnected coding patterns; S2. Preprocess the image captured by the marker board and extract the smallest detection unit of the target. Match the world coordinates of the positioning marker according to the encoding recognition matrix of the smallest detection unit of the target, and determine the center pixel coordinates of the target positioning marker, the pixel coordinates of the target reference center point, and the pixel coordinates of the target encoding center point. S3. Based on the target positioning marker center pixel coordinates, the target reference center point pixel coordinates, the target encoding center point pixel coordinates, and the camera intrinsic parameter matrix, perform pose calculation on the image captured by the marker board to obtain the initial detection pose. S4. Determine the color deviation threshold between the reference center point and the coding center point based on the color parameter distribution of the standard color difference reference pattern to which the smallest detection unit of the target belongs, the pixel coordinates of the reference center point and the pixel coordinates of the coding center point. S5. Using the initial detection pose, the original two-dimensional image set of the corrugated cardboard box is mapped to the coordinate system of the marker board. The original two-dimensional image set is subjected to color space conversion and brightness correction to obtain the corresponding image set to be detected. Based on the initial detection pose and color deviation threshold, the color difference pixels of the image set to be detected are extracted to determine the color difference pixel set corresponding to each corrugated cardboard box area. S6. Based on the color difference pixel set and initial detection pose corresponding to each corrugated cardboard box area, construct an initial color difference distribution map corresponding to the image set to be detected.
[0020] It should be noted that an image of an interconnected corrugated box inspection marking board is acquired; this marking board has specific coded patterns, which are distributed in an array and correspond to a standard color difference reference pattern; positioning mark groups are also set between adjacent coded patterns on the marking board to help with subsequent positioning and identification.
[0021] By preprocessing the captured marker images, the system extracts the smallest detection units of the target, which contain important encoded information. Using this encoding, the system can identify the positioning markers and match their matrices with real-world coordinates, thereby determining the center pixel coordinates of the target positioning marker, the pixel coordinates of the reference center point, and the pixel coordinates of the encoded center point.
[0022] Using these coordinates and the camera's intrinsic parameter matrix, pose calculation is performed to obtain the initial detection pose; this step ensures that subsequent image processing is accurate and can reflect the position of objects in the real scene.
[0023] Based on the color parameter distribution of the standard color difference reference pattern to which the target minimum detection unit belongs, and the coordinates mentioned above, the system determines the color deviation threshold between the reference center point and the encoding center point; this threshold is used to determine whether there is a color difference problem.
[0024] Using the initial detection pose, the original two-dimensional image of the corrugated cardboard box is mapped onto the coordinate system of the marking board; at this time, the system performs color space conversion and brightness correction on these images in order to obtain the image set to be detected.
[0025] Based on the initial detection pose and color deviation threshold, the system extracts color difference pixels from the set of images to be detected and determines the set of color difference pixels corresponding to each corrugated cardboard box area. Finally, these sets of color difference pixels will be used to construct an initial color difference distribution map, thereby realizing the color difference detection of the corrugated cardboard box.
[0026] In an optional embodiment, after constructing an initial color difference distribution map corresponding to the image set to be detected based on the color difference pixel set corresponding to each corrugated cardboard box region and the initial detection pose, the method further includes: Based on the category of each corrugated cardboard box area and its corresponding distribution range in the initial color difference distribution map, the coordinates of each pixel in the initial color difference distribution map are corrected to obtain the target color difference distribution map. The target color difference distribution map is processed by merging regions, and the regions that exceed the deviation range are located by combining the color deviation threshold, thus obtaining the corresponding color difference region detection results.
[0027] It should be noted that by analyzing the color difference pixel set of each corrugated cardboard box, an initial color difference distribution map was generated; this map reflects the color deviation of each cardboard box and shows the distribution of color difference values in different areas.
[0028] Based on the category of each corrugated cardboard box area (e.g., some areas may be printed patterns, some areas may be background colors, etc.) and their corresponding distribution range in the initial color difference distribution map, the system will correct the coordinates of each pixel in the initial map; the purpose of this step is to make the color difference value of each area more accurately reflect its actual color state.
[0029] Identify different types of regions and their respective standard color ranges.
[0030] If the pixel positions in certain areas deviate due to the shooting angle or other factors, the system will adjust the positions of these pixels according to known standards to ensure that they are correctly reflected in the spectrum. Such correction can help improve detection accuracy and make the final target color difference distribution spectrum more accurate.
[0031] After obtaining the target color difference distribution map, the next step is to perform region merging. The purpose of this step is to merge some small, adjacent, and related color difference regions into a larger region, thereby simplifying the detection results and improving readability.
[0032] During the merging process, the system will combine the previously set color deviation threshold, which is used to determine which areas have color differences that exceed the acceptable range; for example, if the color deviation value of a certain area exceeds the set threshold, then that area is considered to have a color difference problem.
[0033] Through these steps, the final result will show which areas of the corrugated cardboard box have color difference problems, and the extent of these areas will be marked.
[0034] In an optional embodiment, the image captured by the marker board is preprocessed and the target minimum detection unit is extracted. The world coordinates of the positioning marker are matched according to the encoding recognition matrix of the target minimum detection unit to determine the center pixel coordinates of the target positioning marker, the pixel coordinates of the target reference center point, and the pixel coordinates of the target encoding center point. This includes: After extracting the smallest target detection unit from the image captured by the marker board, corner point recognition is performed to determine the corner point coordinates of the actual coded pattern. Based on the actual coded pattern corner coordinates, the smallest positioning and recognition area containing the positioning mark group is delineated in the smallest target detection unit; The corner coordinates of the designed coding pattern are determined by searching the preset detection board coding table based on the coding recognition matrix of the target's smallest detection unit. Based on the transformation relationship between the corner coordinates of the actual coded pattern and the corner coordinates of the associated designed coded pattern, perspective transformation is performed on the image captured by the marking board to determine the transformed image; Extract the initial center pixel coordinates of the positioning markers and the initial reference center pixel coordinates of the positioning marker groups in each minimum positioning recognition region from the transformed image; Geometric center fitting is performed using the center pixel coordinates of each initial positioning marker to determine the initial encoding center pixel coordinates of the encoding center point of the smallest detection unit of the target; The initial positioning marker center pixel coordinates, initial reference center point pixel coordinates, and initial encoding center point pixel coordinates are inversely transformed to the image captured by the marker board to determine the target positioning marker center pixel coordinates, target reference center point pixel coordinates, and target encoding center point pixel coordinates.
[0035] It should be noted that the smallest target detection unit is extracted from the captured image of the marker board; this unit usually refers to the part in the image with a specific coded pattern; next, corner point recognition is performed to determine the corner coordinates of the actual coded pattern in the unit; these corner points are key feature points used for subsequent processing.
[0036] After identifying the corner points of the actual coded pattern, the system will delineate a minimum positioning recognition area containing a group of positioning markers within the minimum detection unit of the target; this is to focus attention on the area containing important information, thereby improving the efficiency and accuracy of subsequent processing.
[0037] Based on the extracted coding recognition matrix, a search is performed in the preset detection board coding table to determine the corner coordinates of the designed coding pattern. The purpose of this step is to match the actually recognized pattern with the predefined design pattern to ensure accurate positioning and recognition of the pattern.
[0038] By comparing the corner coordinates of the actual coded pattern with the corner coordinates of the designed coded pattern, the system can determine the transformation relationship between them. This transformation relationship is used to perform perspective transformation on the original marked board image to obtain the transformed image. Perspective transformation is a technique in image processing used to correct distortion caused by the shooting angle, making the image visually flatter and more standardized.
[0039] In the transformed image, the system will extract the initial positioning mark center pixel coordinates and the initial reference center point pixel coordinates of the positioning mark group in each minimum positioning recognition region; these coordinates provide the basic data for subsequent geometric operations.
[0040] Using the center pixel coordinates of each initial positioning marker, the system performs geometric center fitting to determine the initial encoding center pixel coordinates of the encoding center point of the smallest detection unit of the target. Geometric center fitting refers to calculating the position center of multiple points through mathematical methods to ensure that the obtained results are more accurate.
[0041] The initial positioning marker center pixel coordinates, initial reference center point pixel coordinates, and initial encoding center point pixel coordinates are inversely transformed back to the original marker board image. The purpose of this step is to determine the target positioning marker center pixel coordinates, target reference center point pixel coordinates, and target encoding center point pixel coordinates in the coordinate system of the original image.
[0042] In an optional embodiment, the initial detection pose is obtained by calculating the pose of the image captured by the marker based on the target positioning marker center pixel coordinates, the target reference center point pixel coordinates, the target encoding center point pixel coordinates, and the camera intrinsic parameter matrix, including: The encoding and recognition matrix based on the smallest detection unit of the target searches in the preset detection board encoding table to match the world coordinates of the positioning mark.
[0043] The homography matrix is determined by using the world coordinates of the positioning marker, the center pixel coordinates of the target positioning marker, and the camera intrinsic parameter matrix, and performing a linear transformation based on the imaging model.
[0044] The initial rotation matrix and initial translation matrix are decomposed from the homography matrix to serve as the initial detection pose.
[0045] It should be noted that the search is performed in the preset detection board encoding table starting from the encoding recognition matrix of the smallest detection unit of the target; the purpose of this step is to match the coordinate position of the corresponding positioning mark in the world coordinate system; by comparing the encoding recognized in the actual image with the predefined encoding, the specific position of each target mark in three-dimensional space can be determined.
[0046] The world coordinates of the positioning marker, the center pixel coordinates of the target positioning marker, and the camera's intrinsic parameter matrix will be linearly transformed to determine the enantiomerism matrix; here, "linear transformation" usually refers to mapping three-dimensional world coordinates to two-dimensional image coordinates, and the imaging model usually involves related calculations of perspective projection.
[0047] The camera intrinsic parameter matrix contains information such as the camera's focal length and principal point position, and is necessary for projecting three-dimensional points onto a two-dimensional plane; the monomorphism matrix is a matrix used to describe the mapping relationship from one plane to another, and it can be used to solve perspective transformations in images.
[0048] The initial rotation matrix and initial translation matrix are decomposed from the obtained homography matrix. The rotation matrix describes the rotation state of the object relative to the camera, while the translation matrix represents the position of the object in space. These two matrices together constitute the initial detection pose of the object, that is, the orientation and position of the object in the world coordinate system.
[0049] In an optional embodiment, the color deviation threshold between co-linear points of the reference center point and the encoding center point is determined based on the color parameter distribution of the standard color difference reference pattern to which the target minimum detection unit belongs, the pixel coordinates of the target reference center point, and the pixel coordinates of the target encoding center point, including: A reference image is cropped from the image captured by the marker plate to extract the area containing the standard color difference reference pattern of the smallest detection unit of the target; The color space conversion, noise suppression, and color parameter extraction are performed sequentially on the reference image to determine the color parameter distribution. Based on the pixel coordinates of the target encoding center point, determine the first color parameter of the corresponding encoding center point associated with the same line of sight from the color parameter distribution; The second color parameter of the corresponding reference center point is determined from the color parameter distribution based on the pixel coordinates of the target reference center point; The degree of color deviation is determined by using the difference between the first color parameter and the second color parameter; Based on the degree of color deviation and the preset acceptable deviation range, determine the color deviation threshold between the line of sight and the reference center point.
[0050] It should be noted that a reference image is obtained by cropping the area containing the standard color difference reference pattern of the smallest detection unit of the target from the image captured by the marker board; this image will be used for subsequent color analysis to ensure that only the parts related to the target mark are considered.
[0051] Converting an image from one color space (such as RGB) to another (such as HSV or CIELab) allows for better analysis of color characteristics; different color spaces can provide different color information, which helps to improve sensitivity to color differences.
[0052] In image processing, noise can affect the extraction of color parameters; therefore, noise suppression can be performed by using filtering techniques (such as Gaussian filtering) to smooth the image, thereby reducing the interference of noise on subsequent analysis.
[0053] Color parameters, including hue, saturation, and brightness, are extracted from the processed reference image to form a color parameter distribution; these parameters will be used for subsequent comparison and analysis.
[0054] Based on the pixel coordinates of the target encoding center point, the first color parameter of the corresponding encoding center point is extracted from the color parameter distribution; at the same time, based on the pixel coordinates of the target reference center point, the second color parameter of the corresponding reference center point is extracted from the same color parameter distribution; these two steps respectively obtain the color features related to the encoding center point and the reference center point.
[0055] The degree of color deviation is determined by comparing the first color parameter (the color parameter of the encoding center point) and the second color parameter (the color parameter of the reference center point) and calculating the difference between them; this difference reflects the color difference between the encoding center point and the reference center point.
[0056] By combining the calculated degree of color deviation with the preset acceptable deviation range, the color deviation threshold between the line of sight and the reference center point is determined. If the degree of color deviation is within the preset acceptable range, the image processing result is considered acceptable. If it exceeds the range, further adjustment or correction may be required.
[0057] In an optional embodiment, the original two-dimensional image set of the corrugated cardboard box is mapped to the coordinate system of the marker board using the initial detection pose. Color space conversion and brightness correction are then performed on the original two-dimensional image set to obtain the corresponding image set to be detected, including: Based on the initial detection pose and camera intrinsic parameters, calculate the mapping transformation matrix between the original 2D image set and the marker coordinate system; The pixel coordinates of each frame in the original two-dimensional image set are converted into actual physical coordinates in the marker coordinate system using a mapping transformation matrix; The converted images are then subjected to Lab color space conversion and brightness correction to eliminate the effects of lighting and shooting angle, resulting in the corresponding set of images to be detected.
[0058] It should be noted that, based on the initial detection pose and camera intrinsic parameters, the first step is to calculate the mapping transformation matrix between the original 2D image set and the marker coordinate system; the main goal of this step is to establish a mathematical model that can accurately convert the pixel coordinates in the image into the physical coordinates of the marker.
[0059] The initial detection pose contains the rotation and translation information of the object relative to the camera, providing the necessary spatial positional relationship.
[0060] Camera intrinsic parameters include information such as focal length and principal point position, which help describe how the camera projects the three-dimensional world onto a two-dimensional plane. With this information, geometric transformations (such as perspective transformation) can be used to construct a mapping transformation matrix, which can convert image coordinates to and from actual coordinates in subsequent processing.
[0061] Once the mapping transformation matrix is obtained, it can be used to convert the pixel coordinates of each frame in the original two-dimensional image set into actual physical coordinates in the marker coordinate system; this means that the coordinates of each pixel in the image are mapped to the coordinate system of the marker through the transformation matrix, so that these pixel coordinates have actual spatial meaning.
[0062] After coordinate transformation, the transformed images are processed as follows: the images are converted from the RGB color space to the Lab color space; the Lab color space is a color model based on human visual perception and can better handle color differences, especially under changes in lighting; after conversion to the Lab color space, color comparison will be more accurate and stable.
[0063] Brightness correction is applied to images to eliminate the effects of lighting and shooting angle. Since changes in shooting conditions (such as light intensity and direction) may cause differences in image brightness, brightness correction can adjust the image brightness to keep it consistent under different conditions.
[0064] After completing the above steps, the final result is the corresponding set of images to be detected. These images, after mapping, color space conversion and brightness correction, can more accurately reflect the true color characteristics and shape features of corrugated cardboard boxes, providing a reliable basis for subsequent detection, recognition or analysis.
[0065] In an optional embodiment, based on the initial detection pose and color deviation threshold, color difference pixels are extracted from the image set to be detected to determine the color difference pixel set corresponding to each corrugated cardboard box region, including: The region of interest (ROI) in the corrugated cardboard box area of the image to be detected is determined based on the initial detection pose. Within the region of interest, perform color difference pixel detection in Lab color space frame by frame to obtain the preliminary color difference pixel set corresponding to each frame image; The positions of each preliminary color difference pixel in each frame of the image are matched with the positions of each preliminary color difference pixel in the next frame of the image, and the pixel displacement vector corresponding to each frame of the image is calculated based on the matching results. Based on the pixel displacement vector and the initial detection pose, the actual color difference coordinate point set corresponding to the preliminary color difference pixel set of each frame image is calculated respectively; The actual color difference coordinate point set is filtered based on the color deviation threshold, and points within the deviation range are removed to determine the color difference pixel set corresponding to each corrugated cardboard box area.
[0066] It should be noted that, based on the initial detection pose, the corrugated cardboard box area needs to be identified in the image set to be detected; the goal of this step is to identify the region of interest (ROI) so that subsequent color difference detection is focused only on these specific areas, reducing computational complexity and improving detection efficiency.
[0067] The initial detection pose provides information about the position and orientation of the object in the camera coordinate system, helping to determine the exact location of the corrugated cardboard box in the image.
[0068] Within the defined region of interest, perform color difference pixel detection in the Lab color space frame by frame; the specific steps are as follows: Lab color space conversion: As mentioned earlier, the image is converted to the Lab color space to better detect color differences; In the Lab color space, color difference is detected by comparing the color value of each pixel with a given reference or baseline value; all pixels that meet the color difference condition are extracted to form a preliminary color difference pixel set. Match the positions of the initial color difference pixels in each frame with the initial color difference pixels in the next frame: Use appropriate algorithms (such as optical flow or feature point matching) to match the color difference pixels in two frames of images in order to find their correspondence in the images; The displacement vector of each color difference pixel can be calculated from the matching results, representing the positional change of that pixel between consecutive frames; this helps to track the movement of color difference pixels. Based on the pixel displacement vector and the initial detection pose, the actual color difference coordinate point set corresponding to the preliminary color difference pixel set of each frame image is calculated: Using a mapping transformation, the image coordinates of each initial color difference pixel are converted into actual physical coordinates; this step needs to be combined with the initial detection pose information to ensure the accuracy of the coordinate transformation. The actual color difference coordinate point set is filtered based on the color deviation threshold: The color deviation threshold defines which color differences are acceptable and which are out of range; in the actual coordinate point set, those points within the preset deviation range are removed. After filtering, the remaining points are the set of color difference pixels that exceed the color deviation threshold; these points correspond to areas in the corrugated cardboard box where there is a significant color difference.
[0069] In an optional embodiment, based on the color difference pixel set corresponding to each corrugated cardboard box region and the initial detection pose, an initial color difference distribution map corresponding to the image set to be detected is constructed, including: Based on the set of color difference pixels corresponding to each corrugated cardboard box area, calculate the chromaticity coordinates of each color difference pixel after mapping, and then construct the initial color difference mapping point set corresponding to each corrugated cardboard box area. According to the preset color difference threshold rule, the initial color difference mapping point set corresponding to each corrugated cardboard box area is filtered by coordinates to obtain the color difference mapping point set corresponding to each corrugated cardboard box area. Based on each color difference mapping point set and the initial detection pose, the initial color difference distribution map corresponding to the image set to be detected is determined.
[0070] It should be noted that, based on the set of color difference pixels in each corrugated cardboard box area, the chromaticity coordinates of each color difference pixel after mapping are calculated: the color difference pixels extracted in each corrugated cardboard box area previously, these pixels represent the significant color difference in that area.
[0071] Using the initial detection pose, the image coordinates of these color difference pixels are transformed into the actual physical coordinate system to obtain the coordinates of the color difference pixels in the actual space; this process may involve the previously calculated mapping transformation matrix.
[0072] Through mapping, each corrugated cardboard box area will obtain a corresponding set of color difference mapping points, which reflect the distribution of color differences in space.
[0073] The coordinates of the initial color difference mapping point set corresponding to each corrugated cardboard box area are filtered according to the preset color difference threshold rules.
[0074] Determining which color differences are significant and require attention is usually done through experiments or statistical analysis, such as setting a range for a certain color difference value.
[0075] The initial color difference mapping point set for each corrugated cardboard box area is filtered to remove points that are within the color difference deviation range, and only points that exceed the threshold are retained; this ensures that the obtained color difference mapping point set truly reflects the significant color difference.
[0076] Based on each color difference mapping point set and the initial detection pose, determine the initial color difference distribution map corresponding to the image set to be detected: The set of color difference mapping points obtained after screening for each corrugated cardboard box area represents the significant color differences that exist within different areas; Using the information from the initial detection pose, these mapping point sets can be converted back into a coordinate system corresponding to the image set to be detected, ensuring that the color difference distribution map we obtain is consistent with the original image data; By integrating the color difference mapping point sets of all corrugated cardboard box areas, a complete color difference distribution map is formed. This map visualizes the color difference distribution of each area and can be used for further analysis, quality control, or automated inspection.
[0077] In an optional embodiment, the pixel coordinates in the initial color difference distribution map are corrected according to the category of each corrugated cardboard box area and its corresponding distribution range in the initial color difference distribution map to obtain the target color difference distribution map, including: Based on the category of each corrugated cardboard box area, the corresponding standard color card model is extracted from several preset standard color card models. For any first target area in each corrugated cardboard box area, based on the position and color value range of each standard color block in the first standard color card model corresponding to the first target area, the coordinates of each pixel in the first distribution range in the initial color difference distribution map are corrected, so that the coordinates of each pixel in the first distribution range are more in line with the first standard color card model. After coordinate correction, the target color difference distribution map is obtained.
[0078] It should be noted that, based on the category of each corrugated cardboard box area, the corresponding standard color card model is extracted from the preset standard color card model.
[0079] Each corrugated box area may represent different product, color, or process requirements; these categories will determine which standard color chart model to use for reference.
[0080] A standard color chart model typically includes a series of known color samples and corresponding color value ranges as a benchmark for quality inspection; based on the category of the corrugated cardboard box area, a standard color chart model suitable for that area is selected from a set of preset color charts.
[0081] For any first target area in each corrugated cardboard box area, the pixel coordinates in the initial color difference distribution map are corrected according to the corresponding standard color card model: the first target area refers to a specific corrugated cardboard box area, which may be an important part or a key area of focus.
[0082] In the selected standard color chart model, each standard color patch has its fixed position and a predefined range of color values; this information is used to guide how to correct the pixel data in the initial color difference distribution map.
[0083] Within the corresponding distribution range of the first target region, examine the coordinates of each pixel in the initial color difference distribution map and adjust these coordinates to make them closer to the color block positions and color value ranges in the standard color card model; this step may involve color difference calculation and coordinate repositioning to reduce deviation from the standard color blocks.
[0084] The adjusted and corrected color difference distribution map can more accurately reflect the actual color difference in each corrugated cardboard box area.
[0085] In an optional embodiment, the target color difference distribution map is processed by region merging, and regions exceeding the deviation range are located by combining the color deviation threshold to obtain the corresponding color difference region detection results, including: The target color difference distribution map is segmented into superpixels and transformed into a set consisting of several pixel nodes, adjacency relationships and weights. The similarity weight of each pixel node is calculated according to preset rules; Based on the similarity weights and the spatial location of each pixel node, the graph cut algorithm is used to segment the set and generate preliminary color difference regions. The initial color difference area is compared with the color deviation threshold, and the area that exceeds the deviation threshold is taken as the final color difference area detection result.
[0086] It should be noted that dividing the image into several small regions (superpixels), each with similar color or texture features, can effectively reduce computational complexity and preserve the structural information of the image compared to traditional pixel-level processing.
[0087] After superpixel segmentation, the target map is converted into a set containing multiple "pixel nodes," which represent the segmented small regions. At the same time, the adjacency relationships and similarity weights between the nodes are recorded for subsequent processing.
[0088] Similarity weight is used to measure the degree of similarity between different pixel nodes. It is usually calculated based on factors such as color difference and texture features. For example, pixel nodes with similar colors will be given a higher similarity weight, while those with greater differences will be given a lower weight.
[0089] Preset rules are pre-established standards, such as defining what color differences are considered similar through statistical analysis or rules of thumb.
[0090] By utilizing similarity weights and the spatial location of pixel nodes, a graph cut algorithm is used to segment the set and generate preliminary color difference regions.
[0091] Graph cut algorithm is a graph theory-based method that achieves region segmentation by minimizing a certain cost function (such as the sum of edge weights). The algorithm divides the entire set into several regions based on the similarity weights and spatial locations of pixel nodes, so that nodes with high similarity are grouped together.
[0092] The areas formed after the image cut process may show significant color differences, which can serve as the basis for subsequent analysis.
[0093] The initial color difference area is compared with the color deviation threshold to locate the area that exceeds the deviation threshold, thus obtaining the final color difference area detection result: Color deviation threshold is a pre-set standard used to determine which color differences are acceptable and which are out of range; this value is usually based on product quality standards and customer requirements. By comparing the initial color difference areas with a preset deviation threshold, areas whose color difference significantly exceeds the standard range are identified; these areas are marked as the final color difference area detection results.
[0094] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited thereto. Various changes can be made within the scope of knowledge possessed by those skilled in the art without departing from the spirit of the present invention.
Claims
1. A method for detecting color difference areas in corrugated cardboard boxes based on interconnection, characterized in that, include: Acquire images of the interconnected corrugated box inspection marking board; the surface array of the interconnected corrugated box inspection marking board is distributed with interconnected coding patterns and corresponding areas are distributed with standard color difference reference patterns, and positioning mark groups are equidistantly placed between adjacent interconnected coding patterns; The images captured by the marker board are preprocessed and the smallest detection unit of the target is extracted. The world coordinates of the positioning marker are matched according to the encoding recognition matrix of the smallest detection unit of the target to determine the center pixel coordinates of the target positioning marker, the pixel coordinates of the target reference center point, and the pixel coordinates of the target encoding center point. Based on the target localization marker center pixel coordinates, the target reference center point pixel coordinates, the target encoding center point pixel coordinates, and the camera intrinsic parameter matrix, the pose calculation is performed on the image captured by the marker board to obtain the initial detection pose. Based on the color parameter distribution of the standard color difference reference pattern to which the target minimum detection unit belongs, the pixel coordinates of the target reference center point and the pixel coordinates of the target encoding center point, determine the color deviation threshold between the co-line points of the reference center point and the encoding center point; The original two-dimensional image set of the corrugated cardboard box is mapped to the coordinate system of the marker board using the initial detection pose. The original two-dimensional image set is then subjected to color space conversion and brightness correction to obtain the corresponding image set to be detected. Based on the initial detection pose and color deviation threshold, color difference pixels are extracted from the image set to be detected to determine the color difference pixel set corresponding to each corrugated cardboard box region. Based on the color difference pixel set corresponding to each corrugated cardboard box region and the initial detection pose, an initial color difference distribution map corresponding to the image set to be detected is constructed.
2. The method for detecting color difference areas in corrugated cardboard boxes based on interconnection according to claim 1, characterized in that, After constructing an initial color difference distribution map corresponding to the image set to be detected based on the color difference pixel set and initial detection pose corresponding to each corrugated cardboard box region, the method further includes: Based on the category of each corrugated cardboard box area and its corresponding distribution range in the initial color difference distribution map, the coordinates of each pixel in the initial color difference distribution map are corrected to obtain the target color difference distribution map. The target color difference distribution map is processed by merging regions, and the regions that exceed the deviation range are located by combining the color deviation threshold, thus obtaining the corresponding color difference region detection results.
3. The method for detecting color difference areas in corrugated cardboard boxes based on interconnection according to claim 2, characterized in that, The images captured by the marker board are preprocessed and the smallest target detection unit is extracted. The world coordinates of the localization marker are matched with the encoding recognition matrix of the smallest target detection unit to determine the center pixel coordinates of the target localization marker, the pixel coordinates of the target reference center point, and the pixel coordinates of the target encoded center point, including: After extracting the smallest target detection unit from the image captured by the marker board, corner point recognition is performed to determine the corner point coordinates of the actual coded pattern. Based on the actual coded pattern corner coordinates, the smallest positioning and recognition area containing the positioning mark group is delineated in the smallest target detection unit; The corner coordinates of the designed coding pattern are determined by searching the preset detection board coding table based on the coding recognition matrix of the target's smallest detection unit. Based on the transformation relationship between the corner coordinates of the actual coded pattern and the corner coordinates of the associated designed coded pattern, perspective transformation is performed on the image captured by the marking board to determine the transformed image; Extract the initial center pixel coordinates of the positioning markers and the initial reference center pixel coordinates of the positioning marker groups in each minimum positioning recognition region from the transformed image; Geometric center fitting is performed using the center pixel coordinates of each initial positioning marker to determine the initial encoding center pixel coordinates of the encoding center point of the smallest detection unit of the target; The initial positioning marker center pixel coordinates, initial reference center point pixel coordinates, and initial encoding center point pixel coordinates are inversely transformed to the image captured by the marker board to determine the target positioning marker center pixel coordinates, target reference center point pixel coordinates, and target encoding center point pixel coordinates.
4. The method for detecting color difference areas in corrugated cardboard boxes based on interconnection according to claim 3, characterized in that, Based on the target localization marker center pixel coordinates, the target reference center point pixel coordinates, the target encoding center point pixel coordinates, and the camera intrinsic parameter matrix, the pose of the image captured by the marker board is calculated to obtain the initial detection pose, including: The encoding and recognition matrix based on the smallest detection unit of the target is searched in the preset detection board encoding table to match the world coordinates of the positioning mark; Using the world coordinates of the positioning marker, the center pixel coordinates of the target positioning marker, and the camera intrinsic parameter matrix, a linear transformation is performed based on the imaging model to determine the homography matrix; The initial rotation matrix and initial translation matrix are decomposed from the homography matrix to serve as the initial detection pose.
5. The method for detecting color difference areas in corrugated cardboard boxes based on interconnection according to claim 4, characterized in that, Based on the color parameter distribution of the standard color difference reference pattern to which the target minimum detection unit belongs, the pixel coordinates of the target reference center point, and the pixel coordinates of the target encoding center point, the color deviation threshold between the reference center point and the encoding center point along the same line of sight is determined, including: A reference image is cropped from the image captured by the marker plate to extract the area containing the standard color difference reference pattern of the smallest detection unit of the target; The color space conversion, noise suppression, and color parameter extraction are performed sequentially on the reference image to determine the color parameter distribution. Based on the pixel coordinates of the target encoding center point, determine the first color parameter of the corresponding encoding center point associated with the same line of sight from the color parameter distribution; The second color parameter of the corresponding reference center point is determined from the color parameter distribution based on the pixel coordinates of the target reference center point; The degree of color deviation is determined by using the difference between the first color parameter and the second color parameter; Based on the degree of color deviation and the preset acceptable deviation range, determine the color deviation threshold between the line of sight and the reference center point.
6. The method for detecting color difference areas in corrugated cardboard boxes based on interconnection according to claim 5, characterized in that, The original two-dimensional image set of the corrugated cardboard box is mapped to the coordinate system of the marker board using the initial detection pose. Color space conversion and brightness correction are then performed on the original two-dimensional image set to obtain the corresponding image set to be detected, including: Based on the initial detection pose and camera intrinsic parameters, calculate the mapping transformation matrix between the original 2D image set and the marker coordinate system; The pixel coordinates of each frame in the original two-dimensional image set are converted into actual physical coordinates in the marker coordinate system using a mapping transformation matrix; The converted images are then subjected to Lab color space conversion and brightness correction to eliminate the effects of lighting and shooting angle, resulting in the corresponding set of images to be detected.
7. The method for detecting color difference areas in corrugated cardboard boxes based on interconnection according to claim 6, characterized in that, Based on the initial detection pose and color deviation threshold, color difference pixels are extracted from the image set to be detected, determining the color difference pixel set corresponding to each corrugated cardboard box region, including: The region of interest (ROI) in the corrugated cardboard box area of the image to be detected is determined based on the initial detection pose. Within the region of interest, perform color difference pixel detection in Lab color space frame by frame to obtain the preliminary color difference pixel set corresponding to each frame image; The positions of each preliminary color difference pixel in each frame of the image are matched with the positions of each preliminary color difference pixel in the next frame of the image, and the pixel displacement vector corresponding to each frame of the image is calculated based on the matching results. Based on the pixel displacement vector and the initial detection pose, the actual color difference coordinate point set corresponding to the preliminary color difference pixel set of each frame image is calculated respectively; The actual color difference coordinate point set is filtered based on the color deviation threshold, and points within the deviation range are removed to determine the color difference pixel set corresponding to each corrugated cardboard box area.
8. The method for detecting color difference areas in corrugated cardboard boxes based on interconnection according to claim 7, characterized in that, Based on the color difference pixel set corresponding to each corrugated cardboard box region and the initial detection pose, an initial color difference distribution map corresponding to the image set to be detected is constructed, including: Based on the set of color difference pixels corresponding to each corrugated cardboard box area, calculate the chromaticity coordinates of each color difference pixel after mapping, and then construct the initial color difference mapping point set corresponding to each corrugated cardboard box area. According to the preset color difference threshold rule, the initial color difference mapping point set corresponding to each corrugated cardboard box area is filtered by coordinates to obtain the color difference mapping point set corresponding to each corrugated cardboard box area. Based on each color difference mapping point set and the initial detection pose, the initial color difference distribution map corresponding to the image set to be detected is determined.
9. The method for detecting color difference areas in corrugated cardboard boxes based on interconnection according to claim 8, characterized in that, Based on the category of each corrugated cardboard box area and its corresponding distribution range in the initial color difference distribution map, the pixel coordinates in the initial color difference distribution map are corrected to obtain the target color difference distribution map, including: Based on the category of each corrugated cardboard box area, the corresponding standard color card model is extracted from several preset standard color card models. For any first target area in each corrugated cardboard box area, based on the position and color value range of each standard color block in the first standard color card model corresponding to the first target area, the coordinates of each pixel in the first distribution range in the initial color difference distribution map are corrected, so that the coordinates of each pixel in the first distribution range are more in line with the first standard color card model. After coordinate correction, the target color difference distribution map is obtained.
10. The method for detecting color difference areas in corrugated cardboard boxes based on interconnection according to claim 9, characterized in that, The target color difference distribution map is processed by region merging, and regions exceeding the deviation range are located by combining the color deviation threshold, resulting in the corresponding color difference region detection results, including: The target color difference distribution map is segmented into superpixels and transformed into a set consisting of several pixel nodes, adjacency relationships and weights. The similarity weight of each pixel node is calculated according to preset rules; Based on the similarity weights and the spatial location of each pixel node, the graph cut algorithm is used to segment the set and generate preliminary color difference regions. The initial color difference area is compared with the color deviation threshold, and the area that exceeds the deviation threshold is taken as the final color difference area detection result.