Box volume measurement method, device, computer equipment and storage medium

Through depth image processing and three-dimensional point cloud data analysis, the data is automatically filtered and rotated to calculate the cabinet volume, which solves the problem of low efficiency of cabinet volume measurement in the existing technology and achieves fast and accurate automated measurement.

CN112991428BActive Publication Date: 2024-09-27SF TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911212542.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-02
Publication Date
2024-09-27
Estimated Expiration
2039-12-02

AI Technical Summary

Technical Problem

The existing box volume measurement method has low efficiency, cumbersome steps, and poor timeliness, making it difficult to meet the needs of rapid verification and automation.

Method used

By acquiring the depth image of the target box, perform 3D point cloud data processing, detect candidate planes, classify plane clusters, filter the top surface and main plane of the box, and rotate the 3D point cloud data to automatically calculate the box volume.

Benefits of technology

It achieves rapid and automatic measurement of the box volume, reduces manual participation, and improves measurement efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112991428B
    Figure CN112991428B
Patent Text Reader

Abstract

The present application relates to a box volume measurement method, device, computer equipment and storage medium. The method includes: obtaining a depth image corresponding to a target box; performing plane detection based on the three-dimensional point cloud data corresponding to the depth image to obtain candidate planes corresponding to the depth image; classifying the candidate planes to obtain multiple plane clusters; screening the top surface and the main plane of the box based on the plane feature data of each candidate plane in the plane cluster with the largest number of planes; rotating the three-dimensional point cloud data based on the plane feature data of the top surface of the box; determining the box volume of the target box based on the top surface of the box, the main plane and the rotated three-dimensional point cloud data. The use of this method can improve the efficiency of box volume measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of measurement technology, and in particular to a box volume measurement method, device, computer equipment and storage medium. Background Art

[0002] In industries such as logistics, e-commerce, express delivery, and manufacturing, as well as in daily life, there is a need to measure the volume of boxes, so as to verify the compliance of the target box based on the box volume, determine the freight of the target box, formulate transportation or storage tasks, etc. Therefore, how to measure the box volume is a problem worthy of attention.

[0003] At present, the commonly used box volume measurement methods mainly include manual measurement with a tape measure, or measurement based on a reference label attached to the surface of the target box. However, the existing box volume measurement methods have the problems of cumbersome measurement steps and poor timeliness, resulting in low box volume measurement efficiency. Summary of the invention

[0004] Based on this, it is necessary to provide a box volume measurement method, device, computer equipment and storage medium that can improve the efficiency of box volume measurement in response to the above technical problems.

[0005] A method for measuring box volume, the method comprising:

[0006] Obtain a depth image corresponding to the target box;

[0007] Performing plane detection based on the three-dimensional point cloud data corresponding to the depth image to obtain a candidate plane corresponding to the depth image;

[0008] Classifying the candidate planes to obtain multiple plane clusters;

[0009] The top surface and the main plane of the box are selected according to the plane feature data of each candidate plane in the plane cluster with the largest number of planes;

[0010] Rotating the three-dimensional point cloud data based on the plane feature data of the top surface of the box;

[0011] The box volume of the target box is determined according to the box top surface, the main plane and the rotated three-dimensional point cloud data.

[0012] In one embodiment, the classifying the candidate planes to obtain a plurality of plane clusters includes:

[0013] Determine the plane normal vector of each candidate plane;

[0014] According to the plane normal vectors, the mutually parallel candidate planes are classified into the same plane cluster to obtain a plurality of plane clusters.

[0015] In one embodiment, the step of screening the top surface of the box and the main plane according to the plane feature data of each candidate plane in the plane cluster with the largest number of planes includes:

[0016] Selecting a plane cluster with the largest number of planes from the plurality of plane clusters;

[0017] Determine plane feature data of each candidate plane in the screened plane cluster; the plane feature data includes the distance between the origin and the corresponding candidate plane, the plane area, and the center distance between the plane image corresponding to the corresponding candidate plane and the depth image;

[0018] The candidate plane whose corresponding plane feature data meets the box top surface screening condition is determined as the box top surface, and the candidate plane whose corresponding plane feature data meets the main plane screening condition is determined as the main plane.

[0019] In one embodiment, rotating the three-dimensional point cloud data based on the plane feature data of the top surface of the box includes:

[0020] Determine the normal angle between the plane normal line of the top surface of the box and the vertical axis according to the plane feature data of the top surface of the box;

[0021] Determine a rotation matrix corresponding to the three-dimensional point cloud data according to the normal angle;

[0022] The three-dimensional point cloud data is rotated according to the rotation matrix.

[0023] In one of the embodiments, performing plane detection based on the three-dimensional point cloud data corresponding to the depth data to obtain a candidate plane corresponding to the depth image includes:

[0024] gridding the depth image;

[0025] Convert the two-dimensional pixel points in each grid into three-dimensional coordinate points according to the corresponding depth data to obtain the corresponding grid point cloud;

[0026] Filter the grid point clouds constituting the point cloud plane according to the three-dimensional coordinate points in each grid point cloud;

[0027] Cluster the screened grid point cloud to obtain a clustering plane;

[0028] The three-dimensional coordinate points that have not been clustered are clustered with the clustering plane to obtain a candidate plane corresponding to the depth image.

[0029] In one embodiment, the step of screening the grid point clouds constituting the point cloud plane according to the three-dimensional coordinate points in each grid point cloud comprises:

[0030] Construct the corresponding covariance matrix based on the three-dimensional coordinate points in each grid point cloud;

[0031] Determine the plane normal vector corresponding to the corresponding grid point cloud according to the covariance matrix;

[0032] Determine the plane equation of the corresponding grid point cloud according to the three-dimensional coordinate points in each grid point cloud and the corresponding plane normal vector;

[0033] According to the distance from the three-dimensional coordinate point in each grid point cloud to the corresponding plane equation, the grid point clouds constituting the point cloud plane are screened.

[0034] In one embodiment, determining the volume of the target box according to the top surface of the box, the main plane and the rotated three-dimensional point cloud data includes:

[0035] Determine the length and width according to the three-dimensional coordinate points corresponding to the top surface of the box in the rotated three-dimensional point cloud data;

[0036] Determine a first height according to the three-dimensional coordinate points corresponding to the top surface of the box and the main plane in the rotated three-dimensional point cloud data;

[0037] Determine a side surface of the box body according to the top surface of the box body, and determine a second height according to the side surface of the box body;

[0038] The height of the target box is determined according to the first height and the second height, and the box volume of the target box is determined according to the height, the length and the width.

[0039] A box volume measuring device, comprising:

[0040] An acquisition module, used to acquire a depth image corresponding to a target box;

