Scope and objective: Artists usually go through a series of preprocessing or graphically manipulation to ensure the quality of the 3D scans. In this document, we want to explore the effect of retopology (resampling and upsampling) on accuracy.
Findings and recommendations: Both resampling and upsampling significantly impact the accuracy of 3D meshes. Resampling decreases the accuracy of the 3d mesh, but upsampling increases it at the expense of longer processing time. Upsampling preserves a higher resolution mesh of the CAD, hence is relatively more accurate. Therefore, we should limit the number of times we resample the 3D meshes to ensure the 3D scan does not deviate much from the CAD.
Retopology is the act of recreating an existing mesh with approximately the same volume and shape but with a different mesh layout. It is a good way to simplify and clean up noisy data, which allows the artists to close holes and fix artifacts of 3D images in our study. However, we have yet to evaluate the impact of retopology on the 3D scans’ accuracy.
To understand the impact of resampling and upsampling on 3D scans in terms of how much deviation it creates from the CAD.
We first scanned the printed heads with 3dMD, followed by the 2 tasks below:
These manipulation uses zBrush’s Dynamesh function, which has the added feature of closing holes in the geometry and fixing some artifacts (such as non-manifold edges, floating geometry, and intersecting geometry). The basis of our mesh comparison is the use of the Hausdorff distance as an appropriate error measure between original and manipulated 3dMD scan.
Hausdorff distance is the greatest of all the distances from a point in one set to the closest point in the other set that is generally used to provide an MSE-like measurement for 3D models. We have four types of Hausdorff distance here:
Click here for extra explanation on Hausdorff distance.
The raw data consists of 60 rows of data from 10 printed heads and 6 manipulations. The variables include ID, manipulation, four types of Hausdorff distances mentioned above, and processing time.
| id | manipulation | min | max | mean | RMS | time | |
|---|---|---|---|---|---|---|---|
| 1 | 1 | resample01 | 0 | 0.381939 | 0.004946 | 0.012963 | 813 |
| 21 | 1 | resample05 | 0 | 1.215300 | 0.009983 | 0.031293 | 424 |
| 41 | 1 | resample10 | 0 | 1.291317 | 0.016732 | 0.045193 | 423 |
| 61 | 1 | upsample02 | 0 | 0.349640 | 0.002972 | 0.007957 | 534 |
| 81 | 1 | upsample04 | 0 | 0.193427 | 0.002416 | 0.008368 | 859 |
| 101 | 1 | upsample06 | 0 | 0.200752 | 0.001287 | 0.003725 | 1173 |
We explored the impact of resampling and upsampling by comparing the CAD with the manipulated meshes first.
Resampling produced a smoother representation that seems to deviate further from the CAD (Figure 1).
Upsampling produced a denser representation that seems to remain true to the underlying object (Figure 2).
Let’s continue exploring the data by comparing some summary statistics between these two scanners.
| min | max | mean | RMS | time | |
|---|---|---|---|---|---|
| Min. :0 | Min. :0.3125 | Min. :0.004946 | Min. :0.01174 | Min. : 691.0 | |
| 1st Qu.:0 | 1st Qu.:0.3878 | 1st Qu.:0.005351 | 1st Qu.:0.01308 | 1st Qu.: 807.8 | |
| Median :0 | Median :0.4509 | Median :0.006147 | Median :0.01488 | Median : 829.0 | |
| Mean :0 | Mean :0.4487 | Mean :0.006135 | Mean :0.01507 | Mean : 865.4 | |
| 3rd Qu.:0 | 3rd Qu.:0.5076 | 3rd Qu.:0.006983 | 3rd Qu.:0.01703 | 3rd Qu.: 881.0 | |
| Max. :0 | Max. :0.5821 | Max. :0.007333 | Max. :0.01885 | Max. :1222.0 |
| min | max | mean | RMS | time | |
|---|---|---|---|---|---|
| Min. :0 | Min. :0.7984 | Min. :0.009814 | Min. :0.02435 | Min. :387.0 | |
| 1st Qu.:0 | 1st Qu.:0.9660 | 1st Qu.:0.010759 | 1st Qu.:0.02865 | 1st Qu.:398.0 | |
| Median :0 | Median :1.0216 | Median :0.012389 | Median :0.03194 | Median :422.0 | |
| Mean :0 | Mean :1.0457 | Mean :0.012262 | Mean :0.03185 | Mean :439.4 | |
| 3rd Qu.:0 | 3rd Qu.:1.1630 | 3rd Qu.:0.013850 | 3rd Qu.:0.03398 | 3rd Qu.:440.2 | |
| Max. :0 | Max. :1.3225 | Max. :0.014811 | Max. :0.03916 | Max. :577.0 |
| min | max | mean | RMS | time | |
|---|---|---|---|---|---|
| Min. :0 | Min. :0.9422 | Min. :0.01634 | Min. :0.04045 | Min. :343.0 | |
| 1st Qu.:0 | 1st Qu.:1.1244 | 1st Qu.:0.01934 | 1st Qu.:0.04681 | 1st Qu.:414.2 | |
| Median :0 | Median :1.2232 | Median :0.02277 | Median :0.05460 | Median :425.0 | |
| Mean :0 | Mean :1.2023 | Mean :0.02559 | Mean :0.05789 | Mean :442.7 | |
| 3rd Qu.:0 | 3rd Qu.:1.2727 | 3rd Qu.:0.03088 | 3rd Qu.:0.06614 | 3rd Qu.:448.5 | |
| Max. :0 | Max. :1.4204 | Max. :0.03907 | Max. :0.08565 | Max. :570.0 |
All statistics showed that the mesh deviates further and further as we resample it more (Table 2, 3, 4). However, the time it takes to compare the meshes reduces as we increase the number of times we resample the mesh. Perhaps zBrush turns the mesh into something that is easier to work with from resampling.
| min | max | mean | RMS | time | |
|---|---|---|---|---|---|
| Min. :0 | Min. :0.2647 | Min. :0.002955 | Min. :0.007535 | Min. :499.0 | |
| 1st Qu.:0 | 1st Qu.:0.2758 | 1st Qu.:0.003327 | 1st Qu.:0.008127 | 1st Qu.:561.5 | |
| Median :0 | Median :0.3233 | Median :0.003708 | Median :0.009101 | Median :592.5 | |
| Mean :0 | Mean :0.3181 | Mean :0.003774 | Mean :0.009524 | Mean :607.1 | |
| 3rd Qu.:0 | 3rd Qu.:0.3567 | 3rd Qu.:0.004277 | 3rd Qu.:0.010770 | 3rd Qu.:612.2 | |
| Max. :0 | Max. :0.3675 | Max. :0.004750 | Max. :0.012279 | Max. :776.0 |
| min | max | mean | RMS | time | |
|---|---|---|---|---|---|
| Min. :0 | Min. :0.1934 | Min. :0.001762 | Min. :0.004694 | Min. : 817.0 | |
| 1st Qu.:0 | 1st Qu.:0.2132 | 1st Qu.:0.002042 | 1st Qu.:0.005235 | 1st Qu.: 879.0 | |
| Median :0 | Median :0.2332 | Median :0.002367 | Median :0.006086 | Median : 930.5 | |
| Mean :0 | Mean :0.2366 | Mean :0.002331 | Mean :0.006413 | Mean : 976.4 | |
| 3rd Qu.:0 | 3rd Qu.:0.2500 | 3rd Qu.:0.002576 | 3rd Qu.:0.007409 | 3rd Qu.: 987.5 | |
| Max. :0 | Max. :0.3100 | Max. :0.003025 | Max. :0.009109 | Max. :1293.0 |
| min | max | mean | RMS | time | |
|---|---|---|---|---|---|
| Min. :0 | Min. :0.1363 | Min. :0.001264 | Min. :0.003489 | Min. :1111 | |
| 1st Qu.:0 | 1st Qu.:0.1747 | 1st Qu.:0.001424 | 1st Qu.:0.003777 | 1st Qu.:1199 | |
| Median :0 | Median :0.1937 | Median :0.001586 | Median :0.004209 | Median :1314 | |
| Mean :0 | Mean :0.1959 | Mean :0.001621 | Mean :0.004439 | Mean :1351 | |
| 3rd Qu.:0 | 3rd Qu.:0.2120 | 3rd Qu.:0.001833 | 3rd Qu.:0.004961 | 3rd Qu.:1404 | |
| Max. :0 | Max. :0.2643 | Max. :0.002085 | Max. :0.006127 | Max. :1766 |
All Hausdorff distance statistics decrease as we increase the number of times we upsample, but the processing time increases (Table 5, 6, 7). Upsampling increases accuracy at the expense of longer processing time.
Let’s explore the relationship between these Hausdorff distances while checking the impact of resampling and upsampling at the same time.
The scatterplot above contains two kinds of information. Let’s first examine the correlation coefficients.
The correlation coefficient between minimum Hausdorff distance with the other statistics is NA because it always stays at 0. The smallest error between CAD and manipulated scan is 0 out of many vertices that we sample. Processing time has moderate correlation with other statistics. Maximum Hausdorff distance is highly correlated to mean and RMS Hausdorff distances, while mean and RMS Hausdorff distances provide nearly identical information. This makes sense because RMS is just another representation of mean which accounts for negative differences as well. In terms of deviation, all our values are positive, hence these two statistics will be very similar.
On the other hand, the upper panel showed that the magnitude of the Hausdorff distances increase as we increase the number of times we resample the data. We can see that the blue data points (resample01) tend to have smaller values, and the red data points (resample10) tend to have larger values, with the yellow data points (resample05) somewhere in between. This is consistent with what we’ve found in the summary statistics tables above.
Let’s examine the scatterplot matrix for upsampling.
In terms of correlation, similar trend was observed for upsampling. On the other hand, the scatterplot matrix showed that the Hausdorff distance statistics reduces as we increase the number of times we upsample. We reduce the Hausdorff distances by introducing more vertices because majority of the meshes will be similar between the CAD and the altered mesh. Therefore, we increase the number of vertices with small differences, hence reduces the mean and RMS Hausdorff distances. The number of vertices we use for Hausdorff distances has a high impact on our statistics.
With the exploration above, we can focus our attention on max and RMS to study the impact of number of times we resample the data on accuracy.
There is a clear separation between resampled data, but it is not the case for upsampled data (Figure 5). We see some overlap of points and sometimes the relationship flips for upsampled data.
Resampling and upsampling have opposite effects on Hausdorff distance (Figure 6). The manipulated mesh deviates further from the CAD if we increase the number of times we resample or decrease the number of times we upsample.
For both resampling and upsampling, we have three sets of data to compare. Due to the small sample size, we will use Kruskal-Wallis test (nonparametric one-way ANOVA) to test the null hypothesis that all the medians of all groups are equal.
| Variable | Test Statistic | P-value |
|---|---|---|
| Maximum Hausdorff Distance | 20.96774 | 2.8e-05 |
| RMS Hausdorff Distance | 25.80645 | 2.5e-06 |
Kruskal-Wallis test showed that there was a significant difference (p < 0.05) between max and RMS Hausdorff distances. We will perform multiple pairwise-comparison between groups to see what groups are different than the rest. The adjustment method was discovered by Benjamini & Hochberg, which control the false discovery rate. The false discovery rate is a less stringent condition than the family-wise error rate, so these methods are more powerful than the other available methods in r.
##
## Pairwise comparisons using Wilcoxon rank sum test
##
## data: resample$max and resample$manipulation
##
## resample01 resample05
## resample05 1.6e-05 -
## resample10 1.6e-05 0.063
##
## P value adjustment method: BH
For max Hausdorff distance, resampled once is significantly different from resampled five times and ten times. However, resampled five and 10 times are only marginally significant (p = 0.063). It could be the case that the largest error doesn’t really change much once we reach a threshold.
##
## Pairwise comparisons using Wilcoxon rank sum test
##
## data: resample$RMS and resample$manipulation
##
## resample01 resample05
## resample05 1.1e-05 -
## resample10 1.1e-05 1.1e-05
##
## P value adjustment method: BH
On the other hand, the RMS Hausdorff distance are significantly different between all three upsampling groups. It showed that it’s likely the number of times we resample the data will continue impact RMS Hausdorff distance.
We will apply the same testing procedure on upsampling data here.
| Variable | Test Statistic | P-value |
|---|---|---|
| Maximum Hausdorff Distance | 20.26323 | 3.98e-05 |
| RMS Hausdorff Distance | 20.91097 | 2.88e-05 |
Kruskal-Wallis test showed that there was a significant impact of upsampling on max and RMS Hausdorff distances as well. We will perform multiple pairwise-comparison between groups to see what groups are different than the rest.
##
## Pairwise comparisons using Wilcoxon rank sum test
##
## data: upsample$max and upsample$manipulation
##
## upsample02 upsample04
## upsample04 0.00049 -
## upsample06 3.2e-05 0.01469
##
## P value adjustment method: BH
##
## Pairwise comparisons using Wilcoxon rank sum test
##
## data: upsample$RMS and upsample$manipulation
##
## upsample02 upsample04
## upsample04 0.0016 -
## upsample06 3.2e-05 0.0021
##
## P value adjustment method: BH
All pairwise comparison turned out to be significant for upsampling.
Both resampling and upsampling have a significant effect on Hausdorff distance (Table 8, 9). Maximum and RMS Hausdorff distance increase with each redistribution of vertice (resampling), and they decrease each time we add more vertices in the mesh (upsampling) as shown in Figure 6. It is possible that each time we resample, it redistributes the vertices around the original vertices. Then the next time we resample, it performs the same procedure but based on the points that were redistributed earlier. We originally believe the random redistribution of points may not deviate the vertices further from the original vertices, yet it showed that it is the case.
The effect of upsampling is more straightforward. The more vertices we use on the mesh, the higher the accuracy. Hence the Hausdorff distance decrease with increasing number of vertices. For example, imagine you have a line and you need to replicate it with 2 points. It can be done if the line is simply a straight line. If it is not, you cannot describe the change of slope or curvature well with just 2 points. This is an example that more points on the line/mesh can increase the accuracy.
Both resampling and upsampling impact the accuracy of the mesh significantly. Upsampling will increase the accuracy, but resampling will decrease the accuracy. We should limit the number of times we resample the mesh as it creates more deviation from the CAD.