目的 二维转三维技术可以将现有的丰富二维图像资源快速有效地转为立体图像，但是现有方法只能对树木的整体进行深度估计，所生成的图像无法表现出树木的立体结构。为此，本文提出了一种树木结构层次细化的立体树木图像构建方法。 方法 该方法首先利用Lab颜色模型下的像素色差区别将二维树木图像的树干区域和树冠区域分割开来，并对树冠区域进行再分割；然后，在深度梯度假设思想基础上建立多种类型的深度模板，结合深度模板和树冠的区域信息为典型树木对象构建初始深度图，并通过基础深度梯度图组合的方式为非典型树木进行个性化深度构建；最后，根据应用场景对树木深度信息进行自适应调整与优化，将树木图像合成到背景图像中，并构建立体图像。 结果 对5组不同的树木图像及背景图像进行了立体树木图像的构建与合成。结果表明，不同形态的树木图像都能生成具有层次感的深度图并自适应地合成到立体背景图像中，构建树木图像深度图的时间与原始树木图像的尺寸成正比，而构建立体树木图像并合成到背景中所需时间在2s到4s之间。对立体图像质量的主观评价测试中，这些图像的评分均达到良好级别以上，部分立体图像达到了优秀级别。结论 该方法充分利用了树木的形态结构特征，能同时适用于典型和非典型树木，所构建的立体树木图像质量较高，具有丰富的层次感，并具有舒适的立体观看效果。
Objective: 2D to 3D technology can transfer the existing rich resource of 2D images into 3D images quickly and effectively. However, the existing methods only take depth estimation on the whole object of the tree in the process of depth map generation. In this way, the tree in the final 3D images generated would normally lack sense of depth and looks like a piece of paper stick on the background. The depth map generated by these methods cannot show the natural three dimensional structural features of trees and have not enough rich stereoscopic levels to show the layering on the trees. To this end, this paper presents a 3D tree image construction method based on depth template. Method: In our proposed method, we first utilize the color difference of pixels under the Lab color model to divide the 2D tree image into trunk area and the canopy area, and then divide the canopy area again into serval smaller areas by using multi-scale spectral based image segmentation method. Then, based on the assumption of depth gradient hypothesis, we create various types of basic depth templates. In addition to the six commonly used basic depth templates, we added two new basic depth templates based on the structural features of the trees. In accordance with the complexity of the morphology of trees, this paper divided the tree objects into two major categories: typical trees and atypical trees. The typical trees are those with regular shape and can basically belong to the four typical tree models of spherical, conical, cylindrical and wide spread shape. The atypical trees are trees that are inconsistent with the basic characteristics of existing four tree models. The initial depth maps of typical tree objects are constructed by combining the basic depth template and the area information of canopy. And for the atypical tree object, we first select some basic depth templates to generate a personal depth temple, and then, a personalized initial depth map is constructed through the combination of the personal depth temple and the tree’s canopy area information. Finally, the tree depth information is adjusted and optimized adaptively according to the application scene. Three-dimensional images of trees will be adaptively adjusted according to the depth information of the corresponding position of the background to obtain a depth map consistent with the background depth information. In addition, different objects in the scene are located at different depths, so when the tree images are synthesized into the background image, the occlusion between the objects in the scene needs to be adjusted. After the above process, the tree image is synthesized into the background image and the 3D image is constructed. Result: In order to verify the effectiveness and practicability of our method, we used different background image material and tree image material to make 3D image pairs. We show the five generated 3D images from the experiment in this paper. The experimental results show that the tree images of different sizes, typical and atypical can all produce layered depth images and can be adaptively synthesize into different three-dimensional background images. The operating efficiency of the system is stable and the time required to construct the stereoscopic image is linearly related to the size of the original tree image, which means the run-time growth would not be explosive increased due to the increase of tree image size. In the subjective evaluation test on the stereoscopic image quality, we conducted tests and statistics on 3 aspects: 3D image pair quality, depth map quality, and three-dimensional comfort situation. There are five different ratings for each aspect, covering all aspects related to the quality of the 3D image. According to the statistics of each item, we get the total score under the percentile, and then divide the total score into five grades: excellent, good, medium, normal and poor. In the test, the ratings for these images all reach the good levels, and some of them even achieve the excellent levels. Conclusion: In order to make the three-dimensional trees and 3D background images naturally blend, and enhance the three-dimensional display of trees, by using the morphological characteristics of trees, this paper presents a 3D tree image construction method based on depth template. The method takes full advantage of the morphological characteristics of trees and can be applied to both typical and atypical trees. The constructed three-dimensional trees have high image quality and comfortable stereoscopic effect. Depth template used in this paper presents a greater improvement in the depth sense of trees in 3D images than the existing methods.