Thickness measurement method, device, electronic device and storage medium
By acquiring two-dimensional images and depth maps in rail transit equipment and registering point clouds to locate the objects to be measured, the problem of measurement errors caused by inaccurate positioning of the detection frame is solved and accurate thickness measurement is achieved.
Patent Information
- Application Number
- CN202011414592.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-07
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-12-07
AI Technical Summary
In rail transit, the vision-based thickness measurement method is not accurate enough in positioning the detection frame, resulting in inaccurate measurement results and errors.
By obtaining the two-dimensional image and depth map of the object to be measured and the target object, the standard point cloud is obtained and registered, and the target plane equation is obtained. The object to be measured is positioned based on the two-dimensional image and depth map, and its thickness is calculated.
It achieves precise positioning and accurate measurement of the thickness of the object to be measured, reduces the subjective error of manual measurement, and improves the accuracy of the measurement results.
Smart Images

Figure CN114593681B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision technology, and in particular, to a thickness measurement method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of science and technology, rail transit has developed rapidly. For example, the Harmony EMU and Fuxing high-speed rail require the friction between the brake disc and the brake pad in the braking system to ensure safe parking of the train, which causes great wear on the brake pad. Since the friction braking force between the brake disc and the brake pad is very important for the safe parking of the train, the brake pad needs to be inspected to ensure the safe parking of the train.
[0003] Normally, maintenance personnel can carry maintenance tools into the ground trough and measure the thickness of the gate pad to determine whether the gate pad needs to be replaced. Since maintenance personnel rely on subjective experience during maintenance, there is a risk of misjudgment. With the development of visual technology, many vision-based distance measurements have begun to be used in rail transit. After collecting information from various parts of the train, the detection frame of the target detection technology is used to locate the object to be measured, and the depth information is used as a distance measurement tool. However, in this way, for some occlusion scenarios, if the detection frame positioning is not accurate enough, some inevitable errors will occur, resulting in inaccurate calculated measurement results. Summary of the invention
[0004] The embodiments of the present application provide a thickness measurement method, device, electronic device and storage medium, which can effectively solve the problem of inaccurate measurement results caused by inaccurate positioning of the detection frame.
[0005] According to a first aspect of an embodiment of the present application, a thickness measurement method is provided, the method comprising: obtaining a two-dimensional image and a depth map of a current object to be measured and a target object, the object to be measured having a first plane and a second plane parallel to each other, and the target object having a target plane parallel to the first plane and the second plane; obtaining a standard point cloud including the object to be measured and the target object; aligning the standard point cloud with the current point cloud to obtain a target plane equation, the target plane equation being a plane equation corresponding to the target plane, and the current point cloud being a point cloud corresponding to the depth map; locating the object to be measured in the current point cloud using the two-dimensional image and the depth map, and obtaining plane equations of the first plane and the second plane in combination with the target plane equation; and calculating the thickness of the object to be measured according to the plane equations.
[0006] According to a second aspect of an embodiment of the present application, a thickness measuring device is provided, the device comprising: an image acquisition module, used to acquire a two-dimensional image and a depth map of a current object to be measured and a target object, the object to be measured having a first plane and a second plane parallel to each other, and the target object having a target plane parallel to the first plane and the second plane; a standard point cloud acquisition module, used to acquire a standard point cloud including the object to be measured and the target object; a registration module, used to register the standard point cloud with the current point cloud to obtain a target plane equation, the target plane equation is a plane equation corresponding to the target plane, and the current point cloud is a point cloud corresponding to the depth map; a plane equation calculation module, used to locate the object to be measured in the current point cloud using the two-dimensional image and the depth map, and obtain plane equations of the first plane and the second plane in combination with the target plane equation; a thickness calculation module, used to calculate the thickness of the object to be measured according to the plane equation.
[0007] According to a third aspect of an embodiment of the present application, an electronic device is provided, which includes one or more processors; a memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method as applied to the electronic device as described above.
[0008] According to a fourth aspect of the embodiments of the present application, the embodiments of the present application provide a computer-readable storage medium, in which a program code is stored, wherein the above method is executed when the program code is run.
[0009] Using the thickness measurement method provided in the embodiment of the present application, obtain a two-dimensional image and a depth map of the current object to be measured and the target object; obtain a standard point cloud including the object to be measured and the target object and obtain a standard point cloud; align the standard point cloud and the current point cloud corresponding to the depth map to obtain a target plane equation; use the two-dimensional image and the depth map to locate the object to be measured in the current point cloud, and combine the target plane equation to obtain the plane equations of the first plane and the second plane, and finally calculate the thickness of the object to be measured according to the plane equation. The object to be measured is located in combination with the two-dimensional image and the depth map, and the target plane equation is obtained by alignment to obtain the plane equations corresponding to the two parallel planes of the object to be measured, so that the object to be measured can be accurately located, so that the thickness of the object to be measured can be accurately calculated. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0011] Figure 1 A schematic diagram of an application environment of the thickness measurement method provided in an embodiment of the present application;
[0012] Figure 2 A flow chart of a thickness measurement method provided for one embodiment of the present application;
[0013] Figure 3 A flowchart of a thickness measurement method provided in yet another embodiment of the present application;
[0014] Figure 4 A flowchart of a thickness measurement method provided in yet another embodiment of the present application;
[0015] Figure 5 A functional module diagram of a thickness measuring device provided in one embodiment of the present application;
[0016] Figure 6 This is a structural block diagram of an electronic device proposed in an embodiment of the present application for executing the thickness measurement method according to an embodiment of the present application. DETAILED DESCRIPTION
[0017] With the rapid development of science and technology, rail transit has developed rapidly, especially the transportation vehicles mainly based on Harmony EMU and Fuxing High-speed Railway. The safe stopping of trains depends on the friction between the brake disc and the brake pad in the braking system, which causes great wear on the brake pad. Since the friction braking force between the brake disc and the brake pad is very important for the safe stopping of trains, the brake pad needs to be inspected to ensure the safe stopping of trains.
[0018] The train operation team will customize the thickness threshold for replacing the brake pad according to relevant requirements. If the thickness of the brake pad is less than the thickness threshold, or is very close to the thickness threshold, the brake pad needs to be replaced. Maintenance personnel generally carry maintenance tools into the ground trough. First, they roughly judge whether it is less than the thickness threshold based on visual inspection to determine whether it needs to be replaced. If it is found that the thickness is much greater than the thickness threshold, simply record it for safety. If it is close to the thickness threshold, it is necessary to use tools to measure the thickness of the brake pad and determine whether the brake pad needs to be replaced based on the measured value. In this way, reading the measurement value when manually measuring the thickness is more subjective and prone to errors.
[0019] With the development of computer vision technology, many vision-based distance measurements have begun to be used in rail transit. Usually, an image acquisition robot collects information from various parts of the train, aligns it to a color image through a depth map, locates the target in the color image, and directly uses the detection frame of the target detection technology to specify the range. The depth information is combined with the camera's intrinsic parameters to convert it into three-dimensional coordinate information to calculate the distance of the specified range. In this way, both the maintenance points and targets can be recorded, and automated distance measurement can be completed to allow workers to quickly determine whether they exceed the limit and need to be replaced. However, the inventors found that in this method, for some scene occlusions, scene jitters, and when the detection frame positioning is offset, some inevitable errors are easily generated due to inaccurate positioning, resulting in inaccurate calculated measurement results.
[0020] In response to the above problems, a thickness measurement method is provided in an embodiment of the present application, which includes obtaining a two-dimensional image and a depth map of the current object to be measured and the target object; obtaining a standard point cloud including the object to be measured and the target object; registering the standard point cloud and the current point cloud corresponding to the depth map to obtain a target point cloud; locating the object to be measured in the current point cloud using the two-dimensional image and the depth map, and obtaining the plane equations of the first plane and the second plane in combination with the target point cloud, and finally calculating the thickness of the object to be measured according to the plane equations. The object to be measured is located in combination with the two-dimensional image and the depth map, and the target plane equation is obtained by registration to obtain the plane equations corresponding to the two parallel planes of the object to be measured, so that the object to be measured can be accurately located, and the thickness of the object to be measured can be accurately calculated.
[0021] The solutions in the embodiments of the present application can be implemented using various computer languages, for example, the object-oriented programming language Java, the interpreted scripting language JavaScript, and Python, etc.
[0022] In order to make the technical solutions and advantages in the embodiments of the present application more clearly understood, the exemplary embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0023] See also Figure 1, shows an application environment 10 of the thickness measurement method provided in the present application, and the application environment 10 includes a system 11, an image acquisition device 12, and an electronic device 13. Among them, the target object and the object to be measured belong to the system 11, and the system 11 may also include other objects. Assume that the system 11 is a braking system, and the braking system generally includes a brake disc, a brake pad, and a brake caliper. Among them, the brake pad has a first plane and a second plane parallel to each other, and the brake disc has a target plane parallel to the first plane and the second plane, then, the brake disc is the target object, and the brake pad is the object to be measured. The image acquisition device 12 can be an intelligent robot with an image acquisition function, which can capture a two-dimensional image and a depth map of the target object and the object to be measured. The electronic device 13 can be a smart phone, a computer, a server, etc.
[0024] The image acquisition device 12 may be a high-precision depth camera, which is used to acquire a two-dimensional image and a depth map of the target object and the object to be measured. The image acquisition device 12 is in communication with the electronic device 13 to send the acquired two-dimensional image and depth map to the electronic device 13, so that the electronic device 13 can process the two-dimensional image and depth map to obtain the thickness of the object to be measured.
[0025] In some implementations, the image acquisition device 12 and the electronic device 13 may be integrated into the same device. The present application embodiment only describes the image acquisition device 12 and the electronic device 13 as two devices.
[0026] See also Figure 2 The embodiment of the present application provides a thickness measurement method, which can be applied to electronic devices in the aforementioned application environment 10. The electronic device can be a smart phone, a computer or a server, etc. The specific method can include the following steps.
[0027] Step 110: Acquire a two-dimensional image and a depth map of the current object to be measured and the target object.
[0028] Since the thickness of the object to be measured may change, the electronic device can obtain a two-dimensional image and a depth map of the current object to be measured and the target object when measuring the thickness of the object to be measured. The depth map is aligned with the two-dimensional image, and the two-dimensional image and the depth map are currently captured by the image acquisition device and sent to the electronic device, so that the electronic device can obtain the two-dimensional image of the current object to be measured and the target object and the corresponding depth map.
[0029] The object to be measured has a first plane and a second plane parallel to each other, and the target object has a target plane parallel to the first plane and the second plane. Taking the aforementioned braking system as an example, the object to be measured is a brake pad, and the brake pad has a first plane and a second plane parallel to each other, and the target object is a brake disc, and the brake disc has a plane parallel to the first plane and the second plane, which is the target plane.
[0030] Step 120: Acquire a standard point cloud including the object to be measured and the target object.
[0031] After obtaining the two-dimensional images of the current object to be measured and the target object and the corresponding depth map, the electronic device may continue to obtain a standard point cloud including the object to be measured and the target object.
[0032] In some implementations, the standard point cloud is pre-stored in the electronic device, and the electronic device can directly acquire the standard point cloud.
[0033] In other embodiments, the electronic device can obtain a standard point cloud based on a depth map captured by an image acquisition device. Specifically, the depth map captured by the image acquisition device can be converted into a point cloud using the internal parameters of the image acquisition device, and the point cloud data with better quality and less missing data can be used as the standard point cloud.
[0034] The standard point cloud may be a standard point cloud set, namely, comprising a first standard point cloud, a second standard point cloud, and a third standard point cloud, wherein the first standard point cloud is a complete point cloud of the object to be measured and the target object, the second standard point cloud is a point cloud of the object to be measured or the target object, and the third standard point cloud is a point cloud of the target plane.
[0035] That is to say, the first standard point cloud may include the complete point cloud of the object to be measured and the target object, and is a point cloud with more features for rough matching. The second standard point cloud may be the point cloud of the object to be measured or the target object for precise matching, and the third standard point cloud is the point cloud of the target plane, so as to obtain the plane equation of the target plane through transformation calculation. Among them, the second standard point cloud and the third standard point cloud are subsets of the first standard point cloud.
[0036] Taking the aforementioned brake system as an example, the brake system includes a brake disc, a brake pad, and a brake caliper, wherein the brake disc is defined as the target object, and the brake pad is defined as the object to be measured. Then, the first standard point cloud may be a point cloud including the brake disc, the brake pad, and the brake caliper; the second standard point cloud may be a point cloud including the brake pad and the brake caliper; and the third standard point cloud may be a point cloud of the plane of the brake disc.
[0037] Step 130: align the standard point cloud with the current point cloud to obtain a target plane equation.
[0038] After obtaining the standard point cloud, it is necessary to align the standard point cloud with the current point cloud to obtain the target point cloud, and then use the random sampling consistency algorithm to fit the target plane equation from the target point cloud. The current point cloud is obtained by converting the depth map of the current object to be measured and the target object. The conversion method can be to obtain the internal parameters of the depth map and convert it according to the internal parameters. The target point cloud is the point cloud corresponding to the target plane in the current point cloud, and the target plane equation is the plane equation corresponding to the target plane.
[0039] That is to say, the current point cloud and the standard point cloud are in different coordinate systems. Through registration, the point cloud data in the coordinate system corresponding to the standard point cloud can be converted to the coordinate system corresponding to the current point cloud.
[0040] Since both the current point cloud and the standard point cloud are obtained by converting the depth map, and since there may be deviations in the shooting angle when the image acquisition device acquires the depth map, the registration can be divided into coarse registration and fine registration to obtain the target point cloud, and further fit the plane from the target point cloud to obtain the target plane equation.
[0041] Specifically, the current point cloud may be roughly matched with the standard point cloud to obtain initial matching values; the current point cloud may be precisely matched with the standard point cloud according to the initial matching values to obtain a transformation matrix; the target point cloud may be obtained according to the transformation matrix and the standard point cloud; and the target plane equation may be fitted from the target point cloud using a random sampling consistency algorithm.
[0042] During registration, the ICP point cloud algorithm is usually used for registration. Before performing a rough match, the electronic device can first load the standard point cloud and the current point cloud. When loading the point cloud, the current point cloud and the standard point cloud can be downsampled, and the downsampled point cloud can be used for rough matching and fine matching, thereby speeding up the matching speed and improving the efficiency of the algorithm. After obtaining the target point cloud, the random sampling consistency algorithm can be used to fit the plane from the target point cloud to obtain the target plane equation.
[0043] Step 140: locate the object to be measured in the current point cloud using the two-dimensional image and the depth map, and obtain plane equations of the first plane and the second plane in combination with the target plane equation.
[0044] After obtaining the target plane equation, the electronic device can combine the two-dimensional image and the depth map to obtain the plane equations of the first plane and the second plane. The object to be measured can be segmented from the two-dimensional image using a convolutional neural network, and the object to be measured is converted into a point cloud from the depth map; the point cloud is traversed according to a preset conditional formula and combined with the plane equation of the target plane to obtain the plane equations of the first plane and the second plane.
[0045] The electronic device can obtain a two-dimensional image and a depth map of the current object to be measured and the target object, wherein the two-dimensional image and the depth map are aligned. When the electronic device obtains the two-dimensional image, it can process the two-dimensional image, segment the object to be measured from the two-dimensional image, obtain the area corresponding to the object to be measured in the depth map in combination with the depth map, and convert the area into a point cloud. The obtained point cloud is the point cloud corresponding to the object to be measured in the current point cloud, so as to determine the object to be measured using the three-dimensional depth map.
[0046] Since the target plane is parallel to the first plane and the second plane of the object to be measured, when the plane equation of the target plane is obtained, the equations of the first plane and the second plane can also be obtained. Due to the parallel relationship, only the constant term is different in the equation coefficients of the plane equation of the target plane, the plane equation of the first plane, and the plane equation of the second plane.
[0047] To obtain the plane equations of the first plane and the second plane, it is only necessary to determine the constant terms in the equation coefficients. Based on the point cloud corresponding to the object to be measured, which includes multiple three-dimensional points, the first plane and the second plane both belong to the object to be measured. Therefore, when only the constant terms are unknown in the plane equation, the coordinates of the multiple three-dimensional points in the point cloud can be substituted into the plane equation to obtain the values of multiple constant terms. It can be understood that if the thickness of the object to be measured is required, that is, the distance between the first plane and the second plane, then the maximum and minimum values of the constant terms obtained are the constant terms corresponding to the first plane and the second plane. Thus, the plane equation corresponding to the first plane and the plane equation corresponding to the second plane can be obtained.
[0048] Step 150: Calculate the thickness of the object to be measured according to the plane equation.
[0049] Since the plane equation of the first plane and the plane equation of the second plane have been obtained, the thickness of the object to be measured is the distance between the first plane and the second plane. Therefore, the thickness of the object to be measured can be obtained by solving the plane equations.
[0050] In some implementations, after obtaining the thickness of the object to be measured, the electronic device may further determine whether the object to be measured meets a preset condition based on the thickness; if the preset condition is not met, a preset operation is performed.
[0051] The electronic device may store preset conditions in advance, and the preset conditions may be less than a preset threshold value, that is, if the thickness of the object to be measured is less than the preset threshold value, it indicates that the object to be measured meets the preset conditions, and if the thickness of the object to be measured is greater than or equal to the preset threshold value, it indicates that the object to be measured does not meet the preset conditions. When it is determined that the object to be measured does not meet the preset conditions, the electronic device may perform a preset operation, and the preset operation may also be pre-set. Specifically, the preset operation may be an alarm, sending information, etc. Among them, the preset conditions and preset operations can be set according to actual needs, and are not specifically limited here.
[0052] The thickness measurement method provided in the embodiment of the present application obtains a two-dimensional image and a depth map of the current object to be measured and the target object; obtains a standard point cloud including the object to be measured and the target object, aligns the standard point cloud and the current point cloud corresponding to the depth map, and obtains a target plane equation; uses the two-dimensional image and the depth map to locate the object to be measured in the current point cloud, and combines the target plane equation to obtain the plane equations of the first plane and the second plane, and finally calculates the thickness of the object to be measured according to the plane equations. By locating the object to be measured in combination with the two-dimensional image and the depth map, and obtaining the target plane equation through alignment to obtain the plane equations corresponding to the two parallel planes of the object to be measured, the object to be measured can be accurately located, so that the thickness of the object to be measured can be accurately calculated.
[0053] See also Figure 3 Another embodiment of the present application provides a thickness measurement method, which focuses on describing the process of aligning the standard point cloud and the current point cloud to obtain the target plane equation based on the previous embodiment. The specific method may include the following steps.
[0054] Step 210: Acquire a two-dimensional image and a depth map of the current object to be measured and the target object.
[0055] Step 220: Acquire a standard point cloud including the object to be measured and the target object.
[0056] Step 210 and step 220 may refer to the corresponding parts of the aforementioned embodiment and will not be described in detail here.
[0057] Step 230 , roughly matching the current point cloud with the standard point cloud to obtain an initial matching value.
[0058] As mentioned above, the standard point cloud includes a first standard point cloud, a second standard point cloud and a third standard point cloud, wherein the first standard point cloud is a complete point cloud including the object to be measured and the target object, the second standard point cloud is a point cloud of the object to be measured or the target object, and the third standard point cloud is a point cloud of the target plane.
[0059] When performing rough matching, the current point cloud can be registered with the first standard point cloud. Since both the first standard point cloud and the current point cloud include the object to be measured and the target object, and the point cloud features are relatively large, the matching result between the current point cloud and the first standard point cloud is relatively good. After rough matching, an initial matching value can be obtained. Due to the problem of shooting angle, a refined and accurate transformation cannot be obtained. Therefore, fine matching can be continued.
[0060] Step 240: accurately match the current point cloud with the standard point cloud according to the initial matching value to obtain a transformation matrix.
[0061] When performing precise matching, the current point cloud can be registered with the second standard point cloud according to the initial matching value to obtain a transformation matrix. The second standard point cloud is the point cloud of the object to be measured or the target object, that is, a local point cloud. The initial matching value is used as the initial value of precise matching, and the local point cloud is registered with the current point cloud to obtain a transformation matrix.
[0062] Taking the braking system as an example, when the second standard point cloud is the point cloud corresponding to the brake pad and the brake caliper, the brake caliper point cloud can be precisely matched to the current point cloud during precise matching, so as to obtain the transformation matrix of the coordinate system corresponding to the standard point cloud into the coordinate system corresponding to the current point cloud.
[0063] Step 250: Obtain the target point cloud according to the transformation matrix and the standard point cloud.
[0064] After obtaining the transformation matrix, the third standard point cloud, that is, the point cloud of the target plane, can be transformed into the coordinate system corresponding to the current point cloud. Since the transformation matrix is obtained through refined matching, the transformed third standard point cloud can be used as the point cloud of the target plane in the current point cloud, that is, the target point cloud is obtained.
[0065] Step 260, fitting the target plane equation from the target point cloud using a random sampling consensus algorithm.
[0066] After obtaining the target point cloud, the plane equation of the target plane can be calculated based on the target point cloud. Since the target point cloud is the point cloud corresponding to the target plane in the current point cloud, all points in the target point cloud are points on the target plane. Therefore, the random sampling consistency algorithm can be used to fit the three-dimensional plane equation from the target point cloud as the plane equation of the target plane. The random sampling consistency algorithm estimates the parameters of the mathematical model in an iterative manner, so the plane equation of the target plane can be obtained through the algorithm.
[0067] Assume that the plane equation of the target plane is Ax+By+Cz+D=0, A, B, C, D are equation coefficients, and D is a constant term. The equation coefficients of the equation can be obtained by a random sampling consensus algorithm as follows.
[0068] A=y1(z2-z3)+y2(z3-z1)+y3(z1-z2)
[0069] B=z1(x2-x3)+z2(x3-x1)+z3(x1-x2)
[0070] C=x1(y2-y3)+x2(y3-y1)+x3(y1-y2)
[0071] D=-x1(y2z3-y3z2)-x2(y3z1-y1z3)-x3(y1z2-y2z1)
[0072] Among them, (x1, y1, z1), (x2, y2, y3), (x3, y3, z3) are the coordinates of the three-dimensional points in the target point cloud.
[0073] Step 270: Use the two-dimensional image and the depth map to locate the object to be measured in the current point cloud, and combine the target plane equation to obtain the plane equations of the first plane and the second plane.
[0074] Step 280: Calculate the thickness of the object to be measured according to the plane equation.
[0075] Steps 270 to 280 may refer to the corresponding parts of the aforementioned embodiment and will not be described in detail here.
[0076] The thickness measurement method provided in the embodiment of the present application performs a rough match between the current point cloud and the standard point cloud to obtain an initial match value, and then uses the initial match value to perform a fine match to obtain a transformation matrix between the coordinate system corresponding to the current point cloud and the coordinate system corresponding to the standard point cloud; based on the transformation matrix and the standard point cloud, a target point cloud is obtained, and a target plane equation is fitted from the target point cloud, and the target plane equation is then used in the subsequent calculation of the plane equations of the first plane and the second plane to calculate the thickness of the object to be measured according to the plane equation. The object to be measured is located by combining the two-dimensional image and the depth map, and the target plane equation is obtained by registration to obtain the plane equations corresponding to the two parallel planes of the object to be measured, so that the object to be measured can be accurately located, and the thickness of the object to be measured can be accurately calculated.
[0077] See also Figure 4 Another embodiment of the present application provides a thickness measurement method. Based on the above embodiment, the method focuses on calculating the plane equations of the first plane and the second plane, and calculating the thickness of the object to be measured based on the plane equations. The method may include the following steps.
[0078] Step 310: Acquire a two-dimensional image and a depth map of the current object to be measured and the target object.
[0079] Step 320: Acquire a standard point cloud including the object to be measured and the target object.
[0080] Step 330: align the standard point cloud with the current point cloud to obtain a target plane equation.
[0081] Steps 310 to 330 may refer to the corresponding parts of the aforementioned embodiment and will not be described in detail here.
[0082] Step 340: segment the object to be measured from the two-dimensional image using a convolutional neural network, and convert the region of the object to be measured into a point cloud from the depth map.
[0083] In the acquired current two-dimensional image and depth map, the two-dimensional image can be processed, the object to be measured can be segmented from the two-dimensional image using a convolutional neural network, and a point cloud of the object to be measured can be obtained in combination with the depth map.
[0084] When processing the two-dimensional image, the two-dimensional image may be input into a convolutional neural network to obtain the object to be measured. The convolutional neural network used in the embodiment of the present application may be a Mask-RCNN network.
[0085] The Mask-RCNN network is developed on the basis of Faster R-CNN, adding RoIAlign and Fully Convolutional Network (FCN) on its basis. Mask R-CNN splits classification prediction and mask prediction into two branches of the network. The classification prediction branch is the same as Faster R-CNN, which predicts the region of interest, generates category labels and rectangular frame coordinate outputs, and each binary mask generated by the mask prediction branch depends on the classification prediction result, and separates the object based on this moment. Mask R-CNN predicts a binary mask independently for each category to avoid competition between classes. Mask R-CNN is pixel-by-pixel separation. Therefore, the two-dimensional image is input into the Mask R-CNN, and the object to be measured can be segmented from the two-dimensional image.
[0086] After the object to be measured is segmented from the two-dimensional image, since the two-dimensional image and the depth map are aligned, the area of the object to be measured in the depth map can be obtained, and then the point cloud corresponding to the object to be measured is obtained using the internal parameters of the image acquisition device that acquires the depth map.
[0087] Step 350: traverse the point cloud according to a preset conditional formula and obtain the plane equations of the first plane and the second plane in combination with the target plane equation.
[0088] At this point, the electronic device has obtained the target plane equation and the point cloud corresponding to the object to be measured. Since the target plane is parallel to the first plane and the second plane, only the constant term is different in the equation coefficients of the plane equation of the target plane, the plane equation of the first plane, and the plane equation of the second plane.
[0089] As mentioned above, the target plane equation is Ax+By+Cz+D=0, then the plane equation of the first plane may be Ax+By+Cz+D1=0, and the plane equation of the second plane may be Ax+By+Cz+D2=0. Then, in the plane equation of the first plane and the plane equation of the second plane, only the constant terms D1 and D2 are unknown, so the electronic device needs to calculate D1 and D2.
[0090] When calculating D1 and D2, since the point cloud of the object to be measured is obtained, the three-dimensional points in the point cloud of the object to be measured can be traversed according to the preset conditional formula. Wherein, the preset conditional formula is D=0-(A*x+B*y+C*z). Assuming that the number of three-dimensional points in the point cloud of the object to be measured is N, after traversing N three-dimensional points by the preset conditional formula, N D values can be obtained. Among the N D values obtained, the maximum value and the minimum value of the N D values are used as D1 and D2. In other words, D1 and D2 are the maximum value and the minimum value of the multiple D values obtained, respectively.
[0091] Assume that the maximum value among the D values is recorded as D max , the minimum value is recorded as D min , then the plane equation of the first plane is Ax+By+Cz+D max =0, the plane equation of the second plane is Ax+By+Cz+D min =0.
[0092] Step 360: Obtain equation coefficients corresponding to the plane equation of the first plane and the plane equation of the second plane.
[0093] After obtaining the plane equation of the first plane and the plane equation of the second plane, the equation coefficients corresponding to the plane equation of the first plane and the equation coefficients corresponding to the plane equation of the second plane can be obtained. That is, the plane equation coefficients of the first plane are A, B, C, D max , the plane equation coefficients of the second plane are A, B, C, D min .
[0094] Step 370: Calculate the thickness of the object to be measured according to the equation coefficients.
[0095] After obtaining the coefficients of the plane equations corresponding to the first plane and the second plane, the distance between the first plane and the second plane can be calculated according to the following formula, which is the thickness of the object to be measured. In the following formula, dist represents the thickness of the object to be measured.
[0096]
[0097] The thickness measurement method provided in the embodiment of the present application converts the area of the object to be measured into a point cloud from the depth map, which can accurately locate the object to be measured and avoid positioning deviation. And the thickness of the object to be measured is more accurate by calculating the distance between the two planes of the object to be measured.
[0098] See also Figure 5An embodiment of the present application provides a thickness measuring device 400, which can be applied to electronic devices. The thickness measuring device 400 includes an image acquisition module 410, a standard point cloud acquisition module 420, a registration module 430, a plane equation calculation module 440, and a thickness calculation module 450. The image acquisition module 410 is used to acquire a two-dimensional image and a depth map of the current object to be measured and the target object, wherein the object to be measured has a first plane and a second plane parallel to each other, and the target object has a target plane parallel to the first plane and the second plane; the standard point cloud acquisition module 420 is used to acquire a standard point cloud including the object to be measured and the target object; the registration module 430 is used to register the standard point cloud with the current point cloud to obtain a target plane equation, wherein the target plane equation is a plane equation corresponding to the target plane, and the current point cloud is a point cloud corresponding to the depth map; the plane equation calculation module 440 is used to locate the object to be measured in the current point cloud using the two-dimensional image and the depth map, and obtain the plane equations of the first plane and the second plane in combination with the target plane equation; the thickness calculation module 450 is used to calculate the thickness of the object to be measured according to the plane equation.
[0099] Furthermore, the registration module 430 is also used to roughly match the current point cloud with the standard point cloud to obtain initial matching values; accurately match the current point cloud with the standard point cloud based on the initial matching values to obtain a transformation matrix; obtain the target point cloud based on the transformation matrix and the standard point cloud, and the target point cloud is the point cloud corresponding to the target plane in the current point cloud; and use a random sampling consistency algorithm to fit the target plane equation from the target point cloud.
[0100] Furthermore, the standard point cloud includes a first standard point cloud, which is a complete point cloud including the object to be measured and the target object. The registration module 430 is also used to register the current point cloud with the first standard point cloud to obtain a matching initial value.
[0101] Furthermore, the standard point cloud includes a second standard point cloud, which is the point cloud of the object to be measured or the target object. The registration module 430 is also used to register the current point cloud with the second standard point cloud according to the matching initial value to obtain a transformation matrix.
[0102] Furthermore, the standard point cloud includes a third standard point cloud, which is the point cloud of the target plane. The registration module 430 is further used to apply the transformation matrix to the third standard point cloud to obtain the target point cloud.
[0103] Furthermore, the plane equation calculation module 440 is also used to use a convolutional neural network to segment the object to be measured from the two-dimensional image, and convert the area of the object to be measured from the depth map into a point cloud; traverse the point cloud according to a preset conditional formula and combine the target plane equation to obtain the plane equations of the first plane and the second plane.
[0104] Furthermore, the preset conditional formula is D=0-(A*x+B*y+C*z); wherein A, B, C are equation coefficients of the target plane equation, and x, y, z are coordinates of the three-dimensional point in the point cloud.
[0105] Furthermore, the thickness calculation module 450 is further used to obtain equation coefficients corresponding to the plane equation of the first plane and the plane equation of the second plane; and calculate the thickness of the object to be measured according to the equation coefficients.
[0106] Furthermore, preset conditions are pre-stored, and the thickness measuring device 400 also includes an execution module, which is used to calculate the thickness of the object to be measured according to the plane equation, and then determine whether the object to be measured meets the preset conditions according to the thickness; if the object to be measured does not meet the preset conditions, execute a preset operation.
[0107] The thickness measuring device provided in the embodiment of the present application obtains a two-dimensional image and a depth map of the current object to be measured and the target object; obtains a standard point cloud including the object to be measured and the target object, aligns the standard point cloud and the current point cloud corresponding to the depth map, and obtains a target plane equation; uses the two-dimensional image and the depth map to locate the object to be measured in the current point cloud, and combines the target plane equation to obtain the plane equations of the first plane and the second plane, and finally calculates the thickness of the object to be measured according to the plane equation. By locating the object to be measured in combination with the two-dimensional image and the depth map, and obtaining the target plane equation through alignment to obtain the plane equations corresponding to the two parallel planes of the object to be measured, the object to be measured can be accurately located, so that the thickness of the object to be measured can be accurately calculated.
[0108] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0109] See also Figure 6An embodiment of the present application provides a structural block diagram of an electronic device, wherein the electronic device 500 includes a processor 510, a memory 520, and one or more applications, wherein the one or more applications are stored in the memory 520 and are configured to be executed by the one or more processors 510, and the one or more programs are configured to execute the above-mentioned thickness measurement method.
[0110] The electronic device 500 may be a terminal device such as a smart phone, a tablet computer, an e-book, etc. that can run an application program, or may be a server. The electronic device 500 in the present application may include one or more of the following components: a processor 510, a memory 520, and one or more application programs, wherein the one or more application programs may be stored in the memory 520 and configured to be executed by the one or more processors 510, and the one or more programs are configured to execute the method described in the aforementioned method embodiment.
[0111] The processor 510 may include one or more processing cores. The processor 510 uses various interfaces and lines to connect various parts of the entire electronic device 500, and executes various functions and processes data of the electronic device 500 by running or executing instructions, programs, code sets or instruction sets stored in the memory 520, and calling data stored in the memory 520. Optionally, the processor 510 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 510 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 510, but may be implemented separately through a communication chip.
[0112] The memory 520 may include a random access memory (RAM) or a read-only memory (ROM). The memory 520 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 520 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the electronic device 500 during use.
[0113] The electronic device provided in the embodiment of the present application obtains a two-dimensional image and a depth map of the current object to be measured and the target object; obtains a standard point cloud including the object to be measured and the target object, aligns the standard point cloud and the current point cloud corresponding to the depth map, and obtains a target plane equation; uses the two-dimensional image and the depth map to locate the object to be measured in the current point cloud, and combines the target plane equation to obtain the plane equations of the first plane and the second plane, and finally calculates the thickness of the object to be measured according to the plane equation. By locating the object to be measured in combination with the two-dimensional image and the depth map, and obtaining the target plane equation through alignment to obtain the plane equations corresponding to the two parallel planes of the object to be measured, the object to be measured can be accurately located, so that the thickness of the object to be measured can be accurately calculated.
[0114] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0115] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1A device that provides the functions specified in a block or multiple blocks.
[0116] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0117] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0118] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0119] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A thickness measurement method, It is characterized in that The method comprises: Acquire a two-dimensional image and a depth map of a current object to be measured and a target object, wherein the object to be measured has a first plane and a second plane parallel to each other, and the target object has a target plane parallel to the first plane and the second plane; Acquire a standard point cloud including the object to be measured and the target object; The standard point cloud is registered with the current point cloud to obtain a target plane equation, where the target plane equation is a plane equation corresponding to the target plane, and the current point cloud is a point cloud corresponding to the depth map; Locating the object to be measured in the current point cloud using the two-dimensional image and the depth map, and obtaining plane equations of the first plane and the second plane in combination with the target plane equation; Calculating the thickness of the object to be measured according to the plane equation; The registering the standard point cloud with the current point cloud to obtain the target plane equation includes: Roughly matching the current point cloud with the standard point cloud to obtain an initial matching value; According to the matching initial value, the current point cloud is precisely matched with the standard point cloud to obtain a transformation matrix; Obtaining a target point cloud according to the transformation matrix and the standard point cloud, wherein the target point cloud is a point cloud corresponding to the target plane in the current point cloud; Fitting the target plane equation from the target point cloud using a random sampling consensus algorithm; The method of locating the object to be measured in the current point cloud by using the two-dimensional image and the depth map, and obtaining the plane equations of the first plane and the second plane by combining the target plane equation, includes: Segmenting the object to be measured from the two-dimensional image using a convolutional neural network, and converting a region of the object to be measured from the depth map into a point cloud; The point cloud is traversed according to a preset conditional formula and combined with the target plane equation to obtain the plane equations of the first plane and the second plane.
2. The method according to claim 1, It is characterized in that The standard point cloud includes a first standard point cloud, which is a complete point cloud including the object to be measured and the target object. The roughly matching the current point cloud with the standard point cloud to obtain the matching initial value includes: The current point cloud is registered with the first standard point cloud to obtain an initial matching value.
3. The method according to claim 1, It is characterized in that The standard point cloud includes a second standard point cloud, the second standard point cloud is a point cloud of the object to be measured or the target object, and the current point cloud is precisely matched with the standard point cloud according to the matching initial value to obtain a transformation matrix, including: The current point cloud is registered with the second standard point cloud according to the matching initial value to obtain a transformation matrix.
4. The method according to claim 1, It is characterized in that The standard point cloud includes a third standard point cloud, the third standard point cloud is a point cloud of the target plane, and obtaining the target point cloud according to the transformation matrix and the standard point cloud includes: The transformation matrix is applied to the third standard point cloud to obtain a target point cloud.
5. The method according to claim 1, It is characterized in that The preset condition is: D = 0 - (A*x + B*y + C*z); Wherein, A, B, C are the equation coefficients of the target plane equation, and x, y, z are the coordinates of the three-dimensional point in the point cloud.
6. The method according to claim 1, It is characterized in that Calculating the thickness of the object to be measured according to the plane equation includes: Obtaining equation coefficients corresponding to the plane equation of the first plane and the plane equation of the second plane; The thickness of the object to be measured is calculated according to the equation coefficients.
7. The method according to claim 1, It is characterized in that Preset conditions are stored in advance, and after calculating the thickness of the object to be measured according to the plane equation, the method further includes: Determining whether the object to be measured meets the preset condition according to the thickness; If the object to be measured does not meet the preset condition, a preset operation is performed.
8. A thickness measuring device, It is characterized in that The device comprises: An image acquisition module, used to acquire a two-dimensional image and a depth map of the current object to be measured and the target object, wherein the object to be measured has a first plane and a second plane parallel to each other, and the target object has a target plane parallel to the first plane and the second plane; A standard point cloud acquisition module, used to acquire a standard point cloud including the object to be measured and the target object; A registration module, used to register the standard point cloud with the current point cloud to obtain a target plane equation, where the target plane equation is a plane equation corresponding to the target plane, and the current point cloud is a point cloud corresponding to the depth map; A plane equation calculation module, used to locate the object to be measured in the current point cloud using the two-dimensional image and the depth map, and obtain the plane equations of the first plane and the second plane in combination with the target plane equation; A thickness calculation module, used for calculating the thickness of the object to be measured according to the plane equation; The registration module is also used to roughly match the current point cloud with the standard point cloud to obtain an initial matching value; accurately match the current point cloud with the standard point cloud according to the initial matching value to obtain a transformation matrix; obtain a target point cloud according to the transformation matrix and the standard point cloud, the target point cloud being the point cloud corresponding to the target plane in the current point cloud; and fit the target plane equation from the target point cloud using a random sampling consistency algorithm; The plane calculation module is also used to use a convolutional neural network to segment the object to be measured from the two-dimensional image, and convert the object to be measured from the depth map into a point cloud; traverse the point cloud according to a preset conditional formula and combine the target plane equation to obtain the plane equations of the first plane and the second plane.
9. The device according to claim 8, It is characterized in that The thickness calculation module is further used to obtain equation coefficients corresponding to the plane equation of the first plane and the plane equation of the second plane; and calculate the thickness of the object to be measured according to the equation coefficients.
10. An electronic device, It is characterized in that The electronic device comprises: one or more processors; a memory, electrically connected to the one or more processors; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the method according to any one of claims 1 to 7.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Automatic registration method for three-dimensional point cloud data
CN106780459A
Object measurement method and device
CN106813568A
Target positioning method and device, mobile robot and readable storage medium
CN111612841A
