The subject matter herein generally relates to point clouds, and more particularly to an electronic device and a method for simplifying a mesh point cloud by selecting sample points of the mesh point cloud.
Generally, a mesh point cloud is made up of a plurality of points arranged in a triangular structure. The mesh point cloud is used to illustrate surface contours of an object. The mesh point cloud may have more points than necessary, which makes a data size of the mesh point cloud larger than necessary.
Implementations of the present technology will now be described, by way of example only, with reference to the attached figures.
It will be appreciated that for simplicity and clarity of illustration, where appropriate, reference numerals have been repeated among the different figures to indicate corresponding or analogous elements. In addition, numerous specific details are set forth in order to provide a thorough understanding of the embodiments described herein. However, it will be understood by those of ordinary skill in the art that the embodiments described herein can be practiced without these specific details. In other instances, methods, procedures and components have not been described in detail so as not to obscure the related relevant feature being described. The drawings are not necessarily to scale and the proportions of certain parts may be exaggerated to better illustrate details and features. The description is not to be considered as limiting the scope of the embodiments described herein.
Several definitions that apply throughout this disclosure will now be presented.
The term “comprising” means “including, but not necessarily limited to”; it specifically indicates open-ended inclusion or membership in a so-described combination, group, series and the like.
In general, the word “module” as used hereinafter refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language such as, for example, Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware such as in an erasable-programmable read-only memory (EPROM). It will be appreciated that the modules may comprise connected logic units, such as gates and flip-flops, and may comprise programmable units, such as programmable gate arrays or processors. The modules described herein may be implemented as either software and/or hardware modules and may be stored in any type of computer-readable medium or other computer storage device.
Referring to
The obtaining module 100 can obtain a mesh point cloud from a mesh cloud file uploaded to the electronic device 1, and obtain information of a plurality of triangles formed by the mesh point cloud. The information of the plurality of triangles can include coordinate values of the vertex points of the triangles.
The calculating module 101 can calculate a unit normal vector of each vertex point of each triangle. In at least one embodiment, the unit normal vector of each vertex point can be calculated by first determining all adjacent triangles of each vertex point. The adjacent triangles are the triangles that share the same vertex point. For example, referring to
The calculating module 101 can further calculate a decision value of each vertex point. In at least one embodiment, the decision value of a vertex point can be calculated by first calculating a cosine value of an included angle between the unit normal vector of the vertex point and the unit normal vector of each adjacent vertex point, the adjacent vertex points being the vertex points of the adjacent triangles. An average cosine value of the included angles can be calculated. The average cosine value is the decision value of the vertex point. The decision value can be greater than or equal to 0 and less than or equal to 1.
The classifying module 102 can classify the plurality of vertex points into a plurality of classification levels according to the decision values. In at least one embodiment, the vertex points can be arranged in sequence from a smallest decision value to a largest decision value. The vertex points can be classified into an “N” number of classification levels “Ci” (i=1, 2, . . . , N) according to the decision values.
The sampling module 103 can select a plurality of sample vertex points from each of the classification levels. In detail, the plurality of sample vertex points from each of the classification levels can be selected by calculating a total number of required sample vertex points “Numberrequired” of all of the classification levels, calculating a required number of sample vertex points “Cisample” from each classification level to be selected, and selecting the plurality of sample vertex points from the classification levels in sequence from a first classification level C1 to a last classification level CN according to the required number of sample vertex points for each classification level.
In at least one embodiment, the total number of required sample vertex points of all of the classification levels is calculated according to the formula: Numberrequired=k*Numbertotal, wherein “k” is a predetermined sampling ratio, and “Numbertotal” is equal to the number of vertex points of all of the classification levels. In at least one embodiment, the required number of sample vertex points to be selected from each classification level is calculated according to the formula: Cisample=Ri*Numberrequired, wherein “Ri” is a proportion of Numberrequired predetermined by a user. In at least one embodiment, the required number of sample vertex points to be selected from each classification level decreases as the classification level increases. For example, the first classification level C1 requires the greatest number of sample vertex points to be selected, and the last classification level CN requires the fewest number of sample vertex points to be selected.
In at least one embodiment, to select the sample vertex points, the sampling module 103 can compare a total number of vertex points NumberC1 of the first classification level to the corresponding required number of sample vertex points C1sample. When the total number of vertex points of the first classification level is greater than or equal to the corresponding required number of sample vertex points, the sampling module 103 selects the required number of sample vertex points C1sample from the first classification level. When the total number of vertex points of the first classification level is less than the required number of sample vertex points, the sampling module 103 selects all of the vertex points of the first classification level, and adds a remainder number to the required number of sample vertex points to be selected from the second classification level. The remainder number is calculated according to the formula: R1*Numberrequired−NumberC1. Thus, when the remainder number from the first classification level is added to the required number of sample vertex points to be selected from the second classification level, the required number of sample vertex points to be selected from the second classification level is calculated according to the formula: R2*Numberrequired+(R1*NUMberrequired−NumberC1). A process of selecting the sample vertex points from the classification levels and adding a corresponding remainder number to the required number of sample vertex points of a next classification level can be repeated, until the sample vertex points have been selected from all of the classification levels.
After the sample vertex points from all of the classification levels have been selected, the restoring module 104 can restore a triangular structure of the plurality of sample vertex points to obtain a simplified mesh point cloud. In detail, in at least one embodiment, the restoring module 104 can select a reference vertex point not selected as one of the plurality of sample vertex points, and determine a clockwise sequence of all of the plurality of sample vertex points around the reference vertex point. The triangular structure of the sample vertex points can be restored by connecting the odd-numbered sample vertex points in sequence from a first sample vertex point to a last odd-numbered sample vertex point and back to the first sample vertex point, when there are an even number of sample vertex points around the reference vertex point which is deleted after the sampling. For example, referring to
By using the electronic device 1 implementing the point cloud system 10, a mesh point cloud can be effectively simplified, thereby reducing a data size of the mesh point cloud.
At block 501, a mesh point cloud can be obtained from a mesh cloud file uploaded to an electronic device, and information of a plurality of triangles formed by the mesh point cloud can be obtained. In at least one embodiment, the information includes coordinate values of vertex points of the triangles.
At block 502, a unit normal vector of each vertex point of each triangle can be calculated. In at least one embodiment, the unit normal vector of each vertex point can be calculated by first determining all adjacent triangles of each vertex point. The adjacent triangles are the triangles that share the same vertex point. A unit normal vector of each of the adjacent triangles can be calculated, and an average unit normal vector of the adjacent triangles of the vertex point can be calculated. The average unit normal vector is the unit normal vector of the vertex point.
At block 503, a decision value of each vertex point of each triangle can be calculated. In at least one embodiment, the decision value of a vertex point can be calculated by first calculating a cosine value of an included angle between the unit normal vector of the vertex point and the unit normal vector of each adjacent vertex point, the adjacent vertex points being the vertex points of the adjacent triangles. An average cosine value of the included angles can be calculated. The average cosine value is the decision value of the vertex point. The decision value can be greater than or equal to 0 and less than or equal to 1.
At block 504, the vertex points of each triangle can be classified into a plurality of classification levels according to the decision values. In at least one embodiment, the vertex points can be arranged in sequence from a smallest decision value to a largest decision value. The vertex points can be classified into an “N” number of classification levels “Ci” (i=1, 2, . . . , N) according to the decision values.
At block 505, a plurality of sample vertex points from each of the classification levels can be selected. In detail, the plurality of sample vertex points from each of the classification levels can be selected by calculating a total number of required sample vertex points “Numberrequired” of all of the classification levels, calculating a required number of sample vertex points “Cisample” from each classification level to be selected, and selecting the plurality of sample vertex points from the classification levels in sequence from a first classification level C1 to a last classification level CN according to the required number of sample vertex points for each classification level.
In at least one embodiment, the total number of required sample vertex points of all of the classification levels is calculated according to the formula: Numberrequired=k*Numbertotal, wherein “k” is a predetermined sampling ratio, and “Numbertotal” is equal to the number of vertex points of all of the classification levels. In at least one embodiment, the required number of sample vertex points to be selected from each classification level is calculated according to the formula: Cisample=Ri*Numberrequired, wherein “Ri” is a proportion of Numberrequired predetermined by a user. In at least one embodiment, the required number of sample vertex points to be selected from each classification level decreases as the classification level increases. For example, the first classification level C1 requires the greatest number of sample vertex points to be selected, and the last classification level CN requires the fewest number of sample vertex points to be selected.
In at least one embodiment, to select the sample vertex points, a total number of vertex points NumberC1 of the first classification level can be compared to the corresponding required number of sample vertex points C1sample. When the total number of vertex points of the first classification level is greater than or equal to the corresponding required number of sample vertex points, the required number of sample vertex points C1sample can be selected from the first classification level. When the total number of vertex points of the first classification level is less than the required number of sample vertex points, all of the vertex points of the first classification level can be selected, and a remainder number can be added to the required number of sample vertex points to be selected from the second classification level. The remainder number is calculated according to the formula: R1*Numberrequired−NumberC1. Thus, when the remainder number from the first classification level is added to the required number of sample vertex points to be selected from the second classification level, the required number of sample vertex points to be selected from the second classification level is calculated according to the formula: R2*Numberrequired+(R1*Numberrequired−NumberC1). A process of selecting the sample vertex points from the classification levels and adding a corresponding remainder number to the required number of sample vertex points of a next classification level can be repeated, until the sample vertex points have been selected from all of the classification levels.
At block 506, a triangular structure of the plurality of sample vertex points can be restored to obtain a simplified mesh point cloud. In detail, in at least one embodiment, a reference vertex point can be selected. The reference vertex point is a vertex point not selected as one of the plurality of sample vertex points. A clockwise sequence of all of the plurality of sample vertex points around the reference vertex point can be determined. The triangular structure of the sample vertex points can be restored by connecting the odd-numbered sample vertex points in sequence from a first sample vertex point to a last odd-numbered sample vertex point and back to the first sample vertex point, when there are an even number of sample vertex points around the reference vertex point which is deleted after the sampling, thereby restoring the triangular structure of the sample vertex points and obtaining the simplified mesh point cloud. When there is an odd number of sample vertex points around the reference vertex point, the connection of the last odd-numbered sample vertex point back to the first odd-numbered sample vertex point is not necessary since they have already been connected.
The embodiments shown and described above are only examples. Even though numerous characteristics and advantages of the present technology have been set forth in the foregoing description, together with details of the structure and function of the present disclosure, the disclosure is illustrative only, and changes may be made in the detail, including in matters of shape, size and arrangement of the parts within the principles of the present disclosure up to, and including, the full extent established by the broad general meaning of the terms used in the claims.
| Number | Date | Country | Kind |
|---|---|---|---|
| 201410758133.5 | Dec 2014 | CN | national |