[0041] A detection module, configured to perform plane detection based on the three-dimensional point cloud data corresponding to the depth image, and obtain a candidate plane corresponding to the depth image;

[0042] A classification module, used for classifying the candidate planes to obtain a plurality of plane clusters;

[0043] A screening module, used for screening the top surface and the main plane of the box according to the plane feature data of each candidate plane in the plane cluster with the largest number of planes;

[0044] A rotation module, used for rotating the three-dimensional point cloud data based on the plane feature data of the top surface of the box;

[0045] A determination module is used to determine the box volume of the target box according to the top surface of the box, the main plane and the rotated three-dimensional point cloud data.

[0046] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the box volume measurement method described in the above embodiments when executing the computer program.

[0047] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the box volume measurement method described in each of the above embodiments.

[0048] The above-mentioned box volume measurement method, device, computer equipment and storage medium obtain a depth image corresponding to the target box, perform plane detection in the three-dimensional scene according to the three-dimensional point cloud data corresponding to the depth image, obtain multiple candidate planes corresponding to the depth image, classify the multiple candidate planes into multiple plane clusters, and automatically screen the box top surface and the main plane from the plane cluster with the largest number of planes according to the plane feature data, and rotate the three-dimensional point cloud data according to the box top surface, and then automatically determine the box volume of the target box based on the screened box top surface, main plane and rotated three-dimensional point cloud data, so as to realize automatic measurement of the box volume without excessive human participation, reduce the measurement complexity, and thus improve the measurement efficiency of the box volume. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 This is an application scenario diagram of a box volume measurement method in an embodiment;

[0050] Figure 2 A schematic diagram of a process of measuring a box volume in one embodiment;

[0051] Figure 3 A schematic diagram of a process of measuring a box volume in another embodiment;

[0052] Figure 4 is a structural block diagram of a box volume measuring device in one embodiment;

[0053] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0055] The box volume measurement method provided in this application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the image acquisition device 104 through the network. The terminal 102 obtains a depth image carrying the depth data of the target box, performs plane detection based on the three-dimensional point cloud data corresponding to the depth data to obtain a candidate plane corresponding to the two-dimensional plane, classifies the candidate plane into multiple plane clusters, and selects the top surface and the main plane of the box from the plane cluster with the largest number of planes according to the plane feature data, and rotates the three-dimensional point cloud data according to the plane feature data of the top surface of the box, and then determines the box volume of the target box according to the selected top surface of the box, the main plane and the rotated three-dimensional point cloud data. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the image acquisition device 104 is a device that can be used to collect depth images carrying depth data, such as a depth camera, which is not specifically limited here.

[0056] In one embodiment, the image acquisition device 104 may be a device that exists independently of the terminal 102 , or may be a device that is a component of the terminal 102 and is built into the terminal 102 .

[0057] In one embodiment, Figure 2 As shown, a box volume measurement method is provided, which is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:

[0058] S202, acquiring a depth image corresponding to the target box.

[0059] Among them, the target box is the box whose volume is to be measured, which can be a regular box, such as a box in the shape of a cuboid or a cube. A depth image is a two-dimensional image that carries depth data. Each two-dimensional pixel in the depth image corresponds to depth data, and the depth data of the two-dimensional pixel includes the pixel coordinates and pixel value of the two-dimensional pixel in the depth image. The pixel value is the grayscale value corresponding to the two-dimensional pixel, which can be used to characterize the distance between the entity point corresponding to the two-dimensional pixel in the entity scene and the origin.

[0060] Specifically, when the volume measurement trigger condition is met, the terminal obtains a depth image corresponding to the target box and carrying depth data. The volume measurement trigger condition may be, for example, receiving a depth image carrying depth data pushed by an image acquisition device, or detecting a volume measurement trigger operation.

[0061] In one embodiment, when a volume measurement trigger operation is detected, the terminal triggers a corresponding volume measurement instruction, and acquires a depth image corresponding to the target box and carrying depth data from the image acquisition device according to the triggered volume measurement instruction. Taking the image acquisition device as a depth camera as an example, the depth camera shoots the target box according to the volume measurement instruction, obtains a depth image carrying the depth data of the target box, and feeds it back to the terminal.

[0062] In one embodiment, the image acquisition device acquires a depth image corresponding to the target box from the top to the bottom. Taking the image acquisition device as a depth camera as an example, the depth camera shoots the target box from the top to the bottom to obtain the corresponding depth image.

[0063] In one embodiment, the image acquisition device acquires a depth image corresponding to the target box from the side of the target box. When the depth image of the target box is acquired from the side, the acquired depth image at least includes depth data corresponding to one or more entity points in any three box surfaces of the target box.

[0064] S204, performing plane detection based on the three-dimensional point cloud data corresponding to the depth image to obtain a candidate plane corresponding to the depth image.

[0065] Specifically, after acquiring the depth image corresponding to the target box, the terminal converts the corresponding two-dimensional pixel points into three-dimensional coordinate points according to the depth data corresponding to each two-dimensional pixel point in the depth image, and obtains the three-dimensional point cloud data corresponding to the depth image according to the converted three-dimensional coordinate points. The terminal performs plane detection in the three-dimensional scene according to the three-dimensional coordinates corresponding to each three-dimensional coordinate point in the three-dimensional point cloud data, clusters the three-dimensional coordinate points in the three-dimensional point cloud data into multiple candidate planes, and determines the multiple candidate planes as the candidate planes corresponding to the depth image in the three-dimensional scene.

[0066] In one embodiment, the terminal performs plane detection in a three-dimensional scene based on three-dimensional point cloud data to implement segmentation of the main plane, the top surface of the box and the side surface of the box in the three-dimensional scene, and obtains multiple candidate planes including the main plane, the top surface of the box and the side surface of the box.

[0067] In one embodiment, the main plane segmented by the terminal from the three-dimensional scene is the background plane when collecting the depth image of the target box. For example, if the depth image of the target box placed on the ground is collected, the main plane is the ground; if the depth image of the target box placed on the desktop is collected, the main plane is the desktop.

[0068] S206, classifying the candidate planes to obtain a plurality of plane clusters.

[0069] A plane cluster is a plane set consisting of at least one candidate plane. Multiple candidate planes in each plane cluster are parallel to each other.

[0070] Specifically, after obtaining a plurality of candidate planes corresponding to the depth image, the terminal classifies the candidate planes that are parallel to each other into the same plane cluster to obtain a plurality of plane clusters corresponding to the depth image.

[0071] In one embodiment, the terminal determines whether the two candidate planes are parallel based on the plane equations or plane normal vectors corresponding to the two candidate planes. If they are determined to be parallel to each other, the two candidate planes are classified into the same plane cluster; otherwise, the above determination operation is continued for each of the two candidate planes to classify the candidate planes into corresponding plane clusters.

