A coarse-to-fine alignment method for cheongsam 3D point cloud models
By converting the point cloud model into a voxel model and calculating the cross-sectional modulus, the data noise and rotation error problems in point cloud model alignment are solved, and the precise alignment of clothing customization and replication is achieved.
Patent Information
- Application Number
- CN202310907609.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-21
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2043-07-21
AI Technical Summary
In the prior art, the precise alignment of point cloud models has problems with data noise, manual rotation error and coordinate system offset, resulting in registration errors, lack of automated processing capabilities, and it is difficult to achieve efficient and accurate alignment.
The least squares method is used to solve the rotation matrix and the translation vector, the point cloud model is converted into a voxel model, the cross-sectional modulus is calculated using the full state space exhaustive method, the key section is semi-automatically identified, and the coordinate axis alignment position and direction are determined by analyzing the extreme value of the point cloud data and grid processing.
Accurate alignment of point cloud models is achieved, manual participation is reduced, data noise and manual rotation quality problems are handled, suitable for personalized clothing customization and lossless clothing replication.
Smart Images

Figure CN117078727B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the intersection of computer vision and graphics processing and clothing design and manufacturing, and specifically relates to a coarse-to-fine cheongsam three-dimensional point cloud model alignment method. Background Art
[0002] In the fields of computer vision and graphics, precise alignment of point cloud models remains a challenging problem due to the complexity and noise of point cloud data. Point cloud data acquired with handheld 3D scanning devices can lead to registration errors due to data noise, model rotation axis offsets caused by manual rotation, coordinate system offsets, and additional rotation or translation errors during scanning. This often requires manual operation or time-consuming iterative algorithms, relying on manual identification and processing of key sections. This lacks automated processing capabilities, making efficient and accurate alignment impossible. Summary of the Invention
[0003] The purpose of the present invention is to provide a coarse-to-fine method for aligning cheongsam three-dimensional point cloud models. In response to the defects in the prior art, the least squares method is used to solve the rotation matrix and translation vector, and the point cloud model is converted into a voxel model. The full state space exhaustive method is used to perform exhaustive enumeration in the neighborhood of the state space, and the optimal translation transformation is found by calculating the cross-sectional modulus to achieve precise alignment of the cheongsam model. At the same time, the method can semi-automatically identify key sections, reducing manual participation in the alignment process. While dealing with data noise and manual rotation quality issues, and solving the problem of inconsistent model coordinate axis rotation, the position and direction of coordinate axis alignment are determined by analyzing the extreme values and gridding of the point cloud data, thereby achieving accurate alignment between point cloud models, which is helpful for realizing applications such as personalized clothing customization and lossless clothing replication.
[0004] In order to solve the above technical problems, the following technical solutions are adopted:
[0005] A coarse-to-fine cheongsam three-dimensional point cloud model alignment method is characterized by comprising the following steps:
[0006] (1) Use a handheld 3D scanning device to obtain comprehensive 3D point cloud data of the mannequin and cheongsam;
[0007] (2) Manual alignment of coordinate axis rotation;
[0008] (3) Converting the point cloud model into a voxel model;
[0009] (4) Create a logical array;
[0010] (5) Extract the “top” section of the model and calculate the center of gravity;
[0011] (6) Calculate the translation in the lateral direction and align the center of gravity of the cross section;
[0012] (7) Processing of isolated pixels in each section at the same height;
[0013] (8) The union of two sections at the same height is defined as the penetration modulus;
[0014] (10) Calculate the average penetration modulus by exhaustively enumerating all effective sections;
[0015] (10) Find the translation transformation with the lowest average penetration modulus for alignment.
[0016] After optimization, the step (1) is as follows: the handheld three-dimensional scanning device includes a collection device and a mannequin device, the collection device includes a scanning height adjustment rod, a handheld scanner and a universal wheel, the scanning height adjustment rod is provided with the handheld scanner, and the bottom of the scanning height adjustment rod is provided with a universal wheel; the mannequin device includes a mannequin, a base and a mannequin height adjustment rod, the base is provided with the mannequin height adjustment rod, and the mannequin height adjustment rod is provided with the mannequin; an upper telescopic rod and a lower telescopic rod are connected between the mannequin height adjustment rod and the scanning height adjustment rod, and the distance between the collection device and the mannequin device can be adjusted by the upper telescopic rod and the lower telescopic rod; the scanning process includes:
[0017] a. Installing the handheld 3D scanning device: The avatar, wearing a cheongsam, is mounted on the base using the avatar height adjustment rod. The handheld scanner is mounted and fixed on the acquisition height adjustment rod, with the handheld scanner facing the avatar. After installation, the handheld scanner and the avatar are adjusted in height to match each other. Finally, the upper and lower telescopic rods are connected.
[0018] b. Distance adjustment before scanning: Before scanning, adjust the distance between the mannequin device and the acquisition device; debug the handheld scanner, calibrate it to eliminate system errors, determine the appropriate scanning distance α, and then adjust the upper telescopic rod and the lower telescopic rod to the distance α;
[0019] c. Acquisition of depth information: The handheld scanner is fixed at the upper, middle, and lower positions of the cheongsam's scannable range, and the mannequin is used as the central axis of rotation. With a radius of α, the mannequin performs a circular motion at a constant speed for a total of three rotations until the complete cheongsam 3D point cloud data is obtained.
[0020] After optimization, the step (2) provides two 3D point cloud models to be aligned, ptCloud_1 and ptCloud_2, which are the 3D point cloud model of the mannequin and the 3D point cloud model of the cheongsam respectively, and uses the compose_rotation function to construct a 3x3 rotation matrix compose_rotation(theta_x, theta_y, theta_z), where theta_x, theta_y and theta_z are the rotation angles of each axis, accepts three angles as input, and outputs a rotation matrix;
[0021] a. For rotation around the x-axis, the rotation matrix X is:
[0022] b. For rotation around the y-axis, the rotation matrix Y is:
[0023] c. For rotation around the z-axis, the rotation matrix Z is:
[0024] d. Combine these three rotation matrices together through matrix multiplication to obtain the total rotation matrix R: R = Z*Y*X.
[0025] After optimization, in step (3), the point cloud models ptCloud_1 and ptCloud_2 are converted into voxel models voxel_data_1 and voxel_data_2 using the convert_to_voxel(ptCloud, metadata, params) function, and the spatial resolution of the voxel models is set; the conversion process is as follows:
[0026] a. Create voxel array: Create a three-dimensional array based on the spatial resolution and range of the voxel model to represent the voxel model. The size of the array is determined by the boundary of the voxel model and is divided into small voxel units according to the spatial resolution.
[0027] b. Mapping point cloud to voxel coordinates: For each point in the point cloud, map it to the corresponding voxel coordinates according to its coordinates;
[0028] c. Set voxel value: traverse each point in the point cloud and set its corresponding voxel coordinate position in the voxel array to True. By counting the number of points found at this position, decide whether to set the voxel to True. In this way, the True value in the voxel model indicates that there is point cloud data in the voxel.
[0029] Through the above conversion process, the point cloud model is converted into a voxel model and represented as a three-dimensional array, where each array element represents a voxel unit, the True value indicates that there is point cloud data in the voxel unit, and the False value indicates that there is no point cloud data.
[0030] After optimization, in step (4), a three-dimensional logical array "voxel_data" is constructed according to the distribution of the point cloud data on the Z axis. In this logical array, each layer of the Z axis represents a cross section at a different height. For a cross section of any layer of Z value, it is obtained by accessing "voxel_data(:,:,Z)". In the logical array, each voxel unit is represented as a Boolean value, True indicates that the voxel exists, and False indicates that it does not exist. By constructing the logical array, the distribution of the voxel model on cross sections at different heights is visualized and analyzed.
[0031] Assume that the dimension of voxel_data is (X, Y, Z), where X and Y represent the width and length of the plane, and Z represents the height of the section. Access voxel_data(:,:,Z) to get the section of the Z layer, which will return a two-dimensional logical array describing the voxel distribution on the section at that height. By analyzing this two-dimensional logical array, we can get the voxel information on the section at a specific height.
[0032] After optimization, in step (5), first, by retrieving the voxel data of the mannequin model and the cheongsam model, accessing the Z-axis extreme values in the voxel data structure of the model to obtain their ranges on the Z axis; storing the maximum Z value of the mannequin model in the Z_max_model variable, and storing the maximum Z value of the cheongsam model in the Z_max_qipao variable;
[0033] The centroids of the two Z-value sections are calculated and stored in the centroid_3D_model and centroid_3D_qipao variables. These centroids represent the average height position of the corresponding models on the Z axis. The average height position of the model on the Z axis can be obtained by calculating the coordinate average of the model point cloud, that is, the average of the X, Y, and Z coordinate components.
[0034] By extracting the maximum value of the Z axis and calculating the center of gravity of the section, the height range and average height position of the model in the vertical direction are obtained, which are used to determine the vertical position relationship of the model.
[0035] After optimization, the step (6) compares the center of gravity positions of the two models by calculating the difference between the cross-sectional center of gravity, and calculates their differences on the X, Y and Z axes; next, the translation of the model on the X, Y and Z axes is estimated, and the difference is divided by the grid size according to the grid size for standardization; then, the difference is quantified into the number of discrete grid units by rounding down; finally, it is multiplied by the grid size to obtain an estimate of the translation in the actual space, and the result is saved in the `trans_X_model_rough`, `trans_Y_model_rough` and `trans_Z_model_rough` variables; through the above calculations and operations, the translation of the model on the X, Y and Z axes can be estimated, and the cross-sectional center of gravity of the model can be aligned.
[0036] After the optimization, the step (7) is to loop through each section of the model within a given search range; for each section, the voxel data voxel_data_model of the model and the voxel data voxel_data_qipao of the cheongsam are obtained;
[0037] The voxel data of the model and cheongsam are preprocessed through a series of morphological operations; these operations include bridging, cleaning and filling, which are implemented by the bwmorph function; the bridging operation is used to connect the disconnected parts in the voxels, the cleaning operation is used to remove small noisy voxels, and the filling operation is used to fill the holes in the cross section.
[0038] After optimization, the step (8) merges the pre-processed mannequin cross-sectional voxel data BW_model and the qipao cross-sectional voxel data BW_qipao to generate a merged binary image `BW_merge`. The merge operation uses the logical operator OR to perform a logical OR operation on the two binary images to obtain the common area of the mannequin model and the qipao model; then the areas of BW_qipao and BW_merge are calculated. If the area of BW_merge is greater than the area of BW_qipao, the cross-sectional wear modulus is defined as the difference between the two areas;
[0039] Use `vision.BlobAnalysis` to perform regional analysis and connected region analysis on the merged binary image BW_merge to obtain information about the region shape, size, and position, and further analyze the differences between the models;
[0040] In the region analysis, we first create a `vision.BlobAnalysis` object and set the `MaximumCount` property to 1 to ensure that only the largest connected region is obtained. Then, we perform connected region analysis on the merged binary image `BW_merge`. We obtain information about the connected regions by calling the `Hblob` object and passing in the binary image. The area of the connected region represents the number of pixels in the region, and the center of gravity represents the center of the region.
[0041] Through connected region analysis, the properties of the connected regions in the merged binary image are obtained, including the area and center of gravity of the penetration modulus.
[0042] After optimization, the step (9) is cycled on each effective cross section:
[0043] Preprocess the voxel data BW_model of the mannequin model and BW_qipao of the cheongsam model of the current section, and use the bwmorph function to perform bridging and cleaning operations; create a merged binary image BW_merge, and use the logical operator OR to perform a logical OR operation on BW_model and BW_qipao; use the vision.BlobAnalysis object to perform connected region analysis; set the MaximumCount property to 1 to ensure that only the largest connected region is obtained; perform connected region analysis on the merged binary image BW_merge to obtain the properties of the connected region, including area and center of gravity; if the area of the connected region is greater than or equal to the area of the cheongsam model, calculate the penetration modulus of the section; save the center of gravity difference in the dev_centroid array, and save the penetration modulus in the area_chuanmo array;
[0044] After the loop completes, the average of the center of gravity differences and the penetration is calculated to obtain the average penetration. By exhaustively enumerating all valid cross-sections and calculating the center of gravity differences and penetration, the degree of variation in the model across all cross-sections can be comprehensively considered. The average penetration provides a measure of the overall similarity between the model and the cheongsam, helping to assess the consistency and matching between the models.
[0045] After optimization, the step (10) exhaustively enumerates all possible displacements by changing the coordinates of each voxel, and then selects the optimal alignment method by calculating the center of gravity deviation and the roughness: the translation of the model on the X, Y and Z axes is estimated based on the average roughness and the center of gravity difference; wherein the translation of the X axis is trans_X_model_rough, the translation of the Y axis is trans_Y_model_rough, and the translation of the Z axis is trans_Z_model_rough;
[0046] Next, a loop is used to fine-tune the translation within the given search range to find the alignment result with the lowest average penetration. The search range is determined by the search_area_refinement_lateral search range and the search_area_refinement_vertical search range. In each iteration, a temporary rigid transformation tform_Z_model_temp is constructed based on the fine-tuned translation, and the mannequin model is translated using this transformation. The translated mannequin model is converted into a voxel model, and the penetration-related parameters of the translated model and the cheongsam model are calculated by calling the compare_voxel function, including the center of gravity difference and penetration. The penetration-related parameters are saved in the results array to record the results of each iteration.
[0047] After the loop is completed, the alignment result with the lowest average penetration is found based on the minimum penetration among all iterative results, and the corresponding translation is obtained; the optimal translation is applied to the rigid transformation to obtain the final alignment transformation tform;
[0048] Using the final alignment transformation, the mannequin model is translated to obtain the translated voxel model; the translated voxel model is converted into voxel data and saved in voxel_data_model_registered; through the above process, the alignment result with the lowest average penetration is found, and the corresponding translation transformation is obtained; this process is based on the measurement of penetration, and the optimal alignment result is found by continuously fine-tuning the translation amount to achieve accurate alignment of the mannequin model and the cheongsam model.
[0049] The above technical solution has the following beneficial effects:
[0050] The present invention solves the rotation matrix and translation vector through the least squares method, converts the point cloud model into a voxel model, and uses the full state space exhaustive method to perform exhaustive enumeration in the neighborhood of the state space. By calculating the cross-sectional wear modulus, the optimal translation transformation is found to achieve precise alignment of the cheongsam model. At the same time, the method can semi-automatically identify key sections, reducing manual participation in the alignment process. While dealing with data noise and manual rotation quality issues, and solving the problem of inconsistent model coordinate axis rotation, the position and direction of coordinate axis alignment are determined by analyzing the extreme values and gridding of the point cloud data, thereby achieving accurate alignment between point cloud models, which helps to realize applications such as personalized clothing customization and lossless clothing replication.
[0051] This method can achieve precise alignment of the coordinate axes of a point cloud model while maintaining overall alignment accuracy. It can effectively address issues such as data noise and manual rotation quality, and maintains good alignment even in the presence of minor localized penetration.
[0052] This invention uses a handheld scanner to scan qipao at different orientations and angles, achieving uniform and comprehensive sampling and facilitating the acquisition and processing of point cloud data. Two height adjustment levers allow the scanner to be positioned at the optimal scanning position, achieving uniform, comprehensive, and clear sampling and facilitating subsequent data processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The present invention will be further described below with reference to the accompanying drawings
[0054] Figure 1 is a flow chart of the present invention;
[0055] Figure 2 Schematic diagram of the structure of the clothing three-dimensional scanning device of the present invention;
[0056] Figure 3 Schematic diagram of point cloud data of three-dimensional scanning of clothing of the present invention (a);
[0057] Figure 4 (b) is a schematic diagram of point cloud data of three-dimensional scanning of clothing of the present invention;
[0058] Figure 5 This is a schematic diagram of the three-dimensional model before alignment of the present invention;
[0059] Figure 6 This is a schematic diagram of the alignment result of the three-dimensional model after rough alignment of the present invention;
[0060] Figure 7 This is a schematic diagram of the three-dimensional model alignment result after precise alignment of the present invention. DETAILED DESCRIPTION
[0061] The technical solution of the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0062] A coarse-to-fine cheongsam 3D point cloud model alignment method comprises the following steps:
[0063] (1) Scan and obtain the 3D point cloud model of the mannequin and cheongsam:
[0064] like Figure 2As shown, the scanning device includes a collection device and a mannequin device. The mannequin device includes a mannequin 1 and a cheongsam 2. The collection device includes a handheld scanner 6. The handheld scanner 6 scans the cheongsam 2 on the mannequin device, thereby obtaining point cloud data of the cheongsam 2. A universal wheel 7 is provided at the bottom of the collection device, so that the collection device can rotate around the mannequin device. The present invention connects the collection device and the mannequin device through a mechanical device, establishes a connection relationship between the two, and makes the entire scanning device more stable. In addition, the mechanical device cooperates with the universal wheel 7, so that the scanning device can rotate around the mannequin device, and the handheld scanner 6 can scan the cheongsam in different directions and angles, so as to achieve the purpose of uniform and comprehensive sampling, and facilitate the acquisition and processing of point cloud data.
[0065] The acquisition device also includes a scanning height adjustment rod 5, on which a handheld scanner 6 is mounted, and a universal wheel 7 is provided at the bottom of the scanning height adjustment rod 5; the mannequin device includes a mannequin 1, a base 4 and a mannequin height adjustment rod 3, which is mounted on the base 4;
[0066] The scanning device also includes an upper telescopic rod 8 and a lower telescopic rod 9. The upper telescopic rod 8 connects the top of the mannequin 1 to the top of the scanning height adjustment rod 5, while the lower telescopic rod 9 connects the node of the base 4 to the bottom of the scanning height adjustment rod 5. The upper telescopic rod 8 and the lower telescopic rod 9 respectively secure the upper and lower endpoints of the acquisition device and the mannequin, maintaining the stability of the acquisition device during rotation. The upper and lower telescopic rods 8 and 9 are also retractable, allowing for easy adjustment of the distance between the acquisition device and the mannequin to meet varying scanning requirements.
[0067] The scanning height adjustment lever 5 and the mannequin height adjustment lever 3 are used to adjust the height of the handheld scanner 6 and the mannequin 1 (i.e., the qipao 2), enabling the scanner to be positioned at the optimal scanning position, achieving uniform, comprehensive, and clear sampling and facilitating subsequent data processing. Furthermore, the scanning device can be provided with a fixed track 10, on which the universal wheels 7 of the acquisition device move, making the entire process more stable, achieving uniform sampling, and facilitating subsequent data processing.
[0068] The specific steps are as follows:
[0069] a. Install the scanning device: Mannequin 1 wears a cheongsam 2 and is mounted on a base 4 using a mannequin height adjustment rod 3. A handheld scanner 6 is mounted and fixed on the scanning height adjustment rod 5 of the acquisition device, with the handheld scanner 6 facing the mannequin device. After installation, adjust the height of the handheld scanner 6 and mannequin 1 so that they match. Then, adjust the upper telescopic rod 8 and the lower telescopic rod 9 to the same length and connect the mannequin device and the acquisition device respectively.
[0070] b. Adjust the distance between the device before scanning: Adjust the distance between the mannequin device and the acquisition device before scanning; debug the handheld scanner 6, calibrate it to eliminate system errors, and then determine the appropriate scanning distance α to ensure a certain acquisition data density, and then adjust the upper telescopic rod 8 and the lower telescopic rod 9 to this distance length α.
[0071] c. Acquisition of depth information
[0072] The handheld scanner 6 is fixed at the upper, middle, and lower parts of the cheongsam 2 scanning range in sequence. The mannequin 1 is used as the central axis of rotation, and the radius is α. The mannequin 1 is rotated in a uniform circular motion for three rotations until the complete cheongsam 2 3D point cloud data is obtained. By controlling the handheld scanner 6 to move on the fixed track 10, the entire process can be made more stable, achieving uniform sampling and facilitating subsequent data processing. The schematic diagram of the 3D model before alignment is shown in the attached figure. Figure 5 shown.
[0073] (2) Manual alignment of coordinate axis rotation:
[0074] Provide two 3D point cloud models to be aligned, ptCloud_1 and ptCloud_2, which are the 3D point cloud model of the mannequin and the 3D point cloud model of the cheongsam, as shown in the attached figure. Figure 3 and Figure 4 As shown. Use the compose_rotation function to construct a 3x3 rotation matrix compose_rotation(theta_x, theta_y, theta_z), where theta_x, theta_y, and theta_z are the rotation angles about each axis. It accepts three angles as input and outputs a rotation matrix.
[0075] a. For rotation around the x-axis, the rotation matrix X is:
[0076] b. For rotation around the y-axis, the rotation matrix Y is:
[0077] c. For rotation around the z-axis, the rotation matrix Z is:
[0078] d. Combine these three rotation matrices together through matrix multiplication to obtain the total rotation matrix R: R = Z*Y*X.
[0079] The compose_rotation function accepts three angles as input and outputs a rotation matrix. This rotation matrix can be used to rotate the coordinate system of one model to the coordinate system of another model. This eliminates rotation differences between the models, allowing for manual alignment of the two models and resolving issues where scan data from different objects may result in different coordinate axes and origins during the scanning process.
[0080] (3) Converting point cloud model to voxel model:
[0081] Use the convert_to_voxel(ptCloud,metadata,params) function to convert the point cloud models ptCloud_1 and ptCloud_2 into voxel models voxel_data_1 and voxel_data_2. This function controls the spatial resolution of the voxel model by setting the parameter grid_size. Here, the spatial resolution of the voxel model is set to 5mm. The specific conversion process is as follows:
[0082] a. Create a voxel array: Create a three-dimensional array to represent the voxel model based on the spatial resolution and range of the voxel model. The size of the array is determined by the boundaries of the voxel model and is divided into small voxel units based on the spatial resolution;
[0083] b. Mapping point cloud to voxel coordinates: For each point in the point cloud, map it to the corresponding voxel coordinates according to its coordinates. This can be done by dividing the point cloud coordinates by the voxel spatial resolution of 5mm and rounding to get the voxel coordinates;
[0084] c. Set voxel value: Iterate over each point in the point cloud and set the corresponding voxel coordinate position in the voxel array to True. You can determine whether to set the voxel to True by counting the number of points found at that position. In this way, a True value in the voxel model indicates that point cloud data exists in that voxel.
[0085] Through this conversion process, we can convert the point cloud model into a voxel model and represent it as a three-dimensional array, where each array element represents a voxel unit, the True value indicates that there is point cloud data in the voxel unit, and the False value indicates that there is no point cloud data.
[0086] (4) Create a logical array:
[0087] Based on the distribution of the point cloud data along the Z axis (height), a three-dimensional logical array "voxel_data" is constructed. In this logical array, each Z-axis layer represents a cross-section at a different height. Cross-sections at any layer (Z value) can be retrieved by accessing "voxel_data(:,:,Z)". In the logical array, each voxel cell can be represented as a Boolean value: True indicates the voxel exists, and False indicates its absence. By constructing the logical array, we can visualize and analyze the distribution of the voxel model at different cross-section heights.
[0088] Assume that the dimensions of voxel_data are (X, Y, Z), where X and Y represent the width and length of the plane, and Z represents the height of the section. By accessing voxel_data(:,:,Z), you can get the section at layer Z, which will return a two-dimensional logical array describing the distribution of voxels at that height. By analyzing this two-dimensional logical array, you can obtain voxel information at a specific height, such as determining which voxels exist in that section, as well as their positions and distribution.
[0089] (5) Extract the “top” section of the model and calculate the center of gravity:
[0090] First, by retrieving the voxel data of the mannequin model and the qipao model, accessing the Z-axis extreme values in the model's voxel data structure to obtain their Z-axis ranges. The maximum Z value of the mannequin model is stored in the Z_max_model variable, and the maximum Z value of the qipao model is stored in the Z_max_qipao variable.
[0091] The centroids of the two Z-valued cross sections are calculated and stored in the centroid_3D_model and centroid_3D_qipao variables. These centroids represent the average height of the corresponding model along the Z axis. The average height of the model along the Z axis can be obtained by calculating the coordinate average of the model point cloud (that is, the average of the X, Y, and Z coordinate components).
[0092] By extracting the maximum value of the Z axis and calculating the center of gravity of the section, the height range and average height position of the model in the vertical direction can be obtained, which is used to determine the vertical position relationship of the model so as to perform accurate model alignment and matching in subsequent processing.
[0093] (6) Calculate the lateral translation and align the center of gravity of the cross section:
[0094] The locations of the two models' centers of gravity are compared by calculating the difference between the cross-section centers of gravity and calculating their differences in the X, Y, and Z axes. Next, a rough estimate of the model's translation in the X, Y, and Z axes is obtained, and the differences are normalized by dividing them by the grid size. The differences are then quantized to the number of discrete grid cells by rounding them down. Finally, they are multiplied by the grid size to obtain an estimate of the translation in real space, and the results are stored in the `trans_X_model_rough`, `trans_Y_model_rough`, and `trans_Z_model_rough` variables.
[0095] Through these calculations and operations, we can roughly estimate the translation of the model in the lateral direction (X and Y axes) and the height direction (Z axis), and align the center of gravity of the model section. This helps to achieve a rough alignment between models and provides a basis for subsequent fine alignment and matching operations.
[0096] The alignment result of the 3D model after rough alignment is shown in the attached figure. Figure 6 shown.
[0097] (7) Processing of outlier pixels in each section at the same height:
[0098] In the given search range, loop through each section of the model. For each section, get the voxel data voxel_data_model of the model and the voxel data voxel_data_qipao of the cheongsam.
[0099] The voxel data of the model and qipao are preprocessed through a series of morphological operations. These operations include bridging, cleaning, and filling, implemented using the bwmorph function. Bridging connects disconnected voxels, cleaning removes small noisy voxels, and filling fills holes in cross-sections.
[0100] (8) The union of two sections at the same height is defined as the penetration modulus:
[0101] Merge the preprocessed mannequin cross-sectional voxel data (BW_model) and the qipao cross-sectional voxel data (BW_qipao) to generate a merged binary image (BW_merge). The merge operation uses the logical OR operator to perform a logical OR operation on the two binary images, obtaining the common area between the mannequin model and the qipao model. The areas of BW_qipao and BW_merge are then calculated. If the area of BW_merge is greater than that of BW_qipao, the cross-sectional penetration modulus is defined as the difference between the two areas.
[0102] Use `vision.BlobAnalysis` to perform region analysis and connected region analysis on the merged binary image BW_merge to obtain information about the region shape, size, and location, and further analyze the differences between models.
[0103] In the region analysis, we first create a `vision.BlobAnalysis` object and set the `MaximumCount` property to 1 to ensure that only the largest connected regions are obtained. We then perform connected region analysis on the merged binary image `BW_merge`. By calling the `Hblob` object and passing it the binary image, we can obtain information about the connected regions. The area of a connected region represents the number of pixels in the region, and the centroid represents the center of the region.
[0104] Connected region analysis can be used to obtain the properties of connected regions in the merged binary image, including the area and center of gravity of the penetration volume. These properties are used in subsequent analysis and calculations, such as comparing difference metrics between models and evaluating cross-sectional similarity.
[0105] (9) Calculate the average penetration modulus by exhaustively enumerating all effective sections:
[0106] Loop over each valid cross section:
[0107] Preprocess the voxel data BW_model of the mannequin model and BW_qipao of the cheongsam model of the current section, and use the bwmorph function to perform bridging, cleaning, and other operations. Create a merged binary image BW_merge, and use the logical operator OR to perform a logical OR operation on BW_model and BW_qipao. Use the vision.BlobAnalysis object to perform connected region analysis. Set the MaximumCount property to 1 to ensure that only the largest connected region is obtained. Perform connected region analysis on the merged binary image BW_merge to obtain the properties of the connected region, including area and center of gravity. If the area of the connected region is greater than or equal to the area of the cheongsam model, calculate the penetration modulus of the section. Save the center of gravity difference in the dev_centroid array and the penetration modulus in the area_chuanmo array.
[0108] After the loop completes, the average of the center of gravity differences and the penetration is calculated to obtain the average penetration. By exhaustively enumerating all valid cross-sections and calculating the center of gravity differences and penetration, the degree of variation in the model across all cross-sections can be comprehensively considered. The average penetration provides a measure of the overall similarity between the model and the cheongsam, helping to assess the consistency and matching between the models.
[0109] (10) Find the translation transformation with the lowest average penetration modulus for alignment:
[0110] By changing the coordinates of each voxel, all possible displacements are exhausted, and then the optimal alignment method is selected by calculating the center of gravity deviation and wear. Based on the average wear and center of gravity difference, the model's translation on the X, Y, and Z axes is roughly estimated. The X-axis translation is trans_X_model_rough, the Y-axis translation is trans_Y_model_rough, and the Z-axis translation is trans_Z_model_rough.
[0111] Next, using a loop traversal method, the translation amount is fine-tuned within the given search range to find the alignment result with the lowest average penetration. The search range is determined by search_area_refinement_lateral (lateral search range) and search_area_refinement_vertical (vertical search range). In each iteration, a temporary rigid transformation tform_Z_model_temp is constructed based on the fine-tuned translation amount, and the mannequin model is translated using this transformation. The translated mannequin model is converted into a voxel model, and the penetration-related parameters of the translated model and the cheongsam model are calculated by calling the compare_voxel function, including the center of gravity difference and penetration. The penetration-related parameters are saved in the results array to record the results of each iteration.
[0112] After the loop is finished, the alignment result with the lowest average penetration is found based on the minimum penetration among all iterative results, and the corresponding translation is obtained. The optimal translation is applied to the rigid transformation to obtain the final alignment transformation tform.
[0113] Using the final alignment transformation, the mannequin model is translated to obtain the translated voxel model. The translated voxel model is converted into voxel data and saved in voxel_data_model_registered.
[0114] Through the above process, the alignment result with the lowest average penetration is found and the corresponding translation transformation is obtained. This process is based on the measurement of penetration and the optimal alignment result is found by continuously fine-tuning the translation to achieve accurate alignment of the mannequin model and the cheongsam model. The schematic diagram of the precise alignment result is shown in the attached figure. Figure 6 shown.
[0115] Through the above method, the present invention can achieve precise alignment of the coordinate axes of the point cloud model while maintaining overall alignment accuracy. This method can effectively deal with issues such as data noise and manual rotation quality, and can still maintain good alignment results even in the presence of localized weak penetration.
[0116] The above are only specific embodiments of the present invention, but the technical features of the present invention are not limited thereto. Any simple changes, equivalent substitutions, or modifications based on the present invention to solve substantially the same technical problems and achieve substantially the same technical effects are included within the scope of protection of the present invention.
Claims
1. A coarse-to-fine cheongsam 3D point cloud model alignment method, characterized by The steps include: (1) Use a handheld 3D scanning device to obtain comprehensive 3D point cloud data of the mannequin and cheongsam; (2) Manual alignment of coordinate axis rotation; (3) Converting the point cloud model into a voxel model; (4) Create a logical array; (5) Extract the "top" section of the model and calculate the center of gravity; (6) Calculate the translation in the lateral direction and align the center of gravity of the cross section; (7) Processing of isolated pixels in each section at the same height; (8) The union of two sections at the same height is defined as the penetration modulus; (9) Calculate the average penetration modulus by exhaustively enumerating all effective sections; (10) Find the translation transformation with the lowest average wear modulus for alignment: By changing the coordinates of each voxel, all possible displacements are exhausted, and then the optimal alignment method is selected by calculating the center of gravity deviation and wear modulus: According to the average wear modulus size and the center of gravity difference, the translation of the model on the X, Y and Z axes is estimated; among them, the translation of the X axis is trans_X_model_rough, the translation of the Y axis is trans_Y_model_rough, and the translation of the Z axis is trans_Z_model_rough; Next, we use a loop traversal method to fine-tune the translation amount within the given search range to find the alignment result with the lowest average penetration; the search range is determined by search_area_refinement_lateral Lateral search area and The vertical search range is determined by search_area_refinement_vertical; in each iteration, a temporary rigid transformation tform_Z_model_temp is constructed according to the fine-tuned translation amount, and the mannequin model is translated using this transformation; the translated mannequin model is converted into a voxel model, and the wear-related parameters of the translated model and the cheongsam model are calculated by calling the compare_voxel function, including the center of gravity difference and wear-related parameters; the wear-related parameters are saved in the results array to record the results of each iteration; After the loop is completed, the alignment result with the lowest average penetration is found based on the minimum penetration among all iterative results, and the corresponding translation is obtained; the optimal translation is applied to the rigid transformation to obtain the final alignment transformation tform; Using the final alignment transformation, the mannequin model is translated to obtain the translated voxel model; the translated voxel model is converted into voxel data and saved in voxel_data_model_registered; through the above process, the alignment result with the lowest average penetration is found, and the corresponding translation transformation is obtained; this process is based on the measurement of penetration, and the optimal alignment result is found by continuously fine-tuning the translation amount to achieve accurate alignment of the mannequin model and the cheongsam model.
2. The method for aligning a cheongsam 3D point cloud model from coarse to fine according to claim 1, characterized in that: Step (2): provide two 3D point cloud models to be aligned, ptCloud_1 and ptCloud_2, which are the 3D point cloud model of the mannequin and the 3D point cloud model of the cheongsam respectively. Use the compose_rotation function to construct a 3x3 rotation matrix compose_rotation(theta_x, theta_y, theta_z), where theta_x, theta_y and theta_z are the rotation angles of each axis. It accepts three angles as input and outputs a rotation matrix. a. For rotation around the x-axis, the rotation matrix X is: b. For rotation around the y-axis, the rotation matrix Y is: c. For rotation around the z-axis, the rotation matrix Z is: d. Combine these three rotation matrices together through matrix multiplication to obtain the total rotation matrix R: R = Z*Y*X.
3. The method for aligning a cheongsam 3D point cloud model from coarse to fine according to claim 2, characterized in that: Step (3) uses the convert_to_voxel(ptCloud,metadata,params) function to convert the point cloud models ptCloud_1 and ptCloud_2 into voxel models voxel_data_1 and voxel_data_2, and sets the spatial resolution of the voxel models. The conversion process is as follows: a. Create voxel array: Create a three-dimensional array based on the spatial resolution and range of the voxel model to represent the voxel model. The size of the array is determined by the boundary of the voxel model and is divided into small voxel units according to the spatial resolution. b. Mapping point cloud to voxel coordinates: For each point in the point cloud, map it to the corresponding voxel coordinates according to its coordinates; c. Set voxel value: traverse each point in the point cloud and set its corresponding voxel coordinate position in the voxel array to True. By counting the number of points found at this position, decide whether to set the voxel to True. In this way, the True value in the voxel model indicates that there is point cloud data in the voxel. Through the above conversion process, the point cloud model is converted into a voxel model and represented as a three-dimensional array, where each array element represents a voxel unit, the True value indicates that there is point cloud data in the voxel unit, and the False value indicates that there is no point cloud data.
4. The method for aligning a cheongsam 3D point cloud model from coarse to fine according to claim 1, characterized in that: Step (4) constructs a three-dimensional logical array "voxel_data" based on the distribution of point cloud data on the Z axis. In this logical array, each layer of the Z axis represents a cross section at a different height. For a cross section at any Z value, access "voxel_data(:,:,Z)" to obtain it. In the logical array, each voxel unit is represented by a Boolean value, True indicates that the voxel exists, and False indicates that it does not exist. By constructing the logical array, the distribution of the voxel model on cross sections at different heights is visualized and analyzed. Assume that the dimension of voxel_data is (X, Y, Z), where X and Y represent the width and length of the plane, and Z represents the height of the section. Access voxel_data(:,:,Z) to get the section of the Z layer, which will return a two-dimensional logical array describing the voxel distribution on the section at that height. By analyzing this two-dimensional logical array, we can get the voxel information on the section at a specific height.
5. The method for aligning a cheongsam 3D point cloud model from coarse to fine according to claim 1, characterized in that: Step (5), first, by retrieving the voxel data of the mannequin model and the cheongsam model, accessing the Z-axis extreme values in the voxel data structure of the model to obtain their ranges on the Z axis; storing the maximum Z value of the mannequin model in the Z_max_model variable, and storing the maximum Z value of the cheongsam model in the Z_max_qipao variable; The centroids of the two Z-value sections are calculated and saved in centroid_3D_model and In the centroid_3D_qipao variable, these centroids represent the average height position of the corresponding model on the Z axis; the average height position of the model on the Z axis is obtained by calculating the coordinate average of the model point cloud, that is, the average value of the X, Y and Z coordinate components; By extracting the maximum value of the Z axis and calculating the center of gravity of the section, the height range and average height position of the model in the vertical direction are obtained, which are used to determine the vertical position relationship of the model.
6. The method for aligning a cheongsam 3D point cloud model from coarse to fine according to claim 1, characterized in that: In step (6), the centroid positions of the two models are compared by calculating the difference between the centroids of the cross sections, and their differences in the X, Y, and Z axes are calculated; next, the translation of the model in the X, Y, and Z axes is estimated, and the difference is divided by the grid size to normalize it; then, the difference is quantized into the number of discrete grid cells by rounding down; finally, it is multiplied by the grid size to obtain the translation estimate in real space, and the result is saved in in `trans_X_model_rough`, `trans_Y_model_rough`, and `trans_Z_model_rough` variables; Through the above calculations and operations, the translation of the model on the X-axis, Y-axis, and Z-axis is estimated, and the center of gravity of the cross section of the model is aligned.
7. The method for aligning a cheongsam 3D point cloud model from coarse to fine according to claim 1, characterized in that: Step (7), within the given search range, loop through each section of the model; for each section, obtain the voxel data voxel_data_model of the model and the voxel data voxel_data_qipao of the cheongsam; The voxel data of the model and cheongsam are preprocessed through a series of morphological operations; these operations include bridging, cleaning and filling, which are implemented by the bwmorph function; The bridging operation is used to connect the disconnected parts in the voxels, the cleaning operation is used to remove small noisy voxels, and the filling operation is used to fill the holes in the cross section.
8. The method for aligning a cheongsam 3D point cloud model from coarse to fine according to claim 1, characterized in that: Step (8) merges the pre-processed mannequin cross-sectional voxel data BW_model and the cheongsam cross-sectional voxel data BW_qipao to generate a merged binary image `BW_merge`; the merge operation uses the logical operator OR to perform a logical OR operation on the two binary images to obtain the common area of the mannequin model and the cheongsam model; then calculates the area of BW_qipao and BW_merge. If the area of BW_merge is greater than the area of BW_qipao, the cross-sectional wear modulus is defined as the difference between the two areas; Use `vision.BlobAnalysis` to perform regional analysis and connected region analysis on the merged binary image BW_merge to obtain information about the region shape, size, and position, and further analyze the differences between the models; In regional analysis, first create a `vision.BlobAnalysis` object and set The `MaximumCount` property is set to 1 to ensure that only the largest connected region is obtained. Then, a connected region analysis is performed on the merged binary image `BW_merge`. By calling the `Hblob` object and passing in the binary image, the information about the connected regions is obtained. The area of the connected region represents the number of pixels in the region, and the center of gravity represents the center of the region. Through connected region analysis, the properties of the connected regions in the merged binary image are obtained, including the area and center of gravity of the penetration modulus.
9. The method for aligning a cheongsam 3D point cloud model from coarse to fine according to claim 8, characterized in that: Step (9) loops through each effective section: Preprocess the voxel data BW_model of the mannequin model and BW_qipao of the cheongsam model of the current section, and use the bwmorph function to perform bridging and cleaning operations; create a merged binary image BW_merge, and use the logical operator OR to perform a logical OR operation on BW_model and BW_qipao; use the vision.BlobAnalysis object to perform connected region analysis; set the MaximumCount property to 1 to ensure that only the largest connected region is obtained; perform connected region analysis on the merged binary image BW_merge to obtain the properties of the connected region, including area and center of gravity; if the area of the connected region is greater than or equal to the area of the cheongsam model, calculate the penetration modulus of the section; save the center of gravity difference in the dev_centroid array, and save the penetration modulus in the area_chuanmo array; After the cycle is completed, the average values of the center of gravity difference and the penetration value are calculated to obtain the average penetration value. By exhaustively enumerating all valid sections and calculating the center of gravity difference and penetration value, the degree of difference of the model in each section is comprehensively considered. The average penetration value provides a measure of the overall similarity between the model and the cheongsam, which helps to evaluate the consistency and matching degree between the models.
Citation Information
Patent Citations
Virtual fitting method and device based on monocular depth camera
CN109377564A
Three-dimensional model generation method, device and system and medium
CN113822984A