Bounding box extraction method, device, electronic device and readable storage medium
By detecting the corresponding minimum bounding box in two consecutive image frames, the target bounding box of the goods is determined, which solves the problem of misjudgment caused by the part of the goods exceeding the camera's field of view in the existing technology, and improves the grabbing accuracy of the automated equipment.
Patent Information
- Application Number
- CN202410642952.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-05-23
AI Technical Summary
In the existing cargo palletizing technology, the method of detecting the minimum bounding box has the problem of misjudgment. Especially when the cargo part exceeds the camera's field of view, the true minimum bounding box cannot be accurately determined, resulting in insufficient accuracy when automated equipment is captured.
By obtaining two consecutive image frames collected by the camera equipment, the surface point cloud vertices and the minimum bounding box of the cargo are obtained, and the corresponding minimum bounding box in the two image frames is detected to determine the target bounding box and ensure its accuracy.
This method can accurately determine the correct target bounding box, improve the accuracy of automated equipment in grabbing goods, reduce misjudgments, and ensure the accuracy of palletizing processing.
Smart Images

Figure CN118247473B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cargo palletizing, and in particular to a bounding box extraction method, device, electronic device and readable storage medium. Background Art
[0002] In a mixed palletizing scenario, the transported goods, such as boxes, are placed on a conveyor belt. Each time the conveyor belt moves a fixed distance, the camera can capture an image to obtain image information containing the box. The point cloud of the box is then obtained based on the captured image. The minimum bounding box position of the box in the image is obtained by extracting the point cloud of the box surface and calculating the minimum bounding box. The determination of the minimum bounding box can be provided to automated equipment to implement automated operations, such as grabbing boxes, transferring boxes, etc., so as to perform palletizing.
[0003] Because some boxes are completely within the camera's field of view, while some boxes are partially within the camera's field of view, the box corresponding to the smallest bounding box detected is not necessarily the real box. Figure 1 As shown in , the gray rectangle represents the box, the bold line shows the minimum bounding box, and the outermost rectangular box represents the camera field of view. The so-called real box refers to the box that enables the automated equipment to accurately perform automated operations in the future. In order to determine which boxes corresponding to the minimum bounding boxes in the image frame are real, the existing common method is to use the camera field of view detection method, that is, to determine which minimum bounding boxes are all within the camera field of view, and determine the boxes corresponding to the minimum bounding boxes that are all within the camera field of view as real boxes, and then control the automated equipment to grab the box for palletizing.
[0004] This method used in the prior art has many defects. For example, if a box with a large length and width enters the camera's field of view, the minimum bounding box corresponding to the box in two consecutive image frames is not completely within the camera's field of view, for example, as shown in Figure 2 (a). If the camera field of view detection method is used, the boxes in the two image frames will be judged as false, but in fact the minimum bounding boxes of the two boxes are correct. In addition, if one side of a box is truncated by the camera's field of view, a truncated box may be formed, for example, as shown in Figure 2 (b). The minimum bounding box of the truncated box is completely within the camera's field of view. If the camera field of view detection method is used, the minimum bounding box will be judged as true, but in fact the minimum bounding box is incorrect. Summary of the invention
[0005] Objectives of the present invention include, for example, providing a bounding box extraction method, device, electronic device and readable storage medium, which can accurately determine the correct minimum bounding box.
[0006] The embodiments of the present invention can be implemented as follows:
[0007] In a first aspect, the present invention provides a bounding box extraction method, the method comprising:
[0008] Acquire two consecutive image frames captured by a camera device, each of the image frames having at least one image information of the same goods, the goods being placed on a conveyor belt, and the conveyor belt moving a set distance within a capture interval of the two consecutive image frames;
[0009] Obtaining vertices of the surface point cloud of the goods in each of the image frames, and obtaining a minimum bounding box of each of the goods;
[0010] Based on the vertices and minimum bounding boxes of the surface point clouds of the goods in the two image frames, the minimum bounding boxes with corresponding relationships in the two image frames are detected;
[0011] The target bounding box is determined from the minimum bounding boxes with corresponding relationships.
[0012] In an optional implementation, the two image frames include a first image frame and a second image frame arranged in chronological order of acquisition time;
[0013] The step of detecting the minimum bounding box having a corresponding relationship between the two image frames based on the vertices and the minimum bounding box of the surface point cloud of the goods in the two image frames comprises:
[0014] Screening out a minimum bounding box that meets a preset condition in the first image frame, and obtaining a key vertex among vertices corresponding to the screened minimum bounding box;
[0015] The moving direction of the conveyor belt is the x-axis direction of the camera coordinate system, the origin of the camera coordinate system is the center point of the camera field of view of the camera device, and the preset condition is that the x-coordinate value of the center point of the minimum bounding box is less than 0 and the minimum bounding box is not marked as a target bounding box;
[0016] For each minimum bounding box in the second image frame, based on the position information of each vertex of the minimum bounding box and the position information of the key vertices of each minimum bounding box screened in the first image frame, the key vertices with a corresponding relationship of the minimum bounding box are determined to obtain the minimum bounding boxes with a corresponding relationship in the two image frames.
[0017] In an optional implementation, the step of determining the key vertices having a corresponding relationship with the minimum bounding box based on the position information of each vertex of the minimum bounding box and the position information of the key vertices of each minimum bounding box screened in the first image frame includes:
[0018] For each key vertex, based on each vertex corresponding to the minimum bounding box and the position information of each key vertex, determine the target vertex with the minimum distance to each key vertex;
[0019] Determine the distance from the minimum bounding box to each key vertex based on the target vertex of the minimum bounding box;
[0020] For each of the key vertices, a minimum bounding box having a minimum distance from the key vertex is detected, and it is determined that the key vertex having the minimum distance and the minimum bounding box have a corresponding relationship.
[0021] In an optional implementation, the step of obtaining key vertices among the vertices corresponding to the screened minimum bounding box includes:
[0022] For each of the selected minimum bounding boxes, obtain the x-coordinate value of each vertex corresponding to the minimum bounding box;
[0023] Sort the vertices in ascending order of x-coordinate values;
[0024] Traverse the sorted vertices in reverse order and obtain the first vertex whose x coordinate value is less than 0 as the key vertex.
[0025] In an optional implementation, the step of determining a target bounding box from the minimum bounding boxes having a corresponding relationship includes:
[0026] Calculate the area of each minimum bounding box of two corresponding minimum bounding boxes;
[0027] The minimum bounding box with a larger area among the two corresponding minimum bounding boxes is determined as the target bounding box.
[0028] In an optional embodiment, the step of obtaining the vertices of the surface point cloud of the cargo in each of the image frames comprises:
[0029] For each of the image frames, obtaining a surface point cloud of the cargo in the image frame, and projecting the surface point cloud into a two-dimensional coordinate system, wherein the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis;
[0030] Obtaining the minimum component and the maximum component of the projected point cloud projected on the first coordinate axis and the second coordinate axis respectively;
[0031] Rotating the two-dimensional coordinate system, and obtaining the minimum component and the maximum component of the projected point cloud on the first coordinate axis and the second coordinate axis of the rotated two-dimensional coordinate system;
[0032] Based on the obtained multiple minimum components and maximum components, vertices of the surface point cloud are obtained.
[0033] In an optional implementation, the step of obtaining the minimum bounding box of each of the goods includes:
[0034] For each of the goods, construct a first rectangular edge based on two adjacent vertices in the surface point cloud of the goods, and construct a second rectangular edge perpendicular to the first rectangular edge;
[0035] Projecting each vertex in the surface point cloud toward the first rectangular edge and the second rectangular edge, respectively, to obtain the minimum and maximum projection points in the directions of the first rectangular edge and the second rectangular edge, respectively;
[0036] Constructing a rectangle based on the minimum and maximum projection points in the directions of the first rectangular side and the second rectangular side, and calculating the area of the rectangle;
[0037] A rectangle with the smallest area among multiple rectangles obtained by multiple groups of two adjacent vertices is determined as a minimum bounding box.
[0038] In a second aspect, the present invention provides a bounding box extraction device, the device comprising:
[0039] An acquisition module, used for acquiring two consecutive image frames acquired by a camera device, each of the image frames having at least one image information of a same cargo, the cargo being placed on a conveyor belt, and the conveyor belt moving a set distance within an acquisition interval of the two consecutive image frames;
[0040] An acquisition module, used to obtain the vertices of the surface point cloud of the goods in each of the image frames, and to obtain the minimum bounding box of each of the goods;
[0041] A detection module, for detecting a minimum bounding box having a corresponding relationship between two image frames based on the vertices and the minimum bounding box of the surface point cloud of the cargo in the two image frames;
[0042] The determination module is used to determine a target bounding box from the minimum bounding boxes with corresponding relationships.
[0043] In a third aspect, the present invention provides an electronic device comprising one or more storage media and one or more processors communicating with the storage media, wherein the one or more storage media store machine executable instructions executable by the processor, and when the electronic device is running, the processor executes the machine executable instructions to execute the method described in any one of the aforementioned embodiments.
[0044] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any one of the aforementioned embodiments.
[0045] The beneficial effects of the embodiments of the present invention include, for example:
[0046] The present invention provides a bounding box extraction method, device, electronic device and readable storage medium, which obtains two consecutive image frames captured by a camera device, each image frame has at least one image information of the same goods, the goods are placed on a conveyor belt, and the conveyor belt moves a set distance within the acquisition interval of two consecutive image frames. Then, the vertices of the surface point cloud of the goods in each image frame are obtained, and the minimum bounding box of each goods is obtained. Based on the vertices of the surface point cloud and the minimum bounding box in the two image frames, the minimum bounding box with a corresponding relationship in the two image frames is detected, and finally the target bounding box is determined from the minimum bounding box with a corresponding relationship. This scheme can ensure that the determined target bounding box is correct by detecting the minimum bounding box with a corresponding relationship in two consecutive image frames and then determining the target bounding box therefrom. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0048] Figure 1 This is a schematic diagram of the minimum bounding box authenticity;
[0049] Figure 2 (a) is one of the schematic diagrams of the minimum bounding box within the camera's field of view;
[0050] Figure 2 (b) is the second schematic diagram of the minimum bounding box within the camera's field of view;
[0051] Figure 3 A flow chart of the bounding box extraction method provided by the present invention;
[0052] Figure 4 A schematic diagram of a camera coordinate system constructed for the present invention;
[0053] Figure 5 for Figure 3 A flowchart of the sub-steps included in S2;
[0054] Figure 6 for Figure 3 Another flow chart of the sub-steps included in S2;
[0055] Figure 7 for Figure 3 A flowchart of the sub-steps included in S3;
[0056] Figure 8 for Figure 7 A flowchart of the sub-steps included in S31;
[0057] Fig. 9 is a schematic diagram of vertex authenticity;
[0058] Fig.10 for Figure 7 A flowchart of the sub-steps included in S32;
[0059] Fig.11 for Figure 3 Flowchart of the sub-steps contained in S4;
[0060] Fig.12 A functional module block diagram of the bounding box extraction device provided by the present invention;
[0061] Fig.13 This is a structural block diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0063] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0064] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0065] In the description of the present invention, it should be noted that the terms “first”, “second”, etc., if used, are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0066] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.
[0067] See also Figure 3, is a flow chart of a bounding box extraction method provided by an embodiment of the present invention, the bounding box extraction method can be executed by a bounding box extraction device, the bounding box extraction device can be implemented by software and / or hardware, and can be configured in an electronic device, the electronic device can be a computer device, a programmable logic controller, etc. The detailed steps of the bounding box extraction method are described as follows.
[0068] S1, obtaining two consecutive image frames captured by a camera device, each of the image frames having at least one image information of the same cargo.
[0069] The goods are placed on a conveyor belt, and the conveyor belt moves a set distance within the acquisition interval of two consecutive image frames.
[0070] S2, obtaining the vertices of the surface point cloud of the goods in each of the image frames, and obtaining the minimum bounding box of each of the goods.
[0071] S3, based on the vertices and the minimum bounding box of the surface point cloud of the cargo in the two image frames, detecting the minimum bounding box having a corresponding relationship in the two image frames.
[0072] S4, determining a target bounding box from the minimum bounding boxes with corresponding relationships.
[0073] In this embodiment, the electronic device can be connected to the camera device, and the connection can be made by wireless connection, wired connection, etc. Among them, the camera device can be a depth camera, and the camera device can be set above the conveyor belt, and its shooting direction is facing downward. The conveyor belt is within the camera field of view of the camera device. When goods are placed on the conveyor belt, the goods and the conveyor belt are within the camera field of view of the camera.
[0074] In actual application scenarios, after the conveyor belt is started, the goods placed on it are transported to pass under the camera device in sequence. The camera device captures an image every time the conveyor belt moves a set distance, that is, the conveyor belt moves the set distance within the interval between two consecutive image frames captured by the camera device.
[0075] In order to determine the real bounding box for each product, in this embodiment, two consecutive image frames captured by the camera device contain at least one image information of the same product, that is, each product appears at least twice within the camera field of view.
[0076] In this embodiment, the camera coordinate system is constructed with the center of the camera field of view of the camera device as the origin, such as Figure 4 As shown in , the direction of movement of the conveyor belt is the positive direction of the x-axis, and the y-axis is perpendicular to the direction of movement of the conveyor belt.
[0077] Generally, the length of the goods (the dimension along the x-axis) is less than or equal to L. Therefore, the length of the camera field of view of the camera device can be set to 2L. After the conveyor belt moves a distance of L, the camera device collects an image. In this way, it can be ensured that there is at least one image information of the same goods in two consecutive image frames, that is, each goods appears at least twice in the camera field of view.
[0078] On this basis, for each image frame in two consecutive image frames, a surface point cloud of the cargo in the image frame is obtained, and the vertices of the surface point cloud are obtained. The vertices of the surface point cloud of the cargo can be determined based on the position information of each point, or can be determined by other methods.
[0079] In addition, the minimum bounding box of each item is obtained, wherein the minimum bounding box refers to the minimum rectangle or cube that can completely surround the item. In this embodiment, the analysis is mainly performed on the surface of the item, so the minimum bounding box refers to the minimum rectangle that surrounds the item.
[0080] It can be seen from the above that there is at least one image information of the same cargo in two consecutive image frames. Therefore, based on the vertices and the minimum bounding box of the surface point cloud of the cargo in the two image frames, the minimum bounding box with a corresponding relationship in the two image frames can be determined. The minimum bounding box with a corresponding relationship is the minimum bounding box corresponding to the same cargo.
[0081] In order to provide the automated equipment with information for accurately grasping the goods, it is necessary to determine the target bounding box from the minimum bounding boxes with corresponding relationships. The target bounding box can be understood as the minimum bounding box that is true, and the other minimum bounding box can be understood as the minimum bounding box that is false. It can be seen that in this embodiment, the minimum bounding box that is true and the minimum bounding box that is false are essentially relative concepts, that is, the minimum bounding box that is more conducive to the automated equipment to accurately grasp the goods is true, and the other minimum bounding box with a corresponding relationship is false.
[0082] In this embodiment, after the target bounding box is determined, information of the target bounding box may be provided to the automation equipment, so that the automation equipment can grasp the corresponding goods based on the target bounding box and then perform palletizing.
[0083] In the bounding box extraction solution provided in this embodiment, two consecutive image frames are collected, and the conveyor belt moves a set distance during the interval between the two image frames, and the two image frames contain at least one image information of the same goods. On this basis, the minimum bounding box with a corresponding relationship in the two image frames is determined, so as to determine the target bounding box from the minimum bounding box with a corresponding relationship. This solution can ensure that the determined target bounding box is correct.
[0084] In this embodiment, after obtaining each image frame collected by the camera device, the image frame can be processed to obtain the vertices of the surface point cloud of the goods in the image frame. Figure 5 In this embodiment, this step can be implemented in the following way:
[0085] S21, for each of the image frames, obtaining a surface point cloud of the cargo in the image frame, and projecting the surface point cloud to a two-dimensional coordinate system, wherein the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis.
[0086] S22, obtaining the minimum component and the maximum component of the projected point cloud projected on the first coordinate axis and the second coordinate axis respectively.
[0087] S23, rotating the two-dimensional coordinate system, and obtaining the minimum component and the maximum component of the projected point cloud on the first coordinate axis and the second coordinate axis of the rotated two-dimensional coordinate system.
[0088] S24, obtaining vertices of the surface point cloud based on the obtained multiple minimum components and maximum components.
[0089] In this embodiment, the image frame obtained is a depth image, which is a grayscale image. The value of each pixel represents the distance from the pixel to the camera device. Using the depth value of each pixel in the depth image, the depth image can be converted into point cloud data. In this way, the surface point cloud of the goods in the image frame can be obtained. The surface point cloud refers to the point cloud of the top plane of the goods close to the camera device.
[0090] In actual scenes, the surface point cloud of the cargo may not be completely on a plane, but near a plane. In order to facilitate processing, the surface point cloud is projected onto the constructed two-dimensional coordinate system to obtain the projected point cloud.
[0091] The two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis, the first coordinate axis may be an x-axis, and the second coordinate axis may be a y-axis. In the two-dimensional coordinate system, each projection point has a coordinate value (x, y), wherein x represents the component of the projection point on the first coordinate axis, and y represents the component of the projection point on the second coordinate axis. Each projection point in the projected point cloud is projected onto the first coordinate axis and the second coordinate axis, respectively. In this way, there are multiple projected components on the first coordinate axis, and there are multiple projected components on the second coordinate axis. The minimum component and the maximum component with the minimum value and the maximum value on the first coordinate axis are obtained, and the minimum component and the maximum component with the minimum value and the maximum value on the second coordinate axis are obtained.
[0092] For the first coordinate axis, the minimum component and the maximum component on the first coordinate axis can be obtained, that is, the component of the projection point on the first coordinate axis can be obtained, but its component on the second coordinate axis is uncertain. Therefore, in this embodiment, the second coordinate axis can be moved to the position of the minimum component and the maximum component of the first coordinate axis, wherein the moving method is translation. And the maximum value and the minimum value on the second coordinate axis at this time are detected, so that the coordinate information of the projection points corresponding to the minimum component and the maximum component in the projection point cloud in the two-dimensional coordinate system can be obtained.
[0093] In addition, for the second coordinate axis, the coordinate information of the projection points corresponding to the minimum component and the maximum component on the second coordinate axis in the projection point cloud in the two-dimensional coordinate system can be determined in the same manner.
[0094] Through the above method, the coordinate information of the projection points corresponding to the two minimum components and the two maximum components in the projection point cloud can be obtained.
[0095] In order to determine more vertices, in this embodiment, the two-dimensional coordinate system can also be rotated, for example, it can be rotated 45 degrees clockwise or counterclockwise. Then, the same method as above is used to obtain the minimum component and the maximum component of the projected point cloud on the first coordinate axis and the second coordinate axis of the rotated two-dimensional coordinate system. And the coordinate information of the projection point corresponding to the minimum component and the maximum component in the projected point cloud is obtained.
[0096] In this embodiment, the number of rotations of the two-dimensional coordinate system may be once.
[0097] On this basis, multiple projection points corresponding to the projected point cloud can be obtained based on the obtained multiple minimum components and maximum components, and each of the projection points can be used as the vertices of the surface point cloud of the cargo. The vertices of the surface point cloud of the cargo can define the boundary range of the surface of the cargo.
[0098] In this embodiment, after determining the vertices of the surface point cloud of the goods, the minimum bounding box of each goods can be obtained. Figure 6 , which can be achieved through the following steps:
[0099] S25, for each of the goods, construct a first rectangular edge based on two adjacent vertices in the surface point cloud of the goods, and construct a second rectangular edge perpendicular to the first rectangular edge.
[0100] S26, projecting each vertex in the surface point cloud toward the first rectangular edge and the second rectangular edge, respectively, to obtain the minimum and maximum projection points in the directions of the first rectangular edge and the second rectangular edge, respectively.
[0101] S27, constructing a rectangle based on the minimum and maximum projection points in the directions of the first rectangular side and the second rectangular side, and calculating the area of the rectangle.
[0102] S28, determining a rectangle with the smallest area among multiple rectangles obtained by multiple groups of two adjacent vertices as a minimum bounding box.
[0103] In this embodiment, for each vertex in the surface point cloud of the cargo, the vertices may be sorted in a certain order, for example, in a counterclockwise direction. Furthermore, each vertex is marked as 0, 1, 2, ..., N-1 according to the order, where N is the number of vertices. For two adjacent vertices, for example, 01, or 12, etc., there is no limit. A first rectangular edge may be constructed based on the two adjacent vertices, and a second rectangular edge connected to the first rectangular edge may be constructed in a direction perpendicular to the first rectangular edge.
[0104] Each vertex in the surface vertices can be projected toward the first rectangular side and the second rectangular side, and then the minimum projection point and the maximum projection point on the first rectangular side are obtained, and the minimum projection point and the maximum projection point on the second rectangular side are obtained. In this way, a rectangle can be constructed based on four projection points.
[0105] For every two adjacent vertices in the surface point cloud, rectangle construction is performed in the above manner, so that multiple rectangles can be obtained. The area of the rectangle can be calculated based on the length and width of each rectangle. Among them, the rectangle with the smallest area can be determined as the minimum bounding box of the goods.
[0106] In this embodiment, the two image frames can be divided into a first image frame and a second image frame according to the order of acquisition time. Based on the above, the minimum bounding box with a corresponding relationship in the two image frames is detected, see Figure 7 , this step can be achieved by:
[0107] S31, screening out a minimum bounding box that meets a preset condition in the first image frame, and obtaining key vertices among vertices corresponding to the screened out minimum bounding box.
[0108] Among them, the moving direction of the conveyor belt is the x-axis direction of the camera coordinate system, the origin of the camera coordinate system is the center point of the camera field of view of the camera device, and the preset condition is that the x-coordinate value of the center point of the minimum bounding box is less than 0 and the minimum bounding box is not marked as the target bounding box.
[0109] S32, for each minimum bounding box in the second image frame, based on the position information of each vertex of the minimum bounding box and the position information of the key vertices of each minimum bounding box screened in the first image frame, determine the key vertices with corresponding relationship of the minimum bounding box, so as to obtain the minimum bounding boxes with corresponding relationship in the two image frames.
[0110] In this embodiment, the minimum bounding box whose center point x coordinate value is less than 0 is selected from the first image frame, and the minimum bounding box is in the left half of the camera field of view. When the conveyor belt moves L distance each time, the length of the camera field of view is 2L, and the maximum length of the minimum bounding box does not exceed L, this means that the minimum bounding box will also appear in the second image frame. In this way, it can be compared with the corresponding minimum bounding box in the second image frame later.
[0111] For the minimum bounding box in the first image frame whose center point's x-coordinate value is greater than or equal to 0, it indicates that the minimum bounding box has appeared in the previous image frame of the first image frame. In this case, the previous image frame can be considered as the first frame. In the subsequent detection, the second image frame is taken as the first image frame, and the image frame after the second image frame is taken as the second image frame for detection. At this time, the minimum bounding box of the second image frame in the right half of the camera's field of view has found a corresponding relationship in the first image frame, and at least one of the minimum bounding boxes with a corresponding relationship is true. Therefore, this minimum bounding box does not need to be considered, and the false minimum bounding box is the minimum bounding box that needs to further determine the corresponding relationship and make a true or false judgment. Therefore, in this embodiment, when screening in the first image frame, it can also be limited that the minimum bounding box is not marked as the target bounding box.
[0112] For the minimum bounding box that satisfies the preset condition and is screened out in the first image frame, a key vertex corresponding to the minimum bounding box is obtained. The key vertex is one of the vertices included in the surface point cloud.
[0113] See also Figure 8 In this embodiment, the step of obtaining the key vertices among the vertices corresponding to the minimum bounding box can be implemented in the following manner:
[0114] S311, for each of the screened minimum bounding boxes, obtain the x-coordinate value of each vertex corresponding to the minimum bounding box.
[0115] S312, sorting the vertices in ascending order of x-coordinate values.
[0116] S313, reversely traverse the sorted vertices to obtain the first vertex whose x coordinate value is less than 0 as the key vertex.
[0117] In this embodiment, the screened minimum bounding box can be marked as box_i, and the key vertex is actually the largest vertex among the vertices corresponding to the minimum bounding box whose x-coordinate value is less than 0. The purpose of determining the key vertex is to find the real vertex in the minimum bounding box, and the vertex will appear in the second image frame. In order to meet the requirement that the vertex will appear in the second image frame, the x-coordinate value of the vertex needs to be less than 0. Among them, the real vertex means that the generation of the vertex is not caused by the interception of the goods by the camera's field of view. Therefore, the key vertex is limited to the largest (that is, the rightmost) vertex among all vertices with an x-coordinate value less than 0. In this way, it can be guaranteed that the key vertex is a real vertex, that is, the key vertex is not caused by the interception of the goods by the camera's field of view. Fig. 9 A schematic diagram of real vertices and non-real vertices is shown in FIG.
[0118] In this embodiment, each vertex has a unique subscript, and after determining the key vertex, the subscript of the key vertex can be recorded in the array box_i.corner_index_. After filtering out the minimum bounding box that meets the preset conditions from the first image frame, the identifier box_i of the minimum bounding box is added to the array box_need_cmp, and box_need_cmp represents the minimum bounding box in the first image frame whose corresponding relationship needs to be determined.
[0119] After determining the key vertices of the minimum bounding box whose corresponding relationship needs to be determined in the first image frame, the minimum bounding boxes with corresponding relationships in the two frames can be detected based on the key vertices and the position information of the vertices of each minimum bounding box in the second image. Fig.10 , this step can be achieved by:
[0120] S321 , for each key vertex, based on each vertex corresponding to the minimum bounding box and the position information of each key vertex, determine a target vertex having a minimum distance to each key vertex.
[0121] S322: Determine the distance from the minimum bounding box to each key vertex based on the target vertex of the minimum bounding box.
[0122] S323: For each of the key vertices, detect a minimum bounding box having a minimum distance from the key vertex, and determine whether the key vertex having the minimum distance and the minimum bounding box have a corresponding relationship.
[0123] In this embodiment, the minimum bounding boxes in the second image frame can be sorted in ascending order based on the x-coordinate value of the center point of the minimum bounding box. A processed array is initialized, the size of which is consistent with the size of box_need_cmp, indicating whether the corresponding minimum bounding box has been processed.
[0124] Let i = 0, take the i-th minimum bounding box box_i in the second image frame, and let j = 0, take out the first j The minimum bounding box box_j is obtained. The position information of the key vertices of the minimum bounding box box_j is obtained. The sum is obtained by adding the position information of the key vertices to the set distance moved by the conveyor belt, such as L. Then the position information of each vertex in the minimum bounding box box_i is obtained. The difference is calculated by using the sum and the position information of each vertex. The calculated difference can be recorded in the array corner_dis_j.
[0125] The vertex corresponding to the minimum difference recorded in corner_dis_j is taken as the target vertex, and the minimum difference recorded in corner_dis_j is taken, and the minimum difference is recorded in the array corner_dis.
[0126] Then increase j until j exceeds the size of box_need_cmp. At this time, the minimum difference recorded in corner_dis represents the minimum distance from the i-th minimum bounding box to the key vertices of each minimum bounding box in box_need_cmp.
[0127] Take the minimum distance in corner_dis and determine whether the minimum distance is less than a preset value. If it is less than the preset value, it is determined that there is a corresponding relationship between the key vertex corresponding to the minimum distance and the minimum bounding box, that is, there is a corresponding relationship between the minimum bounding box corresponding to the key vertex in the first image frame and the minimum bounding box in the second image frame.
[0128] At this time, the position min_pos_cd of the minimum bounding box in the first image frame corresponding to the minimum distance in corner_dis can be obtained, and the minimum bounding box in the first image frame corresponding to box_need_cmp[min_pos_cd] is matched with box_i, and the corresponding relationship is recorded in the array box_i.id_pre_. In addition, processed[min_pos_cd] is set to 1, indicating that the corresponding relationship has been found for the minimum bounding box in the first image frame.
[0129] Then i is increased until i exceeds the number of the smallest bounding boxes in the second image frame.
[0130] After processing in the above manner, the correspondence between all the minimum bounding boxes in the first image frame and the second image frame can be determined. Since the minimum bounding box that appears in the first image frame will also appear in the second image frame, and the search is performed based on the key vertices, the corresponding relationship found is correct. Moreover, by traversing the x-coordinate value of the center point of the minimum bounding box in the second image frame from small to large, the corresponding minimum bounding boxes in the first image frame are also arranged in the order of x-coordinate value from small to large. And since each set of minimum bounding boxes with a corresponding relationship is marked, there will be no problem of repeated search.
[0131] In this embodiment, after the minimum bounding boxes with a corresponding relationship in the first image frame and the second image frame are determined, the target bounding box is determined from the minimum bounding boxes with a corresponding relationship. Fig.11 In this embodiment, this step can be implemented in the following way:
[0132] S41, calculating the area of each minimum bounding box of two corresponding minimum bounding boxes.
[0133] S42: Determine the smallest bounding box with a larger area among the two corresponding smallest bounding boxes as the target bounding box.
[0134] Taking the above as an example, after determining the minimum bounding box with a corresponding relationship in the first image frame and the second image frame, the minimum bounding box in the second image frame can be traversed, and the i-th second bounding box is set as box_i, and it is determined whether box_i.id_pre_ is greater than or equal to 0. If it is greater than or equal to 0, it indicates that box_i has the corresponding minimum bounding box in the first image frame, recorded as box_j. According to the length and width of box_i, the area of box_i is calculated. In addition, according to the length and width of box_j, the area of box_j is calculated. The minimum bounding box corresponding to the larger area of the two is the target bounding box, that is, the real bounding box.
[0135] Based on the same inventive concept, please refer to Fig.12 , shows a schematic diagram of the functional modules of the bounding box extraction device provided in an embodiment of the present invention. This embodiment can divide the functional modules of the bounding box extraction device according to the above method embodiment. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present invention is schematic, which is only a logical functional division, and there may be other division methods in actual implementation.
[0136] For example, when each functional module is divided into corresponding functional modules, Fig.12 The bounding box extraction device shown is only a schematic diagram of the device. The bounding box extraction device may include an acquisition module, an acquisition module, a detection module and a determination module. The functions of each functional module of the bounding box extraction device are described in detail below.
[0137] An acquisition module, used for acquiring two consecutive image frames acquired by a camera device, each of the image frames having at least one image information of a same cargo, the cargo being placed on a conveyor belt, and the conveyor belt moving a set distance within an acquisition interval of the two consecutive image frames;
[0138] It can be understood that the acquisition module can be used to execute the above S1. For the detailed implementation of the acquisition module, reference can be made to the relevant content of the above S1.
[0139] An acquisition module, used to obtain the vertices of the surface point cloud of the goods in each of the image frames, and to obtain the minimum bounding box of each of the goods;
[0140] It can be understood that the acquisition module can be used to execute the above S2. For the detailed implementation of the acquisition module, reference can be made to the relevant content of the above S2.
[0141] A detection module, for detecting a minimum bounding box having a corresponding relationship between two image frames based on the vertices and the minimum bounding box of the surface point cloud of the cargo in the two image frames;
[0142] It can be understood that the detection module can be used to execute the above S3. The detailed implementation of the detection module can refer to the relevant content of the above S3.
[0143] The determination module is used to determine a target bounding box from the minimum bounding boxes with corresponding relationships.
[0144] It can be understood that the determination module can be used to execute the above S4. The detailed implementation of the determination module can refer to the relevant content of the above S4.
[0145] In a possible implementation, the two image frames include a first image frame and a second image frame arranged in chronological order of acquisition time, and the detection module may be used to:
[0146] Screening out a minimum bounding box that meets a preset condition in the first image frame, and obtaining a key vertex among vertices corresponding to the screened minimum bounding box;
[0147] The moving direction of the conveyor belt is the x-axis direction of the camera coordinate system, the origin of the camera coordinate system is the center point of the camera field of view of the camera device, and the preset condition is that the x-coordinate value of the center point of the minimum bounding box is less than 0 and the minimum bounding box is not marked as a target bounding box;
[0148] For each minimum bounding box in the second image frame, based on the position information of each vertex of the minimum bounding box and the position information of the key vertices of each minimum bounding box screened in the first image frame, the key vertices with a corresponding relationship of the minimum bounding box are determined to obtain the minimum bounding boxes with a corresponding relationship in the two image frames.
[0149] In a possible implementation, the detection module may be used to:
[0150] For each key vertex, based on each vertex corresponding to the minimum bounding box and the position information of each key vertex, determine the target vertex with the minimum distance to each key vertex;
[0151] Determine the distance from the minimum bounding box to each key vertex based on the target vertex of the minimum bounding box;
[0152] For each of the key vertices, a minimum bounding box having a minimum distance from the key vertex is detected, and it is determined that the key vertex having the minimum distance and the minimum bounding box have a corresponding relationship.
[0153] In a possible implementation, the detection module may be used to:
[0154] For each of the selected minimum bounding boxes, obtain the x-coordinate value of each vertex corresponding to the minimum bounding box;
[0155] Sort the vertices in ascending order of x-coordinate values;
[0156] Traverse the sorted vertices in reverse order and obtain the first vertex whose x coordinate value is less than 0 as the key vertex.
[0157] In a possible implementation, the above-mentioned determination module may be used to:
[0158] Calculate the area of each minimum bounding box of two corresponding minimum bounding boxes;
[0159] The minimum bounding box with a larger area among the two corresponding minimum bounding boxes is determined as the target bounding box.
[0160] In a possible implementation, the above-mentioned obtaining module may be used to:
[0161] For each of the image frames, obtaining a surface point cloud of the cargo in the image frame, and projecting the surface point cloud into a two-dimensional coordinate system, wherein the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis;
[0162] Obtaining the minimum component and the maximum component of the projected point cloud projected on the first coordinate axis and the second coordinate axis respectively;
[0163] Rotating the two-dimensional coordinate system, and obtaining the minimum component and the maximum component of the projected point cloud on the first coordinate axis and the second coordinate axis of the rotated two-dimensional coordinate system;
[0164] Based on the obtained multiple minimum components and maximum components, vertices of the surface point cloud are obtained.
[0165] In a possible implementation, the above-mentioned obtaining module may be used to:
[0166] For each of the goods, construct a first rectangular edge based on two adjacent vertices in the surface point cloud of the goods, and construct a second rectangular edge perpendicular to the first rectangular edge;
[0167] Projecting each vertex in the surface point cloud toward the first rectangular edge and the second rectangular edge, respectively, to obtain the minimum and maximum projection points in the directions of the first rectangular edge and the second rectangular edge, respectively;
[0168] Constructing a rectangle based on the minimum and maximum projection points in the directions of the first rectangular side and the second rectangular side, and calculating the area of the rectangle;
[0169] A rectangle with the smallest area among multiple rectangles obtained by multiple groups of two adjacent vertices is determined as a minimum bounding box.
[0170] See also Fig.13 , is a block diagram of an electronic device provided in an embodiment of the present invention, the electronic device may be a computer device, etc., and the electronic device includes a memory, a processor, and a communication module. The memory, the processor, and the communication module are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines.
[0171] The memory is used to store programs or data. The memory can be, but is not limited to, random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electric erasable programmable read-only memory (EEPROM), etc.
[0172] The processor is used to read / write data or programs stored in the memory, and execute the bounding box extraction method provided by any embodiment of the present invention.
[0173] The communication module is used to establish a communication connection between the electronic device and other communication terminals through the network, and is used to send and receive data through the network.
[0174] It should be understood that Fig.13 The structure shown is only a schematic diagram of the structure of the electronic device. The electronic device may also include Fig.13 More or fewer components as shown, or with Fig.13 Different configurations are shown.
[0175] Furthermore, an embodiment of the present invention also provides a computer-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are executed, the bounding box extraction method provided in the above embodiment is implemented.
[0176] Specifically, the computer-readable storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc. When the computer program on the computer-readable storage medium is executed, the above-mentioned bounding box extraction method can be executed. Regarding the process involved when the computer-readable storage medium and its executable instructions are executed, reference can be made to the relevant description in the above-mentioned method embodiment, which will not be described in detail here.
[0177] In summary, the bounding box extraction method, device, electronic device and readable storage medium provided by the embodiments of the present invention obtain two consecutive image frames captured by a camera device, each image frame has at least one image information of the same goods, the goods are placed on a conveyor belt, and the conveyor belt moves a set distance within the acquisition interval of two consecutive image frames. Then, the vertices of the surface point cloud of the goods in each image frame are obtained, and the minimum bounding box of each goods is obtained. Based on the vertices and the minimum bounding box of the surface point cloud in the two image frames, the minimum bounding box with a corresponding relationship in the two image frames is detected, and finally the target bounding box is determined from the minimum bounding box with a corresponding relationship. This scheme can ensure that the determined target bounding box is correct by detecting the minimum bounding box with a corresponding relationship in two consecutive image frames and then determining the target bounding box therefrom.
[0178] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A bounding box extraction method, characterized in that: The method comprises: Acquire two consecutive image frames captured by a camera device, each of the image frames having at least one image information of the same goods, the goods being placed on a conveyor belt, and the conveyor belt moving a set distance within a capture interval of the two consecutive image frames; Obtaining vertices of the surface point cloud of the goods in each of the image frames, and obtaining a minimum bounding box of each of the goods; Based on the vertices and minimum bounding boxes of the surface point clouds of the goods in the two image frames, the minimum bounding boxes with corresponding relationships in the two image frames are detected; Determine the target bounding box from the minimum bounding boxes with corresponding relationships; The step of determining the target bounding box from the minimum bounding boxes having the corresponding relationship comprises: The area of each minimum bounding box of two corresponding minimum bounding boxes is calculated; and the minimum bounding box with a larger area of the two corresponding minimum bounding boxes is determined as the target bounding box.
2. The bounding box extraction method according to claim 1, characterized in that: The two image frames include a first image frame and a second image frame arranged in chronological order of acquisition time; The step of detecting the minimum bounding box having a corresponding relationship between the two image frames based on the vertices and the minimum bounding box of the surface point cloud of the goods in the two image frames comprises: Screening out a minimum bounding box that meets a preset condition in the first image frame, and obtaining a key vertex among vertices corresponding to the screened minimum bounding box; The moving direction of the conveyor belt is the x-axis direction of the camera coordinate system, the origin of the camera coordinate system is the center point of the camera field of view of the camera device, and the preset condition is that the x-coordinate value of the center point of the minimum bounding box is less than 0 and the minimum bounding box is not marked as a target bounding box; For each minimum bounding box in the second image frame, based on the position information of each vertex of the minimum bounding box and the position information of the key vertices of each minimum bounding box screened in the first image frame, the key vertices with a corresponding relationship of the minimum bounding box are determined to obtain the minimum bounding boxes with a corresponding relationship in the two image frames.
3. The bounding box extraction method according to claim 2, characterized in that: The step of determining the key vertices having a corresponding relationship with the minimum bounding box based on the position information of each vertex of the minimum bounding box and the position information of the key vertices of each minimum bounding box screened in the first image frame comprises: For each key vertex, based on each vertex corresponding to the minimum bounding box and the position information of each key vertex, determine the target vertex with the minimum distance to each key vertex; Determine the distance from the minimum bounding box to each key vertex based on the target vertex of the minimum bounding box; For each of the key vertices, a minimum bounding box having a minimum distance from the key vertex is detected, and it is determined that the key vertex having the minimum distance and the minimum bounding box have a corresponding relationship.
4. The bounding box extraction method according to claim 2, characterized in that: The step of obtaining key vertices among the vertices corresponding to the screened minimum bounding box comprises: For each of the selected minimum bounding boxes, obtain the x-coordinate value of each vertex corresponding to the minimum bounding box; Sort the vertices in ascending order of x-coordinate values; Traverse the sorted vertices in reverse order and obtain the first vertex whose x coordinate value is less than 0 as the key vertex.
5. The bounding box extraction method according to claim 1, characterized in that: The step of obtaining the vertices of the surface point cloud of the cargo in each of the image frames comprises: For each of the image frames, obtaining a surface point cloud of the cargo in the image frame, and projecting the surface point cloud into a two-dimensional coordinate system, wherein the two-dimensional coordinate system includes a first coordinate axis and a second coordinate axis; Obtaining the minimum component and the maximum component of the projected point cloud projected on the first coordinate axis and the second coordinate axis respectively; Rotating the two-dimensional coordinate system, and obtaining the minimum component and the maximum component of the projected point cloud on the first coordinate axis and the second coordinate axis of the rotated two-dimensional coordinate system; Based on the obtained multiple minimum components and maximum components, vertices of the surface point cloud are obtained.
6. The bounding box extraction method according to claim 1, characterized in that: The step of obtaining the minimum bounding box of each of the goods comprises: For each of the goods, construct a first rectangular edge based on two adjacent vertices in the surface point cloud of the goods, and construct a second rectangular edge perpendicular to the first rectangular edge; Projecting each vertex in the surface point cloud toward the first rectangular edge and the second rectangular edge, respectively, to obtain the minimum and maximum projection points in the directions of the first rectangular edge and the second rectangular edge, respectively; Constructing a rectangle based on the minimum and maximum projection points in the directions of the first rectangular side and the second rectangular side, and calculating the area of the rectangle; A rectangle with the smallest area among multiple rectangles obtained by multiple groups of two adjacent vertices is determined as a minimum bounding box.
7. A bounding box extraction device, characterized in that: Used to implement the bounding box extraction method according to any one of claims 1 to 6, the device comprises: An acquisition module, used for acquiring two consecutive image frames acquired by a camera device, each of the image frames having at least one image information of a same cargo, the cargo being placed on a conveyor belt, and the conveyor belt moving a set distance within an acquisition interval of the two consecutive image frames; An acquisition module, used to obtain the vertices of the surface point cloud of the goods in each of the image frames, and to obtain the minimum bounding box of each of the goods; A detection module, for detecting a minimum bounding box having a corresponding relationship between two image frames based on the vertices and the minimum bounding box of the surface point cloud of the cargo in the two image frames; The determination module is used to determine a target bounding box from the minimum bounding boxes with corresponding relationships.
8. An electronic device, characterized in that: The electronic device comprises one or more storage media and one or more processors communicating with the storage media, wherein the one or more storage media store machine executable instructions executable by the processors, and when the electronic device is running, the processor executes the machine executable instructions to execute the method described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Automatic sorting system for household refuse
CN106000904A
Object size detection method, object size detection device and mobile terminal
CN110276317A
Object volume calculation method, device and equipment and storage medium
CN112150533A
Method and device for constructing three-dimensional model of target object
CN113450459A
Target detection method and device based on directed bounding box, and electronic equipment
CN117994561A