[0072] S208, screening the top surface of the box and the main plane according to the plane feature data of each candidate plane in the plane cluster with the largest number of planes.

[0073] Specifically, after the terminal classifies and obtains multiple plane clusters corresponding to the depth image, it counts the number of planes in each plane cluster, and compares the counted number of planes to select the plane cluster with the largest number of planes from the multiple plane clusters. The terminal determines the plane feature data corresponding to each candidate plane in the plane cluster with the largest number of planes, and selects the top surface and the main plane of the box from the plane cluster with the largest number of planes according to the determined plane feature data.

[0074] In one embodiment, the plane feature data is feature data corresponding to the candidate plane, specifically feature data determined by each three-dimensional coordinate point in the candidate plane. The plane feature data may include the distance between the origin and the corresponding candidate plane, the plane area, the center distance between the plane image corresponding to the corresponding candidate plane and the depth image, etc.

[0075] In one embodiment, after the terminal obtains multiple plane clusters through classification, it selects the plane cluster with the largest number of planes and the plane cluster with the second largest number of planes from the multiple plane clusters, and selects the top surface of the box and the main plane according to the plane feature data of each candidate plane in the selected plane clusters. Specifically, the terminal first selects the top surface of the box and the main plane according to the plane feature data of each candidate plane in the plane cluster with the largest number of planes. When the top surface of the box and / or the main plane are not selected from the plane cluster with the largest number of planes, the terminal selects the top surface of the box and / or the main plane that have not been selected according to the plane feature data of each candidate plane in the plane cluster with the second largest number of planes.

[0076] S210, rotating the three-dimensional point cloud data based on the plane feature data of the top surface of the box.

[0077] Specifically, the terminal determines the plane feature data of the top surface of the box, determines the rotation matrix corresponding to the three-dimensional point cloud data according to the plane feature data, and rotates the three-dimensional point cloud data according to the determined rotation matrix to obtain the rotated three-dimensional point cloud data.

[0078] In one embodiment, the rotation matrix specifies the coordinate conversion relationship between each three-dimensional coordinate point in the three-dimensional point cloud data before rotation and the corresponding three-dimensional coordinate point in the three-dimensional point cloud data after rotation. After determining the rotation matrix corresponding to the three-dimensional point cloud data, the terminal performs coordinate conversion on the three-dimensional coordinates of each three-dimensional coordinate point in the three-dimensional point cloud data according to the rotation matrix, and determines the three-dimensional point cloud data after rotation based on the three-dimensional coordinate points obtained by the conversion.

[0079] S212, determining the volume of the target box according to the box top surface, the main plane and the rotated three-dimensional point cloud data.

[0080] Specifically, the terminal determines the three-dimensional coordinate points corresponding to the top surface of the selected box and the main plane in the rotated three-dimensional point cloud data, determines the length and width of the target box according to the three-dimensional coordinate points corresponding to the top surface of the box, and determines the height of the target box according to the three-dimensional coordinate points corresponding to the top surface of the box and the main plane. The terminal calculates the box volume of the target box according to the box volume calculation relationship based on the length, width and height corresponding to the target box. For example, the box volume calculation relationship is: target box volume = length * width * height.

[0081] In one embodiment, after the terminal determines the multiple three-dimensional coordinate points corresponding to the top surface of the box in the three-dimensional point cloud data after rotation, the terminal calls the preset peripheral frame detection function to detect the peripheral frame including the multiple three-dimensional coordinate points, and determines the length and width of the target box according to the detected peripheral frame. The preset peripheral frame detection function can be a function based on opencv (OpenSource Computer Vision Library, an open source computer vision library). The minimum peripheral frame including the multiple three-dimensional coordinate points corresponding to the top surface of the box can be detected by the peripheral frame detection function, and the minimum peripheral frame is the top surface of the box corresponding to the target box in the three-dimensional scene. The minimum peripheral frame refers to the minimum rectangular frame including the multiple three-dimensional coordinate points. If there are noise points in the multiple three-dimensional coordinate points corresponding to the top surface of the box, the peripheral frame detection function can detect the peripheral frame after removing the noise points, which can improve the accuracy of the length and width. It can be understood that the multiple three-dimensional coordinate points corresponding to the top surface of the box in the three-dimensional point cloud data after rotation constitute a matrix. If there are one or more isolated three-dimensional coordinate points different from the matrix, the one or more independent three-dimensional coordinate points are noise points.

[0082] In one embodiment, the terminal calculates the plane distance between the top surface of the box and the main plane according to the three-dimensional coordinate points corresponding to each other in the rotated three-dimensional point cloud data, and determines the plane distance as the height of the target box.

[0083] In one embodiment, in the rotated three-dimensional point cloud data, the coordinate values ​​of the multiple three-dimensional coordinate points corresponding to the top surface of the box in the Z-axis direction are consistent, that is, the coordinate values ​​of the multiple three-dimensional coordinate points in the X-axis and Y-axis directions constitute a two-dimensional plane. The minimum outer frame corresponding to the top surface of the box is detected in the two-dimensional plane by a preset outer frame detection function.

[0084] The above-mentioned box volume measurement method obtains a depth image corresponding to the target box, performs plane detection in the three-dimensional scene according to the three-dimensional point cloud data corresponding to the depth image, obtains multiple candidate planes corresponding to the depth image, classifies the multiple candidate planes into multiple plane clusters, and automatically screens the box top surface and the main plane from the plane cluster with the largest number of planes according to the plane feature data, and rotates the three-dimensional point cloud data according to the box top surface, and then automatically determines the box volume of the target box based on the screened box top surface, the main plane and the rotated three-dimensional point cloud data, so as to realize automatic measurement of the box volume, without excessive human participation, reducing the measurement complexity, and thus improving the measurement efficiency of the box volume.

[0085] In one embodiment, step S206 includes: determining a plane normal vector of each candidate plane; and classifying mutually parallel candidate planes into the same plane cluster according to the plane normal vectors to obtain a plurality of plane clusters.

[0086] Specifically, after obtaining multiple candidate planes corresponding to the depth image, the terminal determines the plane normal vector of each candidate plane respectively, compares the plane normal vectors of each candidate plane, determines two candidate planes whose plane normal vectors are parallel to each other as mutually parallel candidate planes, and classifies the two mutually parallel candidate planes into the same plane cluster to obtain multiple plane clusters corresponding to the depth image.

[0087] In one embodiment, the terminal determines a plane normal vector corresponding to each candidate plane according to the three-dimensional coordinates corresponding to each three-dimensional coordinate point in the candidate plane.

[0088] In one embodiment, the terminal selects any candidate plane from multiple candidate planes as a reference plane, traverses the multiple candidate planes, and determines whether the traversed candidate planes are parallel to the reference plane, and classifies the candidate planes that are determined to be parallel to each other into the plane cluster corresponding to the reference plane until the multiple candidate planes are traversed. The terminal selects any candidate plane from multiple candidate planes that have not been classified into the plane cluster as the reference plane, and performs the above classification operation based on the selected reference plane until the multiple candidate planes are classified into the corresponding plane cluster.

[0089] In the above embodiment, the candidate planes are clustered based on the plane normal vector of each candidate plane, and the subsequent box volume measurement operation is automatically performed based on the plane clusters obtained by clustering, which can improve the accuracy and efficiency of volume measurement.

[0090] In one embodiment, step S208 includes: screening a plane cluster with the largest number of planes from multiple plane clusters; determining plane feature data of each candidate plane in the screened plane cluster; the plane feature data includes the distance between the origin and the corresponding candidate plane, the plane area, and the center distance between the plane image corresponding to the corresponding candidate plane and the depth image; determining the candidate plane whose corresponding plane feature data meets the box top surface screening condition as the box top surface, and determining the candidate plane whose corresponding plane feature data meets the main plane screening condition as the main plane.

[0091] Among them, the box top surface screening condition is the basis or condition for screening the box top surface from multiple candidate planes, and specifically can be the basis or condition for screening the box top surface from the candidate planes in the screened plane cluster, such as screening the candidate plane with the smallest distance from the origin and the smallest center distance between the corresponding plane image and the depth image as the box top surface. The main plane screening condition is the basis or condition for screening the main plane from multiple candidate planes, and specifically can be the basis or condition for screening the main plane from the candidate planes in the screened plane cluster, such as screening the candidate plane with the second largest distance from the origin from the screened plane cluster as the main plane, or screening the candidate plane with the second largest distance from the origin and the largest plane area as the main plane.

[0092] Specifically, the terminal selects the plane cluster with the largest number of planes from the multiple plane clusters obtained by classification according to the number of planes in each plane cluster, and determines the plane feature data corresponding to each candidate plane in the plane cluster with the largest number of planes. The terminal compares each candidate plane in the plane cluster with the box top surface screening condition to screen the box top surface from the plane cluster, and compares each candidate plane in the plane cluster with the main plane screening condition to screen the main plane from the plane cluster.

[0093] In one embodiment, for each candidate plane, the terminal determines the plane equation, plane area and three-dimensional coordinates of the center of the plane corresponding to the candidate plane based on the three-dimensional coordinate points corresponding to the candidate plane, and calculates the distance between the origin and the candidate plane based on the origin and the plane equation. The terminal determines the two-dimensional pixel point corresponding to the center of the plane in the depth image based on the three-dimensional coordinates of the center of the candidate plane, and calculates the center distance between the plane image corresponding to the candidate plane and the depth image based on the two-dimensional pixel point and the center pixel point of the depth image. The terminal can also determine the plane image corresponding to the candidate plane in the depth image, and calculate the center distance between the two based on the center pixel point of the plane image and the center pixel point of the depth image. The plane area of ​​the candidate plane can be the area of ​​the candidate plane in the three-dimensional scene, or it can be the area of ​​the two-dimensional image corresponding to the candidate plane in the depth image.

[0094] In one embodiment, the terminal sorts the multiple candidate planes corresponding to the depth image in order from large to small according to the plane areas corresponding to each of the multiple candidate planes, and obtains the sorting number corresponding to each candidate plane. After the terminal screens out the plane cluster with the largest number of planes, each candidate plane with a sorting number less than or equal to the sorting number threshold is compared with each candidate plane in the plane cluster with the largest number of planes. If it is determined that the candidate plane with a sorting number less than or equal to the sorting number threshold is in the plane cluster with the largest number of planes, the top surface and the main plane of the box are screened from the plane cluster with the largest number of planes. The sorting number threshold can be customized, such as 2 or 3. If it is determined that the candidate plane with a sorting number less than or equal to the sorting number threshold is not in the plane cluster with the largest number of planes, the top surface and the main plane of the box are screened from the plane cluster with the second largest number of planes. When it is determined that the candidate plane with a sorting number less than or equal to the sorting number threshold is not in the plane cluster with the largest number of planes, it can also be further determined whether the candidate plane with a sorting number less than or equal to the sorting number threshold is in the plane cluster with the second largest number of planes, and the top surface and the main plane of the box are screened based on the determination result. When, among the multiple candidate planes corresponding to the depth image, the number of candidate planes parallel to the side surfaces of the box is greater than the number of candidate planes parallel to the top surface of the box, this method can avoid incorrectly screening out the top surface and the main plane of the box from the candidate planes parallel to the side surfaces of the box, thereby improving the accuracy of the box volume measurement.

[0095] In one embodiment, the terminal selects the main plane from one or more candidate planes whose sorting numbers are less than or equal to the sorting number threshold according to the plane feature data corresponding to the candidate planes. For example, the terminal selects the candidate plane with the second largest distance from the origin as the main plane from one or more candidate planes whose sorting numbers are less than or equal to the sorting number threshold. The second largest refers to the second largest when sorted in descending order.

[0096] In the above embodiment, the box top surface and the main plane are screened from multiple candidate planes according to the plane feature data, which can improve the accuracy and efficiency of screening the box top surface and the main plane. When the box volume is measured based on the screened box top surface and main plane, the accuracy and efficiency of the box volume measurement can be improved.

[0097] In one embodiment, step S210 includes: determining the normal angle between the plane normal of the top surface of the box and the vertical axis based on the plane feature data of the top surface of the box; determining the rotation matrix corresponding to the three-dimensional point cloud data based on the normal angle; and rotating the three-dimensional point cloud data according to the rotation matrix.

[0098] Specifically, after filtering out the top surface of the box, the terminal determines the plane feature data of the top surface of the box, and extracts the normal angle between the plane normal of the top surface of the box and the vertical axis from the plane feature data. The terminal determines the rotation matrix corresponding to the three-dimensional point cloud data based on the extracted normal angle, and performs coordinate transformation on each three-dimensional coordinate point in the three-dimensional point cloud data according to the rotation matrix to obtain the rotated three-dimensional point cloud data.

[0099] In one embodiment, after filtering out the top surface of the box, the terminal determines the plane normal vector corresponding to the top surface of the box based on the three-dimensional coordinate points within the filtered top surface of the box, and calculates the normal angle between the plane normal of the top surface of the box and the vertical axis based on the plane normal vector.

[0100] In one embodiment, the terminal determines the rotation matrix corresponding to the three-dimensional point cloud data according to the angle between the plane normal of the top surface of the box and the normal of the vertical axis according to the existing rotation matrix determination method, which is not repeated here.

