A three-dimensional model compression method based on two-dimensional chain code
By using a compression method based on two-dimensional chain codes, the three-dimensional voxel model is segmented and the inner and outer contours and anchor point sequences are extracted and encoded, which solves the problems of storage space and decoding efficiency of the three-dimensional voxel model and achieves more efficient data compression.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- DALIAN NATIONALITIES UNIVERSITY
- Filing Date
- 2022-11-21
- Publication Date
- 2026-06-23
AI Technical Summary
Existing chain code methods suffer from large storage space consumption and long decoding call times in 3D voxel models, and cannot effectively match 3D modeling techniques.
A compression method based on two-dimensional chain codes is adopted. By segmenting the three-dimensional voxel model, the inner and outer contour sequences and anchor point sequences are extracted and encoded, thereby reducing data storage space and decoding call time.
Without compromising model accuracy, it reduces the data storage space required for 3D voxel models and the decoding call time.
Smart Images

Figure HDA0003953158550000011 
Figure HDA0003953158550000012 
Figure HDA0003953158550000021
Abstract
Description
Technical Field
[0001] This invention belongs to the field of three-dimensional voxel model compression technology, specifically relating to a three-dimensional model compression method based on two-dimensional chain code. Background Technology
[0002] Chain code technology is a method that encodes and describes curves or boundaries using a starting coordinate and a direction of travel. It is widely used in computer graphics research due to its advantages such as good region boundary representation and small storage space requirement. In 2D graphics research, commonly used chain code methods include Freeman chain code, vertex chain code, angle difference Freeman chain code, and Huffman-coded vertex chain code. In 3D graphics research, triangle patch chain code and hybrid patch chain code have emerged. However, the current application of chain code methods results in numerous concentrated or scattered gaps and holes in the re-represented models. Furthermore, previous methods often used triangle patches as the basic research object, neglecting the structured information connections in 3D voxel models, making them less compatible with current 3D modeling techniques. Summary of the Invention
[0003] To overcome the shortcomings of existing technologies, this invention provides a three-dimensional model compression method based on two-dimensional chain codes, which can reduce the storage space occupied by three-dimensional voxel model data and the decoding call time without losing the accuracy of the three-dimensional voxel model.
[0004] The technical solution adopted by this invention to solve its technical problem is: a three-dimensional model compression method based on two-dimensional chain code, comprising the following steps:
[0005] S1: Input a 3D voxel model;
[0006] S2: Divide the 3D voxel model to obtain sliced 3D voxel model patches;
[0007] S3: Extract the inner and outer contours and traverse the chain code of the three-dimensional voxel model face to obtain the inner and outer contour sequences, inner and outer contour offset sequences and anchor point sequences of the three-dimensional voxel model face.
[0008] S4: Based on the anchor point sequence of the three-dimensional voxel model facets, obtain multiple anchor point connection information and layer anchor point offset sequence between adjacent three-dimensional voxel model facets;
[0009] S5: Encode the inner and outer contour sequences, inner and outer contour offset sequences, anchor point connection information, and anchor point offset information of the three-dimensional voxel model patches to obtain the three-dimensional voxel model encoding sequence based on two-dimensional chain code compression.
[0010] Furthermore, step S2 includes:
[0011] S21: Select the main dimension traversal direction and layer the 3D voxel model according to the unit cube;
[0012] S22: In the main dimension traversal direction, use the facets of the starting edge of the 3D voxel model as the starting facets of the 3D voxel model facet chain; and store the information of the segmented 3D voxel model facets.
[0013] S23: Repeat step S22 until all layers of the 3D voxel model have been traversed, and obtain the facet information of the segmented 3D voxel model for each layer.
[0014] Furthermore, step S3 includes:
[0015] S31: Based on the information of the segmented three-dimensional voxel model facets, if the three-dimensional voxel model facet does not contain any voxel information, skip the three-dimensional voxel model facet and proceed to the next three-dimensional voxel model facet.
[0016] S32: If the three-dimensional voxel model patch contains voxel information, extract the contour of the voxel information in the three-dimensional voxel model patch to obtain the contour sequence in the two-dimensional patch.
[0017] S33: Traverse the contour sequence in the two-dimensional patch, calculate the center point of each contour based on the extracted contours, i.e., the anchor point of each contour, to obtain the anchor point sequence in the two-dimensional patch.
[0018] S34: If there is still extractable contour information inside the contour, then traverse the contour inside the contour in turn to obtain the inner contour sequence in the two-dimensional patch, calculate the inner contour center point of each inner contour, and calculate the inner contour center point offset with the corresponding outer contour center point to obtain the inner contour offset sequence.
[0019] S35: Connect each contour in the outer contour sequence and the inner contour sequence of the two-dimensional patch with #, and update the contour sequence in the two-dimensional patch.
[0020] S36: Repeat steps S33, S34, and S35 until the contour sequences in all two-dimensional patches are traversed. Connect each contour in the contour sequence of the two-dimensional patch with $ to obtain the inner and outer contour sequences of each two-dimensional patch. Concatenate the inner contour offset sequences of each contour in the contour sequence of the two-dimensional patch to obtain the inner and outer contour offset information of each two-dimensional patch.
[0021] S37: Repeat steps S31, S32, and S36 until all layers of the 3D voxel model have been traversed, obtaining the overall inner and outer contour sequence, the overall inner and outer contour offset sequence, and the overall anchor point sequence.
[0022] Furthermore, step S4 includes:
[0023] S41: Based on the anchor point sequence of the three-dimensional voxel model facets, use the anchor point information of the first layer of three-dimensional voxel model facets as the starting anchor point of the anchor point sequence chain; and store the anchor point information of the first layer of three-dimensional voxel model facets and the anchor point information of the second layer of three-dimensional voxel model facets.
[0024] S42: If there is a disappearance of the outline, that is, the number of anchor points of the first layer 3D voxel model face is more than the number of anchor points of the second layer 3D voxel model face, then remove the connection information of the disappeared anchor points, and calculate the anchor point offset value between the connected anchor points to obtain the anchor point connection information and layer anchor point offset sequence between adjacent layers.
[0025] S43: If there is an increase in the contour, that is, the number of anchor points of the first layer 3D voxel model face is less than the number of anchor points of the second layer 3D voxel model face, then by comparing the correspondence between the new anchor point and all the anchor points in the upper layer, the connection anchor point with the smallest distance is found, the connection information of the new anchor point is added, and the anchor point offset value between the connection anchor points is calculated to obtain the anchor point connection information and the layer anchor point offset sequence between adjacent layers.
[0026] S44: If the contour both disappears and increases at the same time, reset all anchor point connection information and calculate the anchor point offset value between the connection anchor points to obtain the anchor point connection information and layer anchor point offset sequence between adjacent layers.
[0027] S45: Repeat steps S42, S43, and S44 until all layers of the 3D voxel model have been traversed, resulting in the layer offset sequence and the layer connection sequence.
[0028] Furthermore, step S5 includes:
[0029] S51: Traverse the inner and outer contour sequences, connect the inner and outer contours of each layer with the character @ to obtain the corresponding inner and outer contour characters, and compress the inner and outer contour characters using adaptive arithmetic coding to obtain the compressed inner and outer contour characters.
[0030] S52: Connect the inner and outer contour offset sequences with the layer offset sequence and compress the data using the Golomb method to obtain offset compressed characters;
[0031] S53: Traverse the layer connection sequence, record the layer connection information, and obtain the connection characters;
[0032] S54: Concatenate the inner and outer contour compressed characters, offset compressed characters, and connection characters together to obtain a three-dimensional model compressed character based on two-dimensional chain code.
[0033] Furthermore, in step S33, a two-dimensional contour map is obtained through the contour sequence, and the contour map is expanded into a quadrilateral facet. The center point of the quadrilateral facet is taken as the anchor point of the two-dimensional contour.
[0034] Furthermore, in step S34, the negative numbers in the inner contour offset sequence are changed to twice the absolute value of the negative numbers, and the positive numbers are changed to twice their own value minus 1, so as to obtain an inner contour offset sequence that does not include negative numbers.
[0035] The beneficial effects of the present invention include: the method of the present invention can reduce the storage space occupied by the three-dimensional voxel model data and the decoding call time without losing the accuracy of the three-dimensional voxel model. Attached Figure Description
[0036] Figure 1 : Illustration of a three-dimensional voxel model;
[0037] Figure 2 Illustration of a layered, segmented 3D voxel model with facets;
[0038] Figure 3 : Calculate the outline anchor point diagram;
[0039] Figure 4 Animation of the inner contour anchor point offset;
[0040] Figure 5 :Diagram of layered outline anchor point connections;
[0041] Figure 6 : Roadmap for chaincode technology compression. Detailed Implementation
[0042] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0043] Furthermore, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0044] Example 1
[0045] A method for compressing three-dimensional models based on two-dimensional chain codes includes the following steps:
[0046] S1: Input a 3D voxel model;
[0047] S2: Divide the three-dimensional voxel model to obtain sliced three-dimensional voxel model patches (hereinafter referred to as patches);
[0048] S21: Select the main dimension traversal direction and layer the 3D voxel model according to the unit cube;
[0049] S22: In the main dimension traversal direction, use the face of the starting edge as the starting face of the face chain; and store the face information of the segmentation;
[0050] S23: Repeat step S22 until all layers have been traversed, and obtain the segmentation information of each layer.
[0051] S3: By extracting the inner and outer contours of the segmented facets and traversing the chain code, the inner and outer contour sequences, inner and outer contour offset sequences, and anchor point sequences of the segmented facets of the 3D voxel model are obtained.
[0052] S31: Based on the information of the segmented facets, if a facet does not contain any voxel information, skip that facet and proceed to the next facet.
[0053] S32: If the patch contains voxel information, extract the contour of the voxel information in the patch to obtain the contour sequence in the two-dimensional patch.
[0054] S33: Traverse the contour sequence in the two-dimensional patch, calculate the center point of each contour based on the extracted contours, i.e., the anchor point of each contour, to obtain the anchor point sequence in the two-dimensional patch.
[0055] In the above implementation scheme, a two-dimensional contour map is obtained through a contour sequence, and the contour map is expanded into a quadrilateral patch, with the center point of the quadrilateral taken as the anchor point of the two-dimensional contour.
[0056] S34: If there is still extractable contour information inside the contour, then traverse the contour inside the contour in turn to obtain the inner contour sequence in the two-dimensional patch, calculate the inner contour center point of each inner contour, and calculate the inner contour center point offset with the outer contour center point to obtain the inner contour offset sequence.
[0057] In the above implementation scheme, since the offset of the center point can be both positive and negative, which is inconvenient for subsequent calculations, the negative numbers in the inner contour offset sequence are changed to twice the absolute value of the negative number, and the positive numbers are changed to twice their own value minus 1. This yields an inner contour offset sequence that does not include negative numbers.
[0058] S35: Connect the outer contour information in the 2D patch with each contour in the inner contour sequence of the 2D patch using #, and update the contour sequence in the 2D patch.
[0059] S36: Repeat steps S33, S34, and S35 until the contour sequence in all two-dimensional patches is traversed. Connect each contour in the contour sequence of the two-dimensional patch with $ to obtain the inner and outer contour information of each two-dimensional patch. Concatenate the inner contour offset sequence of each contour in the contour sequence of the two-dimensional patch to obtain the inner and outer contour offset information of each two-dimensional patch.
[0060] S37: Repeat steps S31, S32, and S36 until all layers have been traversed, obtaining the overall inner and outer contour sequence, the overall inner and outer contour offset sequence, and the overall anchor point sequence.
[0061] S4: Based on the anchor point connections between the segmented facets, record the connection information of multiple anchor points between adjacent facets and the layer anchor point offset sequence;
[0062] S41: Based on the overall anchor point sequence, use the anchor point information of the first layer as the starting anchor point of the anchor point sequence chain; and store the anchor point information of the first layer and the anchor point information of the second layer.
[0063] S42: If there is a disappearance of the outline, that is, the number of anchor points in the first layer is greater than the number of anchor points in the second layer, then remove the connection information of the disappeared anchor points, and calculate the anchor point offset value between the connected anchor points to obtain the anchor point connection information and the layer anchor point offset sequence between adjacent layers.
[0064] S43: If there is an increase in the outline, that is, the number of anchor points in the first layer is less than the number of anchor points in the second layer, then by comparing the correspondence between the new anchor point and all anchor points in the upper layer, the connection anchor point with the smallest distance is found, the connection information of the new anchor point is added, and the anchor point offset value between the connection anchor points is calculated to obtain the anchor point connection information and the layer anchor point offset sequence between adjacent layers.
[0065] In the above implementation scheme, since the offset of the center point can be both positive and negative, which is inconvenient for subsequent calculations, the negative numbers in the layer anchor point offset sequence are changed to twice the absolute value of the negative number, and the positive numbers are changed to twice their own value minus 1. This yields a layer anchor point offset sequence that does not include negative numbers.
[0066] S44: If the contour both disappears and increases at the same time, reset all anchor point connection information and calculate the anchor point offset value between the connection anchor points to obtain the anchor point connection information and layer anchor point offset sequence between adjacent layers.
[0067] S45: Repeat steps S42, S43, and S44 until all layers have been traversed, obtaining the layer offset sequence and the layer connection sequence.
[0068] S5: Encode the inner and outer contour sequences, inner and outer contour offset sequences, anchor point connection information, and anchor point offset information of the segmented facets of the 3D voxel model to obtain the 3D voxel model encoding sequence based on 2D chain code compression.
[0069] S51: Traverse the entire inner and outer contour sequence, connect the inner and outer contours of each layer with the character @ to obtain the corresponding inner and outer contour characters, and compress the inner and outer contour characters using adaptive arithmetic encoding to obtain the compressed inner and outer contour characters.
[0070] S52: Connect the inner and outer contour offset sequences with the layer offset sequence and compress the data using the Golomb method to obtain offset compressed characters;
[0071] S53: Traverse the layer connection sequence. Since the connection itself is a binary code of 0s and 1s, record the layer connection information to obtain the connection character;
[0072] S54: Concatenate the inner and outer contour compressed characters, offset compressed characters, and connection characters together to obtain a three-dimensional model compressed character based on two-dimensional chain code.
[0073] Example 2
[0074] This embodiment provides a specific implementation plan for the layered segmentation of voxels in step S23 of Embodiment 1:
[0075] Input a 3D voxel model, such as Figure 1 As shown;
[0076] Layered slicing traverses the face information of multiple layers, saving the face information of each layer, such as... Figure 2 As shown in -a, 2-b, and 2-c.
[0077] Example 3
[0078] This embodiment provides a specific implementation plan for obtaining the anchor point in step S33 of Embodiment 1:
[0079] A two-dimensional contour map is obtained through a contour sequence, such as... Figure 3 -a is shown;
[0080] And expand the outline into a quadrilateral facet, such as Figure 3 -b is shown;
[0081] Take the center point of the quadrilateral as its anchor point, such as... Figure 3 -c is shown;
[0082] Mapping the anchor points of the quadrilateral onto the two-dimensional contour map yields the anchor points of the two-dimensional contour, as shown below. Figure 3 -d is shown.
[0083] Example 4
[0084] This embodiment provides a specific implementation plan for the inner contour center offset in step S34 of Embodiment 1:
[0085] The contour maps of the outer and inner contours are obtained through the contour sequence, and the anchor points of the two contours are obtained according to Example 3, such as... Figure 4 As shown in -a and 4-b;
[0086] The anchor points of the two contours are migrated, and the offset information of the anchor points is recorded, such as... Figure 4 -c is shown.
[0087] Example 5
[0088] This embodiment provides a specific implementation plan for the two-dimensional compression method in step S54 of Embodiment 1:
[0089] The corresponding inner and outer contour characters A are obtained and compressed using BWT, MTFT, and adaptive arithmetic coding methods to obtain compressed inner and outer contour characters. The inner and outer contour offset sequences M and layer offset sequences F are concatenated, and the data is compressed using the Golomb method to obtain offset compressed characters. The compressed inner and outer contour characters, offset compressed characters, and concatenation characters S are then concatenated to obtain compressed characters for the 3D model based on 2D chain code. (Example...) Figure 6 As shown.
[0090] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. A method for compressing a three-dimensional model based on a two-dimensional chain code, characterized in that, Includes the following steps: S1: Input a 3D voxel model; S2: Divide the 3D voxel model to obtain sliced 3D voxel model patches; S3: Extract the inner and outer contours and traverse the chain code of the three-dimensional voxel model face to obtain the inner and outer contour sequences, inner and outer contour offset sequences and anchor point sequences of the three-dimensional voxel model face. S4: Based on the anchor point sequence of the three-dimensional voxel model facets, obtain multiple anchor point connection information and layer anchor point offset sequence between adjacent three-dimensional voxel model facets; S5: Encode the inner and outer contour sequences, inner and outer contour offset sequences, anchor point connection information, and anchor point offset information of the three-dimensional voxel model patches to obtain the three-dimensional voxel model encoding sequence based on two-dimensional chain code compression. 2.The method of claim 1, wherein, Step S2 includes: S21: Select the main dimension traversal direction and layer the 3D voxel model according to the unit cube; S22: In the main dimension traversal direction, use the facets of the starting edge of the 3D voxel model as the starting facets of the 3D voxel model facet chain; and store the information of the segmented 3D voxel model facets. S23: Repeat step S22 until all layers of the 3D voxel model have been traversed, and obtain the facet information of the segmented 3D voxel model for each layer. 3.The method of claim 1, wherein, Step S3 includes: S31: Based on the information of the segmented three-dimensional voxel model facets, if the three-dimensional voxel model facet does not contain any voxel information, skip the three-dimensional voxel model facet and proceed to the next three-dimensional voxel model facet. S32: If the three-dimensional voxel model patch contains voxel information, extract the contour of the voxel information in the three-dimensional voxel model patch to obtain the contour sequence in the two-dimensional patch. S33: Traverse the contour sequence in the two-dimensional patch, calculate the center point of each contour based on the extracted contours, i.e., the anchor point of each contour, to obtain the anchor point sequence in the two-dimensional patch. S34: If there is still extractable contour information inside the contour, then traverse the contour inside the contour in turn to obtain the inner contour sequence in the two-dimensional patch, calculate the inner contour center point of each inner contour, and calculate the inner contour center point offset with the corresponding outer contour center point to obtain the inner contour offset sequence. S35: Connect each contour in the outer contour sequence and the inner contour sequence of the two-dimensional patch with #, and update the contour sequence in the two-dimensional patch. S36: Repeat steps S33, S34, and S35 until the contour sequences in all two-dimensional patches are traversed. Connect each contour in the contour sequence of the two-dimensional patch with $ to obtain the inner and outer contour sequences of each two-dimensional patch. Concatenate the inner contour offset sequences of each contour in the contour sequence of the two-dimensional patch to obtain the inner and outer contour offset information of each two-dimensional patch. S37: Repeat steps S31, S32, and S36 until all layers of the 3D voxel model have been traversed, obtaining the overall inner and outer contour sequence, the overall inner and outer contour offset sequence, and the overall anchor point sequence. 4.The method of claim 1, wherein, Step S4 includes: S41: Based on the anchor point sequence of the three-dimensional voxel model facets, use the anchor point information of the first layer of three-dimensional voxel model facets as the starting anchor point of the anchor point sequence chain; and store the anchor point information of the first layer of three-dimensional voxel model facets and the anchor point information of the second layer of three-dimensional voxel model facets. S42: If there is a disappearance of the outline, that is, the number of anchor points of the first layer 3D voxel model face is more than the number of anchor points of the second layer 3D voxel model face, then remove the connection information of the disappeared anchor points, and calculate the anchor point offset value between the connected anchor points to obtain the anchor point connection information and layer anchor point offset sequence between adjacent layers. S43: If there is an increase in the contour, that is, the number of anchor points of the first layer 3D voxel model face is less than the number of anchor points of the second layer 3D voxel model face, then by comparing the correspondence between the new anchor point and all the anchor points in the upper layer, the connection anchor point with the smallest distance is found, the connection information of the new anchor point is added, and the anchor point offset value between the connection anchor points is calculated to obtain the anchor point connection information and the layer anchor point offset sequence between adjacent layers. S44: If the contour both disappears and increases at the same time, reset all anchor point connection information and calculate the anchor point offset value between the connection anchor points to obtain the anchor point connection information and layer anchor point offset sequence between adjacent layers. S45: Repeat steps S42, S43, and S44 until all layers of the 3D voxel model have been traversed, resulting in the layer offset sequence and the layer connection sequence.
5. The three-dimensional model compression method based on two-dimensional chain code according to claim 4, characterized in that, Step S5 includes: S51: Traverse the inner and outer contour sequences, connect the inner and outer contours of each layer with the character @ to obtain the corresponding inner and outer contour characters, and compress the inner and outer contour characters using adaptive arithmetic coding to obtain the compressed inner and outer contour characters. S52: Connect the inner and outer contour offset sequences with the layer offset sequence and compress the data using the Golomb method to obtain offset compressed characters; S53: Traverse the layer connection sequence, record the layer connection information, and obtain the connection characters; S54: Concatenate the inner and outer contour compressed characters, offset compressed characters, and connection characters together to obtain a three-dimensional model compressed character based on two-dimensional chain code.
6. The three-dimensional model compression method based on two-dimensional chain code according to claim 3, characterized in that, In step S33, a two-dimensional contour map is obtained through the contour sequence, and the contour map is expanded into a quadrilateral facet. The center point of the quadrilateral facet is taken as the anchor point of the two-dimensional contour.
7. The three-dimensional model compression method based on two-dimensional chain code according to claim 3, characterized in that, In step S34, the negative numbers in the inner contour offset sequence are changed to twice the absolute value of the negative numbers, and the positive numbers are changed to twice their own value minus 1, so as to obtain an inner contour offset sequence that does not include negative numbers.