Packaging box finished product detection system based on image positioning
By establishing an image acquisition space and coordinate transformation method in the packaging box detection system, the problems of misjudgment and missed detection in the existing technology are solved, high-precision packaging box finished product detection is achieved, and accurate size detection reports are generated.
Patent Information
- Application Number
- CN202510792024.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-09-05
AI Technical Summary
Existing packaging box inspection systems are prone to misjudgment or missed detection when faced with interference factors such as shooting angle offset and lighting changes, and it is difficult to achieve high-precision contour shape assessment.
By establishing an image acquisition space with unified coordinates, a standard contour coordinate set and a finished product contour coordinate set are generated, and the coordinate transformation and mapping are performed using the transformation matrix, the coordinate deviation is calculated, and a dimension detection report is generated.
It achieves precise geometric shape detection of finished packaging boxes, eliminates coordinate inconsistencies caused by shooting angles, position offsets and other factors, reflects the deviation between the finished product and the standard with pixel-level accuracy, and generates a comprehensive evaluation report to determine overall deformation, local defects or tilt and other problems.
Smart Images

Figure CN120593618A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a packaging box detection system, in particular to a packaging box finished product detection system based on image positioning. Background Art
[0002] In packaging manufacturing, the finished product's dimensions and contour consistency directly impact product quality and subsequent packaging performance. Traditional packaging inspection methods rely primarily on manual visual inspection or caliper measurement, which is inefficient, subjective, and difficult to fully assess. With the advancement of industrial automation, image processing-based quality inspection technologies are increasingly being applied in this field.
[0003] Patent publication number CN113670212B discloses a size detection method and device that can accommodate a wide range of material sizes without adjusting the camera's focal length. However, existing image detection systems often employ overall image comparison or color feature recognition, which can lead to misjudgments or missed detections when faced with interference factors such as camera angle offset and lighting changes. Furthermore, while some systems possess edge extraction capabilities, the deviation between the standard template and the actual contour lacks high-precision coordinate-based quantification, limiting their application in high-precision detection scenarios. Summary of the Invention
[0004] In response to the shortcomings of the existing technology, the present invention provides a finished product packaging box inspection system based on image positioning, which solves the technical problems raised in the background technology by establishing an image acquisition space with unified coordinates and establishing a dimension comparison method based on coordinate point pairs in the space.
[0005] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0006] A finished product packaging box detection system based on image positioning, characterized by comprising:
[0007] A space construction unit, used to construct an image acquisition space for the finished packaging box;
[0008] A standard coordinate set generating unit, configured to generate a standard contour coordinate set in the image acquisition space;
[0009] A finished product image capturing unit, configured to capture a finished packaging box located in an image capturing space to obtain a finished product image;
[0010] A finished product coordinate set generating unit, used for obtaining a finished product contour coordinate set of a finished product image in an image acquisition space;
[0011] A transformation matrix establishing unit, for establishing a transformation matrix of standard contour coordinates according to a finished contour coordinate set and a standard contour coordinate set;
[0012] A mapping coordinate set generating unit, configured to perform coordinate transformation on each coordinate point in the standard outline coordinate set according to the transformation matrix, and generate a mapping coordinate set in the same coordinate system as the finished product outline coordinate set;
[0013] A coordinate deviation calculation unit is used to compare the mapping coordinate set with the finished product outline coordinate set coordinate by coordinate and calculate the coordinate deviation of each set of coordinate point pairs;
[0014] The detection report generating unit is used to generate a dimension detection report according to the coordinate deviation of each coordinate point.
[0015] In some embodiments, the steps of constructing the space construction unit include:
[0016] S1-1, establishing a first area for carrying packaging boxes on a horizontal plane;
[0017] S1-2. Establish a second area for fixing the image acquisition source directly above the first area; wherein the second area and the first area are regular geometric shapes that are parallel to each other and aligned in center, and the coverage of the second area at least completely covers the first area.
[0018] S1-3, constructing a virtual plane by vertically extending upward from the outline of the first region until the virtual plane intersects with the second region;
[0019] S1-4. Define the space enclosed by the first area, the second area directly above it, and multiple virtual planes extending vertically upward from the outline of the first area and intersecting the second area as an image acquisition space.
[0020] In some embodiments, the generating step of the standard coordinate set generating unit includes:
[0021] S2-1, establishing an image coordinate system in the image acquisition space;
[0022] S2-2. Construct a standard outline coordinate set of a standard packaging box in the image coordinate system.
[0023] In some embodiments, establishing an image coordinate system in the image acquisition space includes:
[0024] S2-1-1. Determine the geometric shapes of the first area and the second area; wherein the first area is any geometrically regular shape of a rectangle, a square, or a circle;
[0025] S2-1-2. Calculate and anchor the geometric center points of the first area and the second area based on the geometric figures of the first area and the second area;
[0026] S2-1-3, aligning the geometric center points of the first area and the second area;
[0027] S2-1-4. Define the geometric center points as coordinate origins respectively, and establish an image coordinate system in the image acquisition space;
[0028] In some embodiments, constructing a standard outline coordinate set of a standard packaging box in the image coordinate system includes:
[0029] S2-2-1. Acquire a top-view cross-sectional image of a standard packaging box in an image coordinate system; wherein the top-view cross-sectional image is marked with the standard coordinates covered by the image;
[0030] S2-2-2. Construct a standard outline coordinate set of the standard packaging box in the first region according to the standard coordinates marked on the top-view cross-sectional image;
[0031] S2-2-3. Define the outermost standard coordinates in the standard contour coordinate set as the standard contour coordinate set for the packaging box.
[0032] In some embodiments, the generating step of the finished product coordinate set generating unit includes:
[0033] S4-1, performing a preprocessing operation on the finished product image to obtain a binary image of the finished packaging box;
[0034] Wherein, the preprocessing includes grayscale processing and threshold segmentation;
[0035] S4-2, performing edge detection on the binary image to determine the true contour points of the finished packaging box;
[0036] S4-3. Obtain the contour coordinates of the real contour points to construct a finished product contour coordinate set.
[0037] In some embodiments, preprocessing the finished product image to obtain a binary image of the finished packaging box includes:
[0038] S4-1-1. Obtain the RGB intensity of any three-channel pixel in the finished image;
[0039] S4-1-2, performing weighted grayscale calculation on the RGB intensity of any three-channel pixel to generate a grayscale value of the pixel;
[0040] S4-1-3, compare the grayscale value of any pixel with the grayscale threshold. If the grayscale value is greater than the grayscale threshold, replace the pixel with a white pixel; otherwise, replace it with a black pixel.
[0041] S4-1-4, traverse all three-channel pixel points in the finished image, and replace them with corresponding white pixel points or black pixel points to generate the binary image.
[0042] In some embodiments, edge detection is performed on the binary image to determine the true contour points of the finished packaging box, including:
[0043] S4-2-1, selecting adjacent pixel points in the binary image;
[0044] S4-2-2. Obtain the grayscale value of each group of adjacent pixels; wherein the grayscale value of the binary image is represented by a white pixel value of 255 or a black pixel value of 0;
[0045] S4-2-3, performing difference calculation on the grayscale values of each group of adjacent pixels;
[0046] If the difference is not 0, it is determined that the adjacent pixel points contain at least one candidate contour point;
[0047] S4-2-4, traverse all adjacent pixel points in the binary image, repeat the difference calculation, and obtain a set of candidate contour points;
[0048] S4-2-5. For each candidate contour point in the candidate contour point set, obtain the grayscale values of its eight neighboring pixels;
[0049] S4-2-6. If the grayscale value of at least one pixel among the eight neighborhood pixels is different from that of the candidate contour point, the candidate contour point is defined as a true contour point; otherwise, the candidate contour point is defined as an internal point.
[0050] In some embodiments, the steps of establishing the transformation matrix establishing unit include:
[0051] S5-1. Select at least three non-collinear coordinate points in the finished product contour coordinate set and the standard contour coordinate set;
[0052] Among them, two corresponding coordinate points are assigned the same index number when they are selected to construct a one-to-one corresponding coordinate point pair;
[0053] S5-2, defining the selected coordinate points in the finished product contour coordinate set as a first coordinate set, and defining the selected coordinate points in the standard contour coordinate set as a second coordinate set;
[0054] S5-3. Based on the first coordinate set and the second coordinate set, an affine transformation algorithm is used to calculate the transformation matrix between the coordinate point pairs.
[0055] The present invention provides a finished product packaging box detection system based on image positioning, which has the following beneficial effects:
[0056] The present invention realizes accurate detection of the geometric shape of the finished packaging box by aligning the coordinate system and comparing point by point the standard contour coordinate set and the finished product contour coordinate set, eliminating the coordinate inconsistency problem caused by factors such as shooting angle and position offset. Furthermore, based on the Euclidean distance calculation between the mapped standard coordinate set and the extracted actual finished product contour coordinates, the deviation between the finished product and the standard can be reflected with pixel-level accuracy. The entire detection process relies on image acquisition space construction, standard modeling, image preprocessing, edge extraction, coordinate transformation and deviation analysis modules to be connected in sequence, forming a set of closed-loop detection from image input to size evaluation. Through the rule-driven size detection report generation strategy, the system can determine whether the finished packaging box has overall deformation, local defects or tilt problems based on the discovery of coordinate deviations, combined with the deviation distribution characteristics, and generate a size detection report accordingly, so that the size defects of the finished packaging box in the subsequent manufacturing environment can be avoided through the size detection report. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 This is a structural block diagram of a finished product packaging box detection system based on image positioning according to the present invention;
[0058] Figure 2 This is a schematic diagram of the detection process of a finished product packaging box detection system based on image positioning according to the present invention;
[0059] Figure 3 This is a schematic diagram of the process of constructing the standard contour coordinate set of the present invention;
[0060] Figure 4 Schematic diagram of the process of defining the true contour points of the present invention. DETAILED DESCRIPTION
[0061] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0062] See also Figures 1 to 4 The present invention provides a finished product packaging box detection system based on image positioning, the detection system comprising:
[0063] A space construction unit, used to construct an image acquisition space for the finished packaging box;
[0064] Exemplarily, the steps of constructing the space construction unit include:
[0065] S1-1, establishing a first area for carrying packaging boxes on a horizontal plane;
[0066] S1-2. Establish a second area for fixing the image acquisition source directly above the first area; wherein the second area and the first area are regular geometric shapes that are parallel to each other and aligned in center, and the coverage of the second area at least completely covers the first area.
[0067] S1-3, constructing a virtual plane by vertically extending upward from the outline of the first region until the virtual plane intersects with the second region;
[0068] S1-4. Define the space enclosed by the first area, the second area directly above it, and multiple virtual planes extending vertically upward from the outline of the first area and intersecting the second area as an image acquisition space.
[0069] In this embodiment, the first area serves as the bearing plane of the packaging box and adopts regular geometric shapes such as rectangles or squares to facilitate positioning and alignment with the coordinate system; the second area is set directly above it for installing industrial cameras or other image acquisition equipment, and its coverage completely covers the first area to ensure the integrity of the shooting perspective.
[0070] Multiple virtual planes extending vertically upward from the outline of the first area intersect with the second area, and together enclose a closed hexahedral space, which defines the effective area and imaging boundary of image acquisition, preventing the external environment from interfering with the image acquisition quality.
[0071] The detection system also includes:
[0072] A standard coordinate set generating unit, configured to generate a standard contour coordinate set in the image acquisition space;
[0073] Exemplarily, the generation step of the standard coordinate set generation unit includes:
[0074] S2-1, establishing an image coordinate system in the image acquisition space;
[0075] S2-2. Construct a standard outline coordinate set of a standard packaging box in the image coordinate system.
[0076] In this embodiment, the generation process of the standard outline coordinate set relies on the definition of the image coordinate system in the image acquisition space, and the outer contour of the standard packaging box is digitally expressed through the coordinate system.
[0077] Furthermore, the step S2-1 specifically includes:
[0078] S2-1-1. Determine the geometric shapes of the first area and the second area; wherein the first area is any geometrically regular shape of a rectangle, a square, or a circle;
[0079] S2-1-2. Calculate and anchor the geometric center points of the first area and the second area based on the geometric figures of the first area and the second area;
[0080] For example, if the first region is rectangular or square, the geometric center point is the intersection of its diagonals; if it is circular, the geometric center point is the center of the circle. In short, the geometric center point needs to be the reference point of the image coordinate system. Furthermore, the first and second regions should have the same geometric shape (e.g., both are rectangular, square, or circular), but may differ in size.
[0081] S2-1-3, aligning the geometric center points of the first area and the second area;
[0082] S2-1-4. Define the geometric center points as coordinate origins respectively, and establish an image coordinate system in the image acquisition space;
[0083] The X-axis of the image coordinate system extends horizontally along a side of the first region, and the Y-axis is perpendicular to the X-axis and coplanar with the plane of the first region.
[0084] It should be noted that since the packaging box is a regular geometric shape (such as a rectangle, cube, etc.), its external dimensions and placement are predictable.
[0085] In this embodiment, the image coordinate system is established based on the geometric consistency of the first and second regions. By identifying the specific geometric shape of the first region, its corresponding geometric center point is calculated and used as the origin of the image coordinate system. The X-axis extends along a side of the first region, and the Y-axis is perpendicular to it, forming a two-dimensional plane coordinate system.
[0086] The construction method of this coordinate system ensures that the relative positions of various elements in the image acquisition space (such as packaging boxes and image acquisition sources) can be accurately expressed.
[0087] Furthermore, the step S2-2 specifically includes:
[0088] S2-2-1. Acquire a top-view cross-sectional image of a standard packaging box in an image coordinate system; wherein the top-view cross-sectional image is marked with the standard coordinates covered by the image;
[0089] For example, in the process of marking several coordinates, first anchor the lower left corner of the standard packaging box, align the lower left corner with the coordinate origin, and coincide the left contour with the coordinate Y axis; at this time, of the two contours adjacent to the left contour, one coincides with the X axis, and the other is parallel to the X axis.
[0090] Then, a top-view cross-sectional image of the standard packaging box is captured by an image acquisition source set at the geometric center point of the second area. During the acquisition process, the coordinates of the corresponding positions in the image coordinate system are mapped and marked on the top-view cross-sectional image, thereby obtaining a top-view cross-sectional image marked with coordinates.
[0091] S2-2-2. Construct a standard outline coordinate set of the standard packaging box in the first region according to the standard coordinates marked on the top-view cross-sectional image;
[0092] S2-2-3. Define the outermost standard coordinates in the standard contour coordinate set as the standard contour coordinate set for the packaging box.
[0093] In this embodiment, the construction of the standard outline coordinate set relies on the spatial consistency between the image coordinate system and the top-view image. By aligning the key corners of the standard packaging box with the origin of the image coordinate system and aligning the outline direction with the coordinate axes, the spatial layout of the standard outline coordinates is unified.
[0094] The detection system also includes:
[0095] A finished product image capturing unit, configured to capture a finished packaging box located in an image capturing space to obtain a finished product image;
[0096] A finished product coordinate set generating unit, used for obtaining a finished product contour coordinate set of a finished product image in an image acquisition space;
[0097] Exemplarily, the generation step of the finished product coordinate set generation unit includes:
[0098] S4-1, performing a preprocessing operation on the finished product image to obtain a binary image of the finished packaging box;
[0099] Wherein, the preprocessing includes grayscale processing and threshold segmentation;
[0100] S4-2, performing edge detection on the binary image to determine the true contour points of the finished packaging box;
[0101] S4-3. Obtain the contour coordinates of the real contour points to construct a finished product contour coordinate set.
[0102] In this embodiment, the coordinate set for the finished product's outline is generated based on image preprocessing and edge detection. Grayscaling and threshold segmentation are used to convert the original finished product image into a binary image, highlighting the boundary between the packaging box and the background. The edge detection process performed on this basis effectively extracts the actual outline structure of the packaging box in the image and identifies spatially meaningful true contour points.
[0103] Furthermore, the step S4-1 specifically includes:
[0104] S4-1-1. Obtain the RGB intensity of any three-channel pixel in the finished image;
[0105] S4-1-2, performing weighted grayscale calculation on the RGB intensity of any three-channel pixel to generate a grayscale value of the pixel;
[0106] S4-1-3, compare the grayscale value of any pixel with the grayscale threshold. If the grayscale value is greater than the grayscale threshold, replace the pixel with a white pixel; otherwise, replace it with a black pixel.
[0107] S4-1-4, traverse all three-channel pixel points in the finished image, and replace them with corresponding white pixel points or black pixel points to generate the binary image.
[0108] In this example, a preprocessing process based on weighted grayscale conversion and fixed threshold segmentation is performed on the finished product image, achieving the mapping from a multi-channel color space to a binary black-and-white image. Using a fixed threshold for binarization ensures effective separation of the image background and target area, improving image processing efficiency and consistently highlighting the outline boundary between the finished packaging box and the background.
[0109] Furthermore, the step S4-2 specifically includes:
[0110] S4-2-1, selecting adjacent pixel points in the binary image;
[0111] S4-2-2. Obtain the grayscale value of each group of adjacent pixels; wherein the grayscale value of the binary image is represented by a white pixel value of 255 or a black pixel value of 0;
[0112] S4-2-3, performing difference calculation on the grayscale values of each group of adjacent pixels;
[0113] If the difference is not 0, it is determined that the adjacent pixel points contain at least one candidate contour point;
[0114] S4-2-4, traverse all adjacent pixel points in the binary image, repeat the difference calculation, and obtain a set of candidate contour points;
[0115] S4-2-5. For each candidate contour point in the candidate contour point set, obtain the grayscale values of its eight neighboring pixels;
[0116] S4-2-6. If the grayscale value of at least one pixel among the eight neighborhood pixels is different from that of the candidate contour point, the candidate contour point is defined as a true contour point; otherwise, the candidate contour point is defined as an internal point.
[0117] In this embodiment, an edge detection algorithm based on pixel grayscale value differences is used to determine the true contour points of the finished packaging box. This effectively utilizes the strong contrast between black and white to ensure that contour information can be accurately identified even in complex backgrounds or lighting conditions.
[0118] Furthermore, for each pixel marked as a candidate contour point, the grayscale values of its eight neighboring pixels are examined to accurately determine whether the point is a true contour point. This not only takes into account local pixel variations but also distinguishes true boundaries from false edges caused by noise or other factors. A candidate contour point is considered a true contour point only if there is at least one pixel with a different grayscale value around it, thereby improving the accuracy of contour extraction.
[0119] The detection system also includes:
[0120] A transformation matrix establishing unit, for establishing a transformation matrix of standard contour coordinates according to a finished contour coordinate set and a standard contour coordinate set;
[0121] Exemplarily, the steps of establishing the transformation matrix establishing unit include:
[0122] S5-1. Select at least three non-collinear coordinate points in the finished product contour coordinate set and the standard contour coordinate set;
[0123] Among them, two corresponding coordinate points are assigned the same index number when they are selected to construct a one-to-one corresponding coordinate point pair;
[0124] For example, representative key coordinates such as four corner coordinate points and a geometric center point may be selected.
[0125] Affine transformation requires at least three pairs of non-collinear points (i.e. points that are not on the same straight line) to solve.
[0126] S5-2, defining the selected coordinate points in the finished product contour coordinate set as a first coordinate set, and defining the selected coordinate points in the standard contour coordinate set as a second coordinate set;
[0127] S5-3, based on the first coordinate set and the second coordinate set, using an affine transformation algorithm to calculate the transformation matrix between the coordinate point pairs;
[0128] The transformation matrix refers to an affine transformation matrix that describes the geometric transformation relationship between the finished product outline coordinate set and the standard outline coordinate set, and is used to represent geometric changes such as translation, rotation, scaling and shearing of the finished product relative to the standard shape.
[0129] Exemplarily, the affine transformation algorithm may use the least square method to minimize the sum of squared errors between point pairs to solve the optimal affine transformation matrix.
[0130] The detection system also includes:
[0131] A mapping coordinate set generating unit, configured to perform coordinate transformation on each coordinate point in the standard outline coordinate set according to the transformation matrix, and generate a mapping coordinate set in the same coordinate system as the finished product outline coordinate set;
[0132] Exemplarily, the transformation matrix refers to a two-dimensional affine transformation matrix obtained by fitting the correspondence between the standard contour coordinate set and the finished product contour coordinate set by the least squares method.
[0133] The detection system also includes:
[0134] The coordinate deviation calculation unit is used to compare the mapping coordinate set with the finished product outline coordinate set coordinate by coordinate and calculate the coordinate deviation of each set of coordinate point pairs; exemplarily, the coordinate deviation is represented by the Euclidean distance between corresponding coordinate points with the same index number.
[0135] The detection system also includes:
[0136] The detection report generating unit is used to generate a dimension detection report according to the coordinate deviation of each coordinate point.
[0137] It should be noted that the dimensional inspection report is a rule-driven, comprehensive assessment report. Specifically, when coordinate deviation is present, it can be determined that the finished packaging box has dimensional deviation. Furthermore, based on the specific coordinates corresponding to the coordinate deviation, the specific coordinate location of the deviation in the finished packaging box can be located. Furthermore, the specific deviation type of the finished packaging box can be determined based on the positive or negative direction of the coordinate deviation or the specific coordinate distribution of multiple coordinate deviations.
[0138] For example:
[0139] ① A positive deviation in the positive and negative directions may indicate that the actual size is larger than the standard size, and vice versa.
[0140] ② When the deviations of several coordinates are all greater than the preset threshold and show regular changes (for example, they increase uniformly along a certain edge), it can be determined that the finished packaging box has undergone overall deformation or bending.
[0141] ③ When the coordinate deviation in a specific area is significantly higher than in other areas and exceeds the set threshold, it can be determined that there may be a local defect, such as a missing corner or a dent. For example, if the coordinate deviation in a corner of a packaging box is far beyond the normal range, this may indicate physical damage or a manufacturing defect in that corner.
[0142] ④ When the coordinate deviation is concentrated on one side of the box while the other side remains relatively stable, it may indicate that the finished box is tilted. This usually means asymmetric pressure during the molding process.
[0143] By knowing the direction and magnitude of the deviation, the production process parameters can be adjusted to reduce the error of the finished packaging box in the subsequent manufacturing process.
[0144] In this embodiment, the geometric shape of the finished packaging box is detected by aligning the coordinate systems of the standard outline coordinate set with the finished product outline coordinate set and comparing them point by point. This method maps the standard outline to the actual image space, eliminating coordinate inconsistencies. Furthermore, the distance calculation between the mapped coordinate set and the actual extracted finished product outline coordinates can reflect the deviation between the finished product and the standard. The entire detection process relies on the sequential connection of modules such as image acquisition space construction, standard modeling, image preprocessing, edge extraction, coordinate transformation, and deviation analysis, forming a closed-loop detection process from image input to dimensional assessment.
[0145] To summarize, the present invention establishes an image acquisition space for the finished packaging box and performs coordinate comparison based on coordinate transformation in the space to form several coordinate deviations between the finished packaging box and the standard packaging box; finally, based on the several coordinate deviations and the predefined rule-driven strategy, a dimension detection report is generated, so that the dimension defects of the finished packaging box in the subsequent manufacturing environment can be avoided through the dimension detection report.
[0146] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center by wired (e.g., infrared, wireless, microwave, etc.) means.
[0147] The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that contains a collection of one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, or a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state drive.
[0148] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative, and for example, multiple units or components can be combined or integrated into another system, or some features can be omitted or not implemented. In addition, the coupling or direct coupling or communication connection shown or discussed can be through some interface, indirect coupling or communication connection of devices or units, and can be electrical, mechanical, or other forms.
[0149] The above is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered by the scope of protection of the present application.
Claims
1. A finished product packaging box detection system based on image positioning, characterized in that: include: A space construction unit, used to construct an image acquisition space for the finished packaging box; A standard coordinate set generating unit, configured to generate a standard contour coordinate set in the image acquisition space; A finished product image capturing unit, configured to capture a finished packaging box located in an image capturing space to obtain a finished product image; A finished product coordinate set generating unit, used for obtaining a finished product contour coordinate set of a finished product image in an image acquisition space; A transformation matrix establishing unit, for establishing a transformation matrix of standard contour coordinates according to a finished contour coordinate set and a standard contour coordinate set; A mapping coordinate set generating unit, configured to perform coordinate transformation on each coordinate point in the standard outline coordinate set according to the transformation matrix, and generate a mapping coordinate set in the same coordinate system as the finished product outline coordinate set; A coordinate deviation calculation unit is used to compare the mapping coordinate set with the finished product outline coordinate set coordinate by coordinate and calculate the coordinate deviation of each set of coordinate point pairs; The detection report generating unit is used to generate a dimension detection report according to the coordinate deviation of each coordinate point.
2. The finished product packaging box detection system based on image positioning according to claim 1, characterized in that: The steps of constructing the space construction unit include: S1-1, establishing a first area for carrying packaging boxes on a horizontal plane; S1-2. Establish a second area for fixing the image acquisition source directly above the first area; wherein the second area and the first area are regular geometric shapes that are parallel to each other and aligned in center, and the coverage of the second area at least completely covers the first area. S1-3, constructing a virtual plane by vertically extending upward from the outline of the first region until the virtual plane intersects with the second region; S1-4. Define the space enclosed by the first area, the second area directly above it, and multiple virtual planes extending vertically upward from the outline of the first area and intersecting the second area as an image acquisition space.
3. The finished product packaging box detection system based on image positioning according to claim 1, characterized in that: The generation step of the standard coordinate set generation unit includes: S2-1, establishing an image coordinate system in the image acquisition space; S2-2. Construct a standard outline coordinate set of a standard packaging box in the image coordinate system.
4. The finished product packaging box detection system based on image positioning according to claim 3, characterized in that: Establishing an image coordinate system in the image acquisition space includes: S2-1-1. Determine the geometric shapes of the first area and the second area; wherein the first area is any geometrically regular shape of a rectangle, a square, or a circle; S2-1-2. Calculate and anchor the geometric center points of the first area and the second area based on the geometric figures of the first area and the second area; S2-1-3, aligning the geometric center points of the first area and the second area; S2-1-4. Define the geometric center points as coordinate origins respectively, and establish an image coordinate system in the image acquisition space.
5. The finished product packaging box detection system based on image positioning according to claim 4, characterized in that: In the image coordinate system, a standard outline coordinate set of a standard packaging box is constructed, including: S2-2-1. Acquire a top-view cross-sectional image of a standard packaging box in an image coordinate system; wherein the top-view cross-sectional image is marked with the standard coordinates covered by the image; S2-2-2. Construct a standard outline coordinate set of the standard packaging box in the first region according to the standard coordinates marked on the top-view cross-sectional image; S2-2-3. Define the outermost standard coordinates in the standard contour coordinate set as the standard contour coordinate set for the packaging box.
6. The finished product packaging box detection system based on image positioning according to claim 1, characterized in that: The generation step of the finished product coordinate set generation unit includes: S4-1, performing a preprocessing operation on the finished product image to obtain a binary image of the finished packaging box; Wherein, the preprocessing includes grayscale processing and threshold segmentation; S4-2, performing edge detection on the binary image to determine the true contour points of the finished packaging box; S4-3. Obtain the contour coordinates of the real contour points to construct a finished product contour coordinate set.
7. The finished product packaging box detection system based on image positioning according to claim 6, characterized in that: Performing a preprocessing operation on the finished product image to obtain a binary image of the finished packaging box, including: S4-1-1. Obtain the RGB intensity of any three-channel pixel in the finished image; S4-1-2, performing weighted grayscale calculation on the RGB intensity of any three-channel pixel to generate a grayscale value of the pixel; S4-1-3, compare the grayscale value of any pixel with the grayscale threshold. If the grayscale value is greater than the grayscale threshold, replace the pixel with a white pixel; otherwise, replace it with a black pixel. S4-1-4, traverse all three-channel pixel points in the finished image, and replace them with corresponding white pixel points or black pixel points to generate the binary image.
8. The finished product packaging box detection system based on image positioning according to claim 7, characterized in that: Performing edge detection on the binary image to determine the true contour points of the finished packaging box includes: S4-2-1, selecting adjacent pixel points in the binary image; S4-2-2. Obtain the grayscale value of each group of adjacent pixels; wherein the grayscale value of the binary image is represented by a white pixel value of 255 or a black pixel value of 0; S4-2-3, performing difference calculation on the grayscale values of each group of adjacent pixels; If the difference is not 0, it is determined that the adjacent pixel points contain at least one candidate contour point; S4-2-4, traverse all adjacent pixel points in the binary image, repeat the difference calculation, and obtain a set of candidate contour points; S4-2-5. For each candidate contour point in the candidate contour point set, obtain the grayscale values of its eight neighboring pixels; S4-2-6. If the grayscale value of at least one pixel among the eight neighborhood pixels is different from that of the candidate contour point, the candidate contour point is defined as a true contour point; otherwise, the candidate contour point is defined as an internal point.
9. The finished product packaging box detection system based on image positioning according to claim 8, characterized in that: The steps of establishing the transformation matrix establishing unit include: S5-1. Select at least three non-collinear coordinate points in the finished product contour coordinate set and the standard contour coordinate set; Among them, two corresponding coordinate points are assigned the same index number when they are selected to construct a one-to-one corresponding coordinate point pair; S5-2, defining the selected coordinate points in the finished product contour coordinate set as a first coordinate set, and defining the selected coordinate points in the standard contour coordinate set as a second coordinate set; S5-3. Based on the first coordinate set and the second coordinate set, an affine transformation algorithm is used to calculate the transformation matrix between the coordinate point pairs.
Citation Information
Patent Citations
Size detection method and size detection device
CN113670212B
Watch glass cover plate profile detection method
CN109211136A
RV reducer cycloidal gear manufacturing error rapid detection system based on imaging technology
CN113074664A
Method for detecting appearance of workpiece
CN114061480A
Steel rail contour loss detection method, device and system
CN114152214A
Cited By
Packaging box detection method and device
CN120807499A