[0101] In the above embodiment, a rotation matrix is ​​determined based on the angle between the plane normal of the top surface of the box and the normal of the vertical axis, and the three-dimensional point cloud data is rotated according to the rotation matrix, so that the box volume can be measured based on the rotated three-dimensional point cloud data, which can improve the accuracy of volume measurement.

[0102] In one embodiment, step S204 includes: gridding the depth image; converting the two-dimensional pixel points in each grid into three-dimensional coordinate points according to the corresponding depth data to obtain the corresponding grid point cloud; filtering the grid point clouds that constitute the point cloud plane according to the three-dimensional coordinate points in each grid point cloud; clustering the filtered grid point clouds to obtain clustering planes; clustering the three-dimensional coordinate points that have not yet been clustered with the clustering planes to obtain candidate planes corresponding to the depth image.

[0103] Specifically, the terminal grids the acquired depth image to obtain multiple grids corresponding to the depth image. The terminal determines the three-dimensional coordinates of the two-dimensional pixel point in the three-dimensional scene based on the depth data corresponding to each two-dimensional pixel point, and determines the three-dimensional coordinate point corresponding to the two-dimensional pixel point in the three-dimensional scene based on the three-dimensional coordinates to convert the two-dimensional pixel point into the corresponding three-dimensional coordinate point. The terminal obtains the grid point cloud corresponding to the grid in the three-dimensional scene based on the three-dimensional coordinate points corresponding to each two-dimensional pixel point in each grid, thereby obtaining multiple grid point clouds corresponding to the depth image. Based on the three-dimensional coordinate points in each grid point cloud, the terminal determines whether the three-dimensional coordinate points in the grid point cloud are in the same point cloud plane in the three-dimensional scene, that is, whether the grid point cloud constitutes a point cloud plane, and selects the grid point cloud constituting the point cloud plane from the multiple grid point clouds.

[0104] Furthermore, the terminal clusters the selected grid point cloud constituting the point cloud plane according to the three-dimensional coordinate points in the grid point cloud to obtain multiple clustering planes. The terminal determines the three-dimensional coordinate points that have not been clustered from the three-dimensional point cloud data, and clusters the three-dimensional coordinate points that have not been clustered with the obtained clustering planes, so as to cluster each three-dimensional coordinate point in the three-dimensional point cloud data to the corresponding clustering plane, and obtain multiple candidate planes corresponding to the depth image.

[0105] In one embodiment, the terminal clusters two adjacent grid point clouds whose corresponding point cloud planes meet the clustering conditions into a clustered grid point cloud, and merges the two point cloud planes to obtain the corresponding clustering plane. The terminal traverses the selected grid point cloud, and performs the above clustering operation on the traversed grid point cloud to obtain multiple clustered grid point clouds corresponding to the selected grid point cloud, and the clustering plane corresponding to each clustered grid point cloud. The clustering condition is the basis or condition for clustering two adjacent point cloud planes into a clustering plane. The clustering condition can be that the normal angle of the two point cloud planes is less than or equal to the clustering angle threshold, and the point-to-surface distance from any three-dimensional coordinate point in one point cloud plane to another point cloud plane is less than or equal to the clustering distance threshold. The clustering condition can also be that the point-to-surface distance from all three-dimensional coordinate points in a point cloud plane to another point cloud plane is less than or equal to the clustering distance threshold. Both the clustering angle threshold and the clustering distance threshold can be customized according to actual conditions. The clustering angle threshold is, for example, 5 degrees, and the clustering distance threshold is, for example, 1 mm or 0 mm, which are not specifically limited here.

[0106] In one embodiment, after the terminal clusters the grid point cloud constituting the point cloud plane to obtain multiple clustering planes, it traverses each clustering plane and clusters the three-dimensional coordinate points that are adjacent to the traversed clustering plane and have not yet been clustered with the traversed clustering plane. If the point-to-surface distance from the adjacent three-dimensional coordinate point to the adjacent clustering plane is less than or equal to the clustering distance threshold, the three-dimensional coordinate point is clustered to the clustering plane. The terminal performs the above clustering operation on each clustering plane obtained by clustering until each three-dimensional coordinate point in the three-dimensional point cloud data is clustered to any clustering plane. It can be understood that after the terminal clusters to obtain multiple clustering planes corresponding to the filtered grid point cloud, it can also traverse each three-dimensional coordinate point that has not yet been clustered, and cluster the traversed three-dimensional coordinate points with the clustering planes adjacent to them until each three-dimensional coordinate point is clustered to the corresponding coordinate point. Among them, the three-dimensional coordinate points used for clustering with the clustering plane are three-dimensional coordinate points in each grid point cloud that does not constitute the point cloud plane.

[0107] In one embodiment, the terminal determines the three-dimensional coordinates corresponding to the two-dimensional pixel point in the three-dimensional scene according to the depth data corresponding to the two-dimensional pixel point according to the preset conversion relationship, and then determines the three-dimensional coordinate point based on the three-dimensional coordinates. The preset conversion relationship is, for example,

[0108] X=(x-cx) / f*z

[0109] Y=(y-cy) / f*z

[0110] Z=z

[0111] Among them, X, Y and Z are the coordinate values ​​of the three-dimensional coordinate point in the three-dimensional scene in the X-axis, Y-axis and Z-axis directions respectively, and (X, Y, Z) is the three-dimensional coordinate corresponding to the three-dimensional coordinate point in the three-dimensional scene. x and y are the coordinate values ​​of the two-dimensional pixel point in the X-axis and Y-axis directions respectively in the depth image, (x, y) is the pixel coordinate corresponding to the two-dimensional pixel point in the depth image, and z is the pixel value corresponding to the two-dimensional pixel point. Therefore, the depth data corresponding to the two-dimensional pixel point is (x, y, z). f is the focal length of the image acquisition device, and cx and cy are the optical axis centers of the image acquisition device.

[0112] In the above embodiment, multiple grid point clouds in the three-dimensional space are determined based on the gridded depth image, and the three-dimensional point cloud data corresponding to the depth image is clustered based on the grid point cloud to obtain multiple corresponding candidate planes, which can improve the accuracy of plane detection. When the box volume is measured based on the candidate plane with higher accuracy, the accuracy of volume measurement can be improved.

[0113] In one embodiment, grid point clouds constituting a point cloud plane are screened according to the three-dimensional coordinate points in each grid point cloud, including: constructing a corresponding covariance matrix based on the three-dimensional coordinate points in each grid point cloud; determining a plane normal vector corresponding to the corresponding grid point cloud according to the covariance matrix; determining a plane equation of the corresponding grid point cloud according to the three-dimensional coordinate points in each grid point cloud and the corresponding plane normal vector; and screening the grid point clouds constituting the point cloud plane according to the distance from the three-dimensional coordinate points in each grid point cloud to the corresponding plane equation.

[0114] Specifically, for each grid point cloud, the terminal constructs a covariance matrix corresponding to the grid point cloud according to the three-dimensional coordinates corresponding to the three-dimensional coordinate points in the grid point cloud, determines the corresponding eigenvectors and the eigenvalues ​​corresponding to each eigenvector according to the covariance matrix, and selects the target eigenvector from the multiple eigenvectors based on the determined eigenvalues ​​as the plane normal vector corresponding to the grid point cloud. The terminal selects a three-dimensional coordinate point from each grid point cloud, and determines the plane equation of the grid point cloud according to the selected three-dimensional coordinate point and the plane normal vector corresponding to the grid point cloud. For each grid point cloud, the terminal calculates the distance from each three-dimensional coordinate point in the grid point cloud to the plane equation corresponding to the grid point cloud, sums the distance from each three-dimensional coordinate point to the plane equation to obtain the total distance, and determines whether the three-dimensional coordinate points in the grid point cloud constitute a point cloud plane according to the obtained total distance. The terminal selects the grid point cloud that constitutes the point cloud plane from the multiple grid point clouds corresponding to the depth image according to the determination result of whether each grid point cloud constitutes a point cloud plane.

[0115] When the total distance between each three-dimensional coordinate point in the grid point cloud and the plane equation corresponding to the grid point cloud is less than or equal to the preset distance threshold, the terminal determines that the three-dimensional coordinate points in the grid point cloud constitute a point cloud plane; otherwise, it is determined that the three-dimensional coordinate points in the grid point cloud are not completely in the same plane, and thus the three-dimensional coordinate points in the grid point cloud do not constitute a point cloud plane. The preset distance threshold is mainly set with reference to the resolution capability of the image acquisition device.

[0116] In one embodiment, the terminal determines the three-dimensional coordinates of the point cloud center of the grid point cloud according to the three-dimensional coordinates corresponding to each three-dimensional coordinate point in the grid point cloud, and determines the covariance matrix of the grid point cloud according to the three-dimensional coordinates of each three-dimensional coordinate point and the three-dimensional coordinates of the center of the point cloud. Specifically, the terminal constructs a point cloud matrix corresponding to the grid point cloud according to the three-dimensional coordinates corresponding to all three-dimensional pixel points in the grid point cloud. The terminal averages the three-dimensional coordinates corresponding to all three-dimensional coordinate points in the grid point cloud on three components to obtain the three-dimensional coordinates of the center of the point cloud, and subtracts all the three-dimensional coordinates constituting the point cloud matrix from the three-dimensional coordinates of the center of the point cloud on three components to obtain the center offset matrix corresponding to the grid point cloud, and obtains the covariance matrix corresponding to the grid point cloud according to the center offset matrix and the number of three-dimensional coordinate points in the grid point cloud.

[0117] For example, assuming that the grid point cloud includes three-dimensional coordinates corresponding to a total of n three-dimensional coordinate points p1, p2, ..., pn, a point cloud matrix pt(p1, p2, ..., pn) can be constructed, which is a 3*n-dimensional matrix. The terminal can average all three-dimensional coordinates in the grid point cloud on three components according to center = (p1+p2+...+pn) / n to obtain the three-dimensional coordinates of the center of the point cloud, and calculate the center offset matrix corresponding to the grid point cloud according to pt' = pt-center = (p1-center, p2-center, ..., pn-center), and then calculate the covariance matrix corresponding to the grid point cloud according to P = (pt'*transpose(pt')) / (n-1). Among them, transpose refers to the transposition function, which is used to transform pt'. The three components refer to the components in the three directions of the X-axis, Y-axis and Z-axis.

[0118] In one embodiment, the terminal solves three mutually perpendicular eigenvectors and the eigenvalues ​​corresponding to each eigenvector based on the covariance matrix corresponding to the grid point cloud. The three eigenvectors are used to characterize the direction vectors of the growth of the grid point cloud along the three vertical directions, and the corresponding three eigenvalues ​​are used to characterize the growth length of the grid point cloud along the three vertical directions. The eigenvalue can also be used to characterize the disturbance size of the grid point cloud in the direction represented by the corresponding eigenvector. The smaller the eigenvalue, the smaller the disturbance of the grid point cloud in the corresponding direction. The terminal selects the eigenvector corresponding to the minimum eigenvalue from the three eigenvectors as the target eigenvector, and determines the target eigenvector as the plane normal vector of the grid point cloud. Among them, the terminal can solve the eigenvector and eigenvalue according to the existing solution method based on the covariance matrix, which will not be repeated here.

[0119] In the above embodiment, the plane normal vector corresponding to the grid point cloud is determined by constructing a covariance matrix, and the plane equation of the grid point cloud is determined based on the plane normal vector. Then, based on the plane equation, it is judged whether the three-dimensional coordinate points in the corresponding grid point cloud constitute a point cloud plane, so as to realize the screening of the grid point cloud. This can improve the screening accuracy and efficiency of the grid point cloud, thereby improving the clustering accuracy and efficiency of the grid point cloud.

[0120] In one embodiment, step S212 includes: determining the length and width according to the three-dimensional coordinate points corresponding to the top surface of the box in the rotated three-dimensional point cloud data; determining the first height according to the three-dimensional coordinate points corresponding to the top surface of the box and the main plane in the rotated three-dimensional point cloud data; determining the side surface of the box according to the top surface of the box, and determining the second height according to the side surface of the box; determining the height of the target box according to the first height and the second height, and determining the box volume of the target box according to the height, length and width.

[0121] Specifically, the terminal determines the length and width corresponding to the target box according to the three-dimensional coordinate points corresponding to the top surface of the box in the rotated three-dimensional point cloud data in accordance with the method provided in one or more of the above embodiments. The terminal calculates the distance between the top surface of the box and the main plane according to the three-dimensional coordinate points corresponding to the top surface of the box and the main plane in the rotated three-dimensional point cloud data, and determines the calculated distance as the second height corresponding to the target box. The terminal selects the side of the box from multiple candidate planes according to the selected top surface of the box, and determines the height of the side of the box as the second height corresponding to the target box. The terminal averages the first height and the second height corresponding to the target box to obtain the height corresponding to the target box, and calculates the box volume of the target box according to the height, length and width corresponding to the target box. The averaging can be an arithmetic average or a weighted average.

[0122] In one embodiment, the terminal selects a plane cluster perpendicular to the top surface of the box from multiple plane clusters corresponding to the depth image based on the filtered top surface of the box, and selects a candidate plane that is connected to the top surface of the box from the vertical plane cluster as the box side surface of the target box. The terminal can select a plane cluster perpendicular to the top surface of the box from multiple plane clusters based on the plane normal vector of the top surface of the box and the plane normal vector of any candidate plane in each plane cluster. If the top surface of the box is perpendicular to any candidate plane in the plane cluster, it indicates that the top surface of the box is perpendicular to the plane cluster. The terminal can determine whether there is a connection relationship between the top surface of the box and the candidate plane according to any of the following connection relationship determination methods.

[0123] For example, a connection relationship determination method includes traversing each three-dimensional coordinate point in the top surface of the box, calculating the point distance between the traversed three-dimensional coordinate point and each three-dimensional coordinate point in the candidate plane, obtaining multiple point distances between the top surface of the box and the candidate plane, and counting the number of point distances that are less than or equal to a preset point distance threshold among the multiple point distances. When the counted number of point distances is greater than or equal to the number threshold, it is determined that there is a connection relationship between the top surface of the box and the candidate plane.

[0124] Another method for determining the connection relationship is to determine the plane images corresponding to the top surface of the box and the candidate plane in the depth image, traverse the two-dimensional pixel points in any one of the two plane images, calculate the distance between the traversed two-dimensional pixel points and each two-dimensional pixel point in the other plane image, obtain multiple point distances between the two plane images, and count the number of point distances that are less than or equal to a preset point distance threshold among the multiple point distances. When the counted number of point distances is greater than or equal to the number threshold, it is determined that there is a connection relationship between the top surface of the box and the candidate plane.

[0125] In the above embodiment, the height of the target box is determined by jointly using the top surface, the side surface and the main plane of the box, so that the accuracy of the height can be improved. The volume of the box is determined based on the highly accurate height and the corresponding length and width, so that the accuracy of the box volume measurement can be improved.

[0126] like Figure 3 As shown, in one embodiment, a method for measuring the volume of a box is provided, and the method specifically comprises the following steps:

[0127] S302, acquiring a depth image corresponding to the target box.

[0128] S304, gridding the depth image.

[0129] S306, converting the two-dimensional pixel points in each grid into three-dimensional coordinate points according to the corresponding depth data to obtain the corresponding grid point cloud.

[0130] S308: construct a corresponding covariance matrix based on the three-dimensional coordinate points in each grid point cloud.

[0131] S310, determining a plane normal vector corresponding to a corresponding grid point cloud according to a covariance matrix.

[0132] S312, determining the plane equation of the corresponding grid point cloud according to the three-dimensional coordinate points in each grid point cloud and the corresponding plane normal vector.

[0133] S314, screening the grid point clouds constituting the point cloud plane according to the distance from the three-dimensional coordinate point in each grid point cloud to the corresponding plane equation.

[0134] S316, clustering the screened grid point cloud to obtain a clustering plane.

[0135] S318: Cluster the three-dimensional coordinate points that have not been clustered with the clustering plane to obtain a candidate plane corresponding to the depth image.

[0136] S320: Determine the plane normal vector of each candidate plane.

[0137] S322 , classifying mutually parallel candidate planes into the same plane cluster according to the plane normal vectors, to obtain a plurality of plane clusters.

[0138] S324, selecting a plane cluster with the largest number of planes from the multiple plane clusters.

[0139] S326, determining plane feature data of each candidate plane in the screened plane cluster; the plane feature data includes the distance between the origin and the corresponding candidate plane, the plane area, and the center distance between the plane image corresponding to the corresponding candidate plane and the depth image.

[0140] S328, determining the candidate plane whose corresponding plane feature data meets the box top surface screening condition as the box top surface, and determining the candidate plane whose corresponding plane feature data meets the main plane screening condition as the main plane.

[0141] S330, determining a normal angle between a plane normal line of the top surface of the box and the vertical axis according to the plane feature data of the top surface of the box.

[0142] S332, determining a rotation matrix corresponding to the three-dimensional point cloud data according to the normal angle.

[0143] S334, rotating the three-dimensional point cloud data according to the rotation matrix.

[0144] S336, determining the length and width according to the three-dimensional coordinate points corresponding to the top surface of the box in the rotated three-dimensional point cloud data.

[0145] S338, determining a first height according to the three-dimensional coordinate points corresponding to the top surface of the box and the main plane in the rotated three-dimensional point cloud data.

[0146] S340, determining the side surface of the box body according to the top surface of the box body, and determining the second height according to the side surface of the box body.

[0147] S342, determining the height of the target box according to the first height and the second height, and determining the box volume of the target box according to the height, length and width.

[0148] It should be understood that although Figure 2-3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0149] In one embodiment, Figure 4 As shown, a box volume measurement device 400 is provided, including: an acquisition module 402, a detection module 404, a classification module 406, a screening module 408, a rotation module 410 and a determination module 412, wherein:

[0150] An acquisition module 402 is used to acquire a depth image corresponding to a target box;

[0151] A detection module 404 is used to perform plane detection based on the three-dimensional point cloud data corresponding to the depth image to obtain a candidate plane corresponding to the depth image;

[0152] A classification module 406, used to classify the candidate planes to obtain a plurality of plane clusters;

[0153] A screening module 408 is used to screen the top surface of the box and the main plane according to the plane feature data of each candidate plane in the plane cluster with the largest number of planes;

[0154] A rotation module 410 is used to rotate the three-dimensional point cloud data based on the plane feature data of the top surface of the box;

[0155] The determination module 412 is used to determine the volume of the target box according to the top surface of the box, the main plane and the rotated three-dimensional point cloud data.

[0156] In one embodiment, the classification module 406 is further used to determine a plane normal vector of each candidate plane; and classify mutually parallel candidate planes into the same plane cluster according to the plane normal vectors to obtain multiple plane clusters.

[0157] In one embodiment, the screening module 408 is also used to screen the plane cluster with the largest number of planes from multiple plane clusters; determine the plane feature data of each candidate plane in the screened plane cluster; the plane feature data includes the distance between the origin and the corresponding candidate plane, the plane area, and the center distance between the plane image corresponding to the corresponding candidate plane and the depth image; determine the candidate plane whose corresponding plane feature data meets the box top surface screening condition as the box top surface, and determine the candidate plane whose corresponding plane feature data meets the main plane screening condition as the main plane.

[0158] In one embodiment, the rotation module 410 is also used to determine the normal angle between the plane normal of the top surface of the box and the vertical axis based on the plane feature data of the top surface of the box; determine the rotation matrix corresponding to the three-dimensional point cloud data based on the normal angle; and rotate the three-dimensional point cloud data according to the rotation matrix.

[0159] In one embodiment, the detection module 404 is also used to grid the depth image; convert the two-dimensional pixel points in each grid into three-dimensional coordinate points according to the corresponding depth data to obtain the corresponding grid point cloud; filter the grid point cloud that constitutes the point cloud plane according to the three-dimensional coordinate points in each grid point cloud; cluster the filtered grid point cloud to obtain a clustering plane; cluster the three-dimensional coordinate points that have not yet been clustered with the clustering plane to obtain a candidate plane corresponding to the depth image.

[0160] In one embodiment, the detection module 404 is also used to construct a corresponding covariance matrix based on the three-dimensional coordinate points in each grid point cloud; determine the plane normal vector corresponding to the corresponding grid point cloud according to the covariance matrix; determine the plane equation of the corresponding grid point cloud according to the three-dimensional coordinate points in each grid point cloud and the corresponding plane normal vector; and screen the grid point clouds that constitute the point cloud plane according to the distance from the three-dimensional coordinate points in each grid point cloud to the corresponding plane equation.

[0161] In one embodiment, the determination module 412 is also used to determine the length and width according to the three-dimensional coordinate points corresponding to the top surface of the box in the rotated three-dimensional point cloud data; determine the first height according to the three-dimensional coordinate points corresponding to the top surface of the box and the main plane in the rotated three-dimensional point cloud data; determine the side surface of the box according to the top surface of the box, and determine the second height according to the side surface of the box; determine the height of the target box according to the first height and the second height, and determine the box volume of the target box according to the height, length and width.

[0162] Please refer to the definition of the box volume measurement method above, which will not be repeated here. Each module in the above box volume measurement device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0163] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 5As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a box volume measurement method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0164] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0165] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the box volume measurement method in the above-mentioned various embodiments when executing the computer program.

[0166] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the box volume measurement method in the above-mentioned embodiments are implemented.

[0167] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0168] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0169] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for measuring the volume of a box, the method include: Obtain a depth image corresponding to the target box; Plane detection is performed based on the 3D point cloud data corresponding to the depth image to obtain candidate planes corresponding to the depth image, including: The depth image is gridded, and two-dimensional pixel points in each grid are converted into three-dimensional coordinate points according to corresponding depth data to obtain a corresponding grid point cloud, and grid point clouds constituting point cloud planes are screened according to the three-dimensional coordinate points in each grid point cloud, and the screened grid point clouds are clustered to obtain clustering planes, and three-dimensional coordinate points that have not been clustered are clustered with the clustering planes to cluster each three-dimensional coordinate point in the three-dimensional point cloud data to a corresponding clustering plane to obtain a candidate plane corresponding to the depth image; Classifying the candidate planes to obtain multiple plane clusters; The top surface and the main plane of the box are selected according to the plane feature data of each candidate plane in the plane cluster with the largest number of planes; The plane feature data includes the distance between the origin and the corresponding candidate plane, the plane area, or the center distance between the plane image corresponding to the corresponding candidate plane and the depth image; Rotating the three-dimensional point cloud data based on the plane feature data of the top surface of the box; Determine the length and width according to the three-dimensional coordinate points corresponding to the top surface of the box in the rotated three-dimensional point cloud data; Determine a first height according to the three-dimensional coordinate points corresponding to the top surface of the box and the main plane in the rotated three-dimensional point cloud data; Determine a side surface of the box body according to the top surface of the box body, and determine a second height according to the side surface of the box body; The height of the target box is determined according to the first height and the second height, and the box volume of the target box is determined according to the height, the length and the width.

2. The method according to claim 1, It is characterized in that The classifying the candidate planes to obtain a plurality of plane clusters includes: Determine the plane normal vector of each candidate plane; According to the plane normal vectors, the mutually parallel candidate planes are classified into the same plane cluster to obtain a plurality of plane clusters.

3. The method according to claim 1, It is characterized in that The method of screening the top surface of the box and the main plane according to the plane feature data of each candidate plane in the plane cluster with the largest number of planes includes: Selecting a plane cluster with the largest number of planes from the plurality of plane clusters; Determine plane feature data of each candidate plane in the screened plane cluster; The candidate plane whose corresponding plane feature data meets the box top surface screening condition is determined as the box top surface, and the candidate plane whose corresponding plane feature data meets the main plane screening condition is determined as the main plane.

4. The method according to claim 1, It is characterized in that The rotating the three-dimensional point cloud data based on the plane feature data of the top surface of the box body comprises: Determine the normal angle between the plane normal line of the top surface of the box and the vertical axis according to the plane feature data of the top surface of the box; Determine a rotation matrix corresponding to the three-dimensional point cloud data according to the normal angle; The three-dimensional point cloud data is rotated according to the rotation matrix.

5. The method according to claim 1, It is characterized in that The step of screening the grid point clouds constituting the point cloud plane according to the three-dimensional coordinate points in each grid point cloud comprises: Construct the corresponding covariance matrix based on the three-dimensional coordinate points in each grid point cloud; Determine the plane normal vector corresponding to the corresponding grid point cloud according to the covariance matrix; Determine the plane equation of the corresponding grid point cloud according to the three-dimensional coordinate points in each grid point cloud and the corresponding plane normal vector; According to the distance from the three-dimensional coordinate point in each grid point cloud to the corresponding plane equation, the grid point clouds constituting the point cloud plane are screened.

6. A box volume measuring device, It is characterized in that The device comprises: An acquisition module, used to acquire a depth image corresponding to a target box; A detection module, for performing plane detection based on the three-dimensional point cloud data corresponding to the depth image to obtain a candidate plane corresponding to the depth image, comprising: gridding the depth image, converting the two-dimensional pixel points in each grid into three-dimensional coordinate points according to the corresponding depth data to obtain a corresponding grid point cloud, screening the grid point clouds constituting the point cloud plane according to the three-dimensional coordinate points in each grid point cloud, clustering the screened grid point clouds to obtain a clustering plane, clustering the three-dimensional coordinate points that have not been clustered with the clustering plane, so as to cluster each three-dimensional coordinate point in the three-dimensional point cloud data to the corresponding clustering plane, and obtaining a candidate plane corresponding to the depth image; A classification module, used for classifying the candidate planes to obtain a plurality of plane clusters; A screening module, used to screen the top surface and the main plane of the box according to the plane feature data of each candidate plane in the plane cluster with the largest number of planes, wherein the plane feature data includes the distance between the origin and the corresponding candidate plane, the plane area, or the distance between the plane image corresponding to the corresponding candidate plane and the center of the depth image; A rotation module, used for rotating the three-dimensional point cloud data based on the plane feature data of the top surface of the box; A determination module is used to determine the length and width according to the three-dimensional coordinate points corresponding to the top surface of the box in the rotated three-dimensional point cloud data; determine the first height according to the three-dimensional coordinate points corresponding to the top surface of the box and the main plane in the rotated three-dimensional point cloud data; determine the side surface of the box according to the top surface of the box, and determine the second height according to the side surface of the box; determine the height of the target box according to the first height and the second height, and determine the box volume of the target box according to the height, the length and the width.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.