[go: up one dir, main page]

CN1296873C - Travel-in-picture method based on relative depth computing - Google Patents

Travel-in-picture method based on relative depth computing Download PDF

Info

Publication number
CN1296873C
CN1296873C CNB2004100529740A CN200410052974A CN1296873C CN 1296873 C CN1296873 C CN 1296873C CN B2004100529740 A CNB2004100529740 A CN B2004100529740A CN 200410052974 A CN200410052974 A CN 200410052974A CN 1296873 C CN1296873 C CN 1296873C
Authority
CN
China
Prior art keywords
image
model
distance
relative depth
background
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNB2004100529740A
Other languages
Chinese (zh)
Other versions
CN1588453A (en
Inventor
曹智清
石教英
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CNB2004100529740A priority Critical patent/CN1296873C/en
Publication of CN1588453A publication Critical patent/CN1588453A/en
Application granted granted Critical
Publication of CN1296873C publication Critical patent/CN1296873C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

本发明公开了一种基于相对深度计算的画中游方法。其步骤为:(1)确定图像灭点数目;对图像进行前景背景划分;对于前景部分,准备前景mask图;对图像背景部分,制作背景图像,并构造蜘蛛网格;(2)按照灭点数目对背景图像进行相对深度及模型相对尺寸计算,其中包括视点确定、从蜘蛛网格获取数据和进行相对深度和相对尺寸计算这三个子步骤;(3)根据相对深度和模型尺寸的数值,进行前景和背景的建模;并用背景图像和前景mask图分别对背景前景模型进行纹理映射,并定位相机,渲染得到输出图像。本方法针对较规整建筑物,能够从二维图像中较精确地计算三维模型的相对尺寸和相对位置,能较好地解决全景图和画中游相结合的应用中两种技术切换时的融合问题。

Figure 200410052974

The invention discloses a picture-in-picture swimming method based on relative depth calculation. The steps are: (1) determine the number of vanishing points in the image; divide the image into foreground and background; for the foreground part, prepare a foreground mask map; for the background part of the image, make a background image and construct a spider grid; (2) according to the number of vanishing points The purpose is to calculate the relative depth and the relative size of the model on the background image, including three sub-steps: determining the viewpoint, obtaining data from the spider grid, and calculating the relative depth and relative size; (3) according to the values of the relative depth and model size, carry out Modeling of the foreground and background; and use the background image and the foreground mask map to texture map the background and foreground model respectively, and position the camera, and render the output image. This method can accurately calculate the relative size and relative position of the 3D model from the 2D image for more regular buildings, and can better solve the fusion problem when the two technologies are switched in the application of the combination of panorama and picture-in-picture .

Figure 200410052974

Description

基于相对深度计算的画中游方法In-Picture Game Based on Relative Depth Calculation

                           技术领域Technical field

本发明涉及一种基于相对深度计算的画中游方法。The invention relates to a picture-in-picture swimming method based on relative depth calculation.

                           背景技术 Background technique

基于图像的绘制技术(Image-Based Rendering,IBR)是一种从一系列拍摄的图像或者没有连接关系的点出发来进行绘制,从而得到较好三维漫游效果的虚拟现实技术。它在电影电视特技制作和娱乐广告等方面有着广泛和深入的应用。但与此同时,普遍地,该技术表达一个场景所需的数据量过于巨大,采样难度过大。Y.Horry于1997年提出了画中游技术(Tour Into the Picture,TIP)。该技术可以简单地对一幅二维照片进行漫游,较好地解决了IBR技术中的采样问题。画中游技术给出了一种简单的三维模型,它由一些三维多边形框架和公告板(billboard)组成,从而可以生成各式各样令人悦目的高质量3D动画。该技术目前已被广泛应用于娱乐、文物保护、广告等各方面。Image-Based Rendering (IBR) is a virtual reality technology that draws from a series of captured images or unconnected points to obtain a better three-dimensional roaming effect. It has extensive and in-depth applications in film and television special effects production and entertainment advertising. But at the same time, in general, the amount of data required to express a scene by this technology is too large, and sampling is too difficult. Y.Horry proposed Tour Into the Picture (TIP) in 1997. This technology can simply roam a two-dimensional photo, which better solves the sampling problem in IBR technology. The picture-in-picture technology gives a simple 3D model, which is composed of some 3D polygonal frames and billboards, so that a variety of pleasing high-quality 3D animations can be generated. This technology has been widely used in entertainment, cultural relics protection, advertising and other aspects.

画中游技术一般可以分为以下四个步骤:Picture-in-stream technology can generally be divided into the following four steps:

1、图像预处理。将输入图像区分前后景,手动制作前景mask图和背景图片。所谓前景mask图是将图像中前景部分抠出而形成的二维灰度图,前景部分置为白色,其它部分为黑色。背景图片则为去掉前景以后的背景,手动将前景镂空部分填充上与周围背景相协调的图案和色彩。这是开始TIP制作过程的准备。1. Image preprocessing. The input image is distinguished from the foreground and the foreground, and the foreground mask and background image are manually made. The so-called foreground mask image is a two-dimensional grayscale image formed by cutting out the foreground part of the image, the foreground part is set to white, and the other parts are black. The background picture is the background after the foreground is removed, and the foreground hollow part is manually filled with patterns and colors that are coordinated with the surrounding background. This is the preparation to start the TIP making process.

2、构建蜘蛛网格。在背景图片上构建蜘蛛网格,从而可以提供建模的基本几何信息。蜘蛛网格由灭点(vani shing point)、内窗口(inner window)、外窗口(outer window)和由灭点向四周发出的射线组成。由于透视现象为近大远小,因而使得三维场景中互相平行的直线在二维图像中不一定平行,最终汇聚成为一点,即所谓灭点。内窗口为视点无法穿过的背部矩形,外窗口则为图像的边框。由灭点出发经过内窗口四个顶点的射线和内窗口一起,把原图像分为五个部分——内窗口和上下左右四个多边形。相对应地,分别命名为后墙(rearwall)、天花板(ceiling)、地面(floor)、左墙(left wall)、右墙(right wall)。2. Build a spider grid. Build a spider grid on the background image, which can provide basic geometric information for modeling. The spider grid consists of a vani shing point, an inner window, an outer window, and rays emitted from the vani shing point. Because the perspective phenomenon is that the near side is larger than the far side, the straight lines parallel to each other in the 3D scene are not necessarily parallel in the 2D image, and finally converge into a point, which is the so-called vanishing point. The inner window is the back rectangle that the viewpoint cannot pass through, and the outer window is the border of the image. The rays starting from the vanishing point and passing through the four vertices of the inner window together with the inner window divide the original image into five parts—the inner window and the four polygons up, down, left, and right. Correspondingly, they are respectively named rear wall, ceiling, floor, left wall, and right wall.

3、重建模。对于背景,蜘蛛网格所分割而成的五个部分相对应于建模过程中的五个相邻接的矩形。基于三个假设进行重建模:1)五个矩形中相邻的矩形彼此垂直;2)三维环境中后墙矩形(rear wall)平行于视平面;3)三维环境中地面矩形(floor)垂直于视平面。重建过程中,先获取图像中蜘蛛网格的有关位置信息,进行各个关键点(建模过程中矩形的顶点)的三维位置计算。其中,天花板高度等信息为估计尺寸。根据计算而得的各个关键点的位置信息进行建模,得到背景的三维盒子模型(box model)。对于前景,基于公告板(billboard)形式,使用层次多边形进行建模,三维位置计算与背景类似。3. Remodeling. For the background, the five segments into which the spider grid is divided correspond to the five contiguous rectangles in the modeling process. Remodeling is based on three assumptions: 1) the adjacent rectangles among the five rectangles are perpendicular to each other; 2) the rear wall rectangle is parallel to the viewing plane in the 3D environment; 3) the floor rectangle is perpendicular to the 3D environment at the viewing plane. In the reconstruction process, the relevant position information of the spider grid in the image is obtained first, and the three-dimensional position calculation of each key point (vertex of the rectangle in the modeling process) is performed. Among them, information such as ceiling height is an estimated size. Modeling is carried out according to the calculated position information of each key point, and a three-dimensional box model (box model) of the background is obtained. For the foreground, based on the form of the billboard, it is modeled using hierarchical polygons, and the three-dimensional position calculation is similar to that of the background.

4、纹理映射及渲染。假设三维矩形中的纹理都从相对应的二维多边形中继承。渲染而得的输出图像中任意二维点可以找到三维模型中的对应点,后者又可以找到原始图像中的二维对应点。对于前景的纹理映射,除了纹理对应以外,还必须根据mask图提供的信息,设置前景物体和周围背景的不同透明值。因而渲染的每个点都可以在原图中找到对应的点,映射该点的色彩即可得到纹理映射的结果。4. Texture mapping and rendering. Assume that the textures in the 3D rectangles are all inherited from the corresponding 2D polygons. Any 2D point in the rendered output image can find its corresponding point in the 3D model, which in turn can find its 2D corresponding point in the original image. For the texture mapping of the foreground, in addition to the texture correspondence, different transparency values of the foreground object and the surrounding background must be set according to the information provided by the mask map. Therefore, for each point rendered, the corresponding point can be found in the original image, and the result of texture mapping can be obtained by mapping the color of the point.

画中游技术从一幅图像出发,得到三维模型中的漫游效果,给人以全新的“人在画中游”的视觉效果。但在应用过程中,尤其是画中游技术和全景图技术相结合时,对画中游技术中,在不改变视点位置情况下,重建的三维模型是否可以得到与原图相同视觉效果,提出了更高的要求,这实质上是对于重建三维模型的位置和尺寸的更精确的要求。画中游技术的建模过程中,原有的高度等值的估计方法难以满足需求,这直接影响到用户在画中游过程中的真实感。The swimming-in-picture technology starts from an image and obtains the roaming effect in the 3D model, giving people a brand-new visual effect of "people swimming in the picture". However, in the application process, especially when the picture-in-picture technology is combined with the panorama technology, whether the reconstructed 3D model can obtain the same visual effect as the original picture without changing the position of the viewpoint in the picture-in-picture technology has raised more questions. High requirements, which are essentially more precise requirements for the position and size of the reconstructed 3D model. In the modeling process of the picture-in-picture game technology, the original height equivalent estimation method is difficult to meet the demand, which directly affects the user's sense of reality in the picture-in-picture game process.

                          发明内容Contents of Invention

本发明的目的是提供一种基于相对深度计算的画中游方法。The purpose of the present invention is to provide a method for in-picture swimming based on relative depth calculation.

以一幅图像作为输入进行漫游,其步骤为:Taking an image as input for roaming, the steps are:

(1)确定图像灭点数目;对图像进行前景背景划分;对于前景部分,将前景从背景中抠出,准备前景mask图;对图像背景部分,填充前景被抠出部分,制作背景图像,并构造蜘蛛网格;(1) Determine the number of vanishing points in the image; divide the image into the foreground and background; for the foreground part, cut out the foreground from the background, and prepare the foreground mask map; for the background part of the image, fill in the cut out part of the foreground, make a background image, and Construct a spider grid;

(2)定义图像平面为垂直于地面的平面,原始图像位于该图像平面上,且置原始图像底边于图像平面和地平面相交线上,相对深度即图像平面与模型后墙之间的距离深度;按照灭点数目对背景图像进行相对深度及模型相对尺寸计算,其中包括视点确定、从蜘蛛网格获取数据和进行相对深度和模型相对尺寸计算这三个子步骤;(2) Define the image plane as a plane perpendicular to the ground, the original image is located on the image plane, and the bottom edge of the original image is placed on the intersection line between the image plane and the ground plane, and the relative depth is the distance between the image plane and the back wall of the model Depth: Calculate the relative depth of the background image and the relative size of the model according to the number of vanishing points, including the three sub-steps of determining the viewpoint, obtaining data from the spider grid, and calculating the relative depth and the relative size of the model;

(3)根据相对深度和模型相对尺寸的数值,进行前景和背景的建模;并用背景图像和前景mask图分别对背景前景模型进行纹理映射,并定位相机,渲染得到输出图像。(3) Model the foreground and background according to the values of the relative depth and the relative size of the model; use the background image and the foreground mask to map the texture of the background and foreground model respectively, position the camera, and render the output image.

本发明简单易用,其有益效果是,可以通过科学计算得到画中游模型的较精确的相对位置和相对尺寸,从而在视点位置和角度不变的情况下,使用户得到与原始图像相同视觉效果的三维模型透视输出图像。尤其在画中游和全景图技术相结合的应用中,可以得到全景图和画中游模型之间的无跳跃切换。The invention is simple and easy to use, and its beneficial effect is that the more accurate relative position and relative size of the model in the picture can be obtained through scientific calculation, so that the user can get the same visual effect as the original image under the condition that the position and angle of the viewpoint remain unchanged 3D model perspective output image. Especially in the application of the combination of picture-in-game and panorama technology, jump-free switching between panorama and picture-in-game models can be obtained.

对本发明进行实验检验,构造精确的三维模型,进行相机采样。对采样图像使用新的画中游方法(为1个灭点图像),对三维模型进行重建。在原相对深度为100.00的采样中,表1为本发明计算得到的结果,平均误差为2.86%:The present invention is tested experimentally, an accurate three-dimensional model is constructed, and camera sampling is performed. Using the new picture-in-picture method (one vanishing point image) on the sampled image, the 3D model is reconstructed. In the sampling where the original relative depth is 100.00, Table 1 is the result calculated by the present invention, and the average error is 2.86%:

            表1结果及误差分析   实验1   实验2   实验3   相对深度   97.33   96.73   97.37   误差   2.67%   3.27%   2.63% Table 1 Results and error analysis Experiment 1 Experiment 2 Experiment 3 relative depth 97.33 96.73 97.37 error 2.67% 3.27% 2.63%

重建的三维模型在经过透视重新渲染形成输出图像的过程中,其相对深度和相对尺寸的误差影响将进一步减小,从而得到与原始图像相同的视觉效果。In the process of re-rendering the reconstructed 3D model to form an output image, the influence of errors in its relative depth and relative size will be further reduced, so that the same visual effect as the original image can be obtained.

                         附图说明Description of drawings

图1是基于相对深度计算的画中游方法的流程示意图;Fig. 1 is a schematic flow chart of the method of picture-in-picture based on relative depth calculation;

图2a~d是画中游方法的蜘蛛网格示意图;Figures 2a-d are schematic diagrams of spider grids in the midstream method;

图3是本发明的“相对深度”定义示意图;Fig. 3 is a schematic diagram of the definition of "relative depth" of the present invention;

图4为本发明的一个灭点图像的相对深度和模型相对尺寸的计算示意图;Fig. 4 is a schematic diagram of calculating the relative depth and model relative size of a vanishing point image of the present invention;

图5是本发明的左墙实际建模细节示意图;Fig. 5 is a schematic diagram of the actual modeling details of the left wall of the present invention;

图6a~c是本发明的一个灭点图像经过计算建模渲染后的输出图像效果示意图;Figures 6a-c are schematic diagrams of output image effects of a vanishing point image of the present invention after computational modeling and rendering;

图7为本发明的两个灭点图像的相对深度和模型相对尺寸的计算示意图;Fig. 7 is a schematic diagram of calculating the relative depth and model relative size of two vanishing point images of the present invention;

图8a~c是本发明的两个灭点图像的漫游过程输出图像。8a-c are output images of the roaming process of two vanishing point images of the present invention.

                          具体实施方式 Detailed ways

本发明解决其技术问题所采用的技术方案是:定义图像平面为垂直于地面的平面。原始图像位于该图像平面上,且置原始图像底边于图像平面和地平面相交线上。在本方案中,称如此放置的原始图像为参考图像。引入“相对深度(Relative Depth,RD)”的概念,即模型与图像平面之间的距离深度。在画中游技术中,“相对深度”即图像平面与模型后墙之间的距离深度。根据透视几何原理,在构造蜘蛛网格的基础上,由参考图像的定义,可计算得到模型的相对深度。在此基础上,可进一步计算得到模型的各相对尺寸。所谓相对尺寸,即计算所得的尺寸是与参考图像大小相对应的模型尺寸,而非真实环境中物体的原始大小。相对深度的计算,决定了画中游模型的位置和尺寸,也决定了用户漫游的深度限制。The technical scheme adopted by the present invention to solve the technical problem is: define the image plane as a plane perpendicular to the ground. The original image is located on the image plane, and the bottom edge of the original image is placed on the intersection line between the image plane and the ground plane. In this scheme, the original image placed in this way is called the reference image. Introduce the concept of "Relative Depth (RD)", that is, the distance depth between the model and the image plane. In the painting-in-picture technique, "relative depth" is the distance depth between the image plane and the back wall of the model. According to the principle of perspective geometry, on the basis of constructing the spider grid, the relative depth of the model can be calculated from the definition of the reference image. On this basis, the relative dimensions of the model can be further calculated. The so-called relative size means that the calculated size is the size of the model corresponding to the size of the reference image, rather than the original size of the object in the real environment. The calculation of the relative depth determines the position and size of the in-picture game model, and also determines the depth limit of the user's roaming.

由于从单幅图像中计算深度有一定困难,这要求一些辅助条件或者模型本身具有一定的几何特征(如垂直或平行的直线和平面等)。我们基于以下假设提出本发明:Since it is difficult to calculate depth from a single image, this requires some auxiliary conditions or the model itself has certain geometric features (such as vertical or parallel lines and planes, etc.). We propose the present invention based on the following assumptions:

(1)模型的左右墙和后墙均垂直于地面。(1) The left and right walls and the back wall of the model are perpendicular to the ground.

(2)图像平面垂直于地面。(2) The image plane is perpendicular to the ground.

(3)原始图像为相机水平采样所得。(3) The original image is obtained by horizontal sampling of the camera.

本发明针对不同的图像特征,归纳了不同灭点数图像的相对深度及模型尺寸计算方法。相对深度计算的基本步骤为:According to different image features, the present invention summarizes the relative depth and model size calculation methods of images with different numbers of vanishing points. The basic steps of relative depth calculation are:

1、视点确定。确定一固定的视点,在该视点处进行参考图像和画中游模型的切换。漫游过程中,所生成的新的图像不同于原始图像,包括视野大小、分辨率和视角等。新的生成图像只有在该固定视点处才能得到与原始图像相同的视觉效果。这意味着当用户要从画中游模型切换回到原始图像时必须回到该视点位置。1. Determine the viewpoint. A fixed viewpoint is determined, and switching between the reference image and the in-picture model is performed at this viewpoint. During the roaming process, the generated new image is different from the original image, including field of view size, resolution, and viewing angle. Only at this fixed viewpoint can the new generated image get the same visual effect as the original image. This means that the user must return to this viewpoint position when switching from the in-picture model to the original image.

2、从蜘蛛网格获取相对深度计算所需的数据。2. Obtain the data required for relative depth calculation from the spider grid.

3、根据不同的灭点数进行相对深度和相对尺寸计算。3. Calculate the relative depth and relative size according to different numbers of vanishing points.

新的画中游方法步骤为:The steps of the new picture-in-picture method are as follows:

(1)确定图像灭点数目;手工对图像进行前景背景划分;对于前景部分,将前景从背景中抠出,准备前景mask图;对图像背景部分,填充前景被抠出部分,制作背景图像,并构造蜘蛛网格;(1) Determine the number of vanishing points in the image; manually divide the foreground and background of the image; for the foreground part, cut out the foreground from the background, and prepare the foreground mask map; for the background part of the image, fill in the cut out part of the foreground to make a background image, And construct the spider grid;

(2)定义图像平面为垂直于地面的平面,原始图像位于该图像平面上,且置原始图像底边于图像平面和地平面相交线上,相对深度,即为模型与图像平面之间的距离深度;按照灭点数目对背景图像进行相对深度及模型相对尺寸计算,其中包括视点确定、从蜘蛛网格获取数据和进行相对深度和相对尺寸计算这三个子步骤;(2) Define the image plane as a plane perpendicular to the ground, the original image is located on the image plane, and the bottom edge of the original image is placed on the intersection line between the image plane and the ground plane, and the relative depth is the distance between the model and the image plane Depth: Calculate the relative depth of the background image and the relative size of the model according to the number of vanishing points, including three sub-steps: determining the viewpoint, obtaining data from the spider grid, and calculating the relative depth and relative size;

(3)根据相对深度和模型尺寸的数值,进行前景和背景的建模;并用背景图像和前景mask图分别对背景前景模型进行纹理映射,并定位相机,渲染得到输出图像。(3) Model the foreground and background according to the values of the relative depth and model size; use the background image and the foreground mask to map the texture of the background and foreground model respectively, position the camera, and render the output image.

如图1所示,首先,对原始图像确定灭点类型以确定不同的相对深度及模型相对尺寸计算方法;区分其前后景,并分别对前景背景进行预处理,形成前景mask和背景图像。然后,在对背景图像构建蜘蛛网格的基础上,根据不同的灭点类型,确定模型结构,进行相对深度和模型相对尺寸的计算。之后,根据计算得到的数据进行前景背景的分别建模和纹理映射。最后,定位相机,并进行渲染输出结果图像。As shown in Figure 1, first, determine the vanishing point type of the original image to determine different relative depths and model relative size calculation methods; distinguish its foreground and background, and preprocess the foreground and background respectively to form a foreground mask and a background image. Then, on the basis of constructing a spider grid on the background image, the model structure is determined according to different types of vanishing points, and the relative depth and relative size of the model are calculated. Afterwards, separate modeling and texture mapping of the foreground and background are performed based on the calculated data. Finally, position the camera and render the resulting image.

图2(a)为蜘蛛网格的各组成部分:灭点,内窗口,外窗口,由灭点出发的各条射线。图2(b)给出了在一个灭点背景图像上构建蜘蛛网格的实例。图2(c)表示蜘蛛网格的构建将背景图像分为五个部分:后墙,左右墙,天花板和地面,这将直接对应建模过程中盒子模型的各面。图2(d)即说明了建模后各顶点与蜘蛛网格中相关顶点的对应关系,并给出了建模后的盒子模型外观。Figure 2(a) shows the components of the spider grid: the vanishing point, the inner window, the outer window, and the rays starting from the vanishing point. Figure 2(b) shows an example of constructing a spider grid on a background image of vanishing points. Figure 2(c) shows that the construction of the spider grid divides the background image into five parts: the back wall, the left and right walls, the ceiling and the ground, which will directly correspond to the sides of the box model in the modeling process. Figure 2(d) illustrates the corresponding relationship between each vertex after modeling and the relevant vertices in the spider grid, and gives the appearance of the box model after modeling.

如图3所示,“相对深度”定义为模型与图像平面之间的距离深度。在画中游技术中,“相对深度”即图像平面与模型后墙之间的距离深度。图像平面垂直于地平面,且参考图像底边在地平面上。“相对深度”确定了模型的位置(即后墙位置,也就是漫游的深度限制),实际上也就是三维盒子模型中地面矩形的长度。As shown in Figure 3, "relative depth" is defined as the distance depth between the model and the image plane. In the painting-in-picture technique, "relative depth" is the distance depth between the image plane and the back wall of the model. The image plane is perpendicular to the ground plane, and the bottom edge of the reference image is on the ground plane. The "relative depth" determines the position of the model (that is, the position of the back wall, that is, the depth limit of roaming), which is actually the length of the ground rectangle in the 3D box model.

在图4所示实施例中,输入图像为一灭点图像。图4中,左上角为背景图像,右上角为建模侧视图,左下角为建模顶视图。视点位置在垂直于图像平面且过灭点的直线上,视点到图像平面的距离f可根据应用需要设定,这样,视点位置就确定了。由背景图像的蜘蛛网格可以得到相对深度计算所需的有关数据信息:内窗口底边到外窗口底边的距离m1,灭点到外窗口底边的距离vh(即视点高度),灭点到内窗口顶边的距离m2,灭点到内窗口左边的距离p1,灭点到内窗口右边的距离p2。根据透视几何原理,可以计算得到相对深度 d = m 1 · f vh - m 1 , 模型高度 h = vh + m 2 · ( f + d ) f , 模型宽度 w = w 1 + w 2 = ( p 1 + p 2 ) · ( f + d ) f . 这就得到了三维盒子模型的位置和主要的相对尺寸。除此之外,还有一些建模细节需要注意,如各个三维矩形的具体尺寸。如图4中顶视图和图5所示,以左墙为例,其三维模型并不是一个d×h的矩形,而必须考虑其三维空间的可视角度,应为一个(d-n1)×h的矩形。相类似地,右墙模型应为(d-n2)×h的矩形,天花板模型应为(d-n3)×h的矩形。其中,由图5可得, n 1 = ( w 1 - p 3 ) · f p 3 , n 2 = ( w 2 - p 4 ) · f p 4 , n 3 = ( h - height ) · f ( height - vh ) . In the embodiment shown in FIG. 4, the input image is a vanishing point image. In Figure 4, the upper left corner is the background image, the upper right corner is the modeling side view, and the lower left corner is the modeling top view. The position of the viewpoint is on a straight line perpendicular to the image plane and passing through the vanishing point, and the distance f from the viewpoint to the image plane can be set according to the application requirements, so that the position of the viewpoint is determined. The relevant data information required for relative depth calculation can be obtained from the spider grid of the background image: the distance m 1 from the bottom edge of the inner window to the bottom edge of the outer window, the distance vh from the vanishing point to the bottom edge of the outer window (ie, the height of the viewpoint), The distance m 2 from the point to the top edge of the inner window, the distance p 1 from the vanishing point to the left side of the inner window, and the distance p 2 from the vanishing point to the right side of the inner window. According to the principle of perspective geometry, the relative depth can be calculated d = m 1 &Center Dot; f vh - m 1 , model height h = vh + m 2 &Center Dot; ( f + d ) f , model width w = w 1 + w 2 = ( p 1 + p 2 ) &Center Dot; ( f + d ) f . This gives the position and main relative dimensions of the 3D box model. In addition, there are some modeling details that need attention, such as the specific size of each 3D rectangle. As shown in the top view of Figure 4 and Figure 5, taking the left wall as an example, its 3D model is not a d×h rectangle, but the viewing angle of its 3D space must be considered, which should be (dn 1 )×h rectangle. Similarly, the right wall model should be a (dn 2 )×h rectangle, and the ceiling model should be a (dn 3 )×h rectangle. Among them, it can be obtained from Figure 5 that no 1 = ( w 1 - p 3 ) &Center Dot; f p 3 , no 2 = ( w 2 - p 4 ) &Center Dot; f p 4 , no 3 = ( h - height ) &Center Dot; f ( height - vh ) .

图6为图4所示实施例的输出图效果比较。图6(a)为该示例的输入图像,图6(b)为对输入图像进行TIP建模后得到的模型外观,图6(c)是对(b)中纹理部分的放大。可见,在视点位置和角度不变的情况下,经过本发明的计算和建模,可得到与原输入图像相同视觉效果的输出模型。FIG. 6 is a comparison of output image effects of the embodiment shown in FIG. 4 . Figure 6(a) is the input image of this example, Figure 6(b) is the appearance of the model obtained after TIP modeling the input image, and Figure 6(c) is the enlargement of the texture part in (b). It can be seen that, under the condition that the position and angle of the viewpoint remain unchanged, the output model with the same visual effect as the original input image can be obtained through the calculation and modeling of the present invention.

图7给出了另一个实施例,其输入图像为二灭点图像。图7中,左上角为背景图像,右上角为建模侧视图,左下角为建模顶视图。根据透视几何,图像中的两个灭点必然在同一水平线上,称为灭线。视点位置在垂直于图像平面且过两灭点连线中点的直线上,视点到图像平面的距离f可根据应用需要设定,这就确定了视点位置。由背景图像的蜘蛛网格可以得到相对深度计算所需的有关数据信息。经过计算得到: d 1 = ( vh - m 1 ) · f m 1 , d 2 = ( vh - m 2 ) · f m 2 , d 3 = ( vh - m 3 ) · f m 3 , Fig. 7 shows another embodiment, the input image is an image of two vanishing points. In Figure 7, the upper left corner is the background image, the upper right corner is the modeling side view, and the lower left corner is the modeling top view. According to perspective geometry, the two vanishing points in the image must be on the same horizontal line, which is called the vanishing line. The position of the viewpoint is on a straight line perpendicular to the image plane and passing through the midpoint of the line connecting the two vanishing points. The distance f from the viewpoint to the image plane can be set according to the application requirements, which determines the position of the viewpoint. The relevant data information required for relative depth calculation can be obtained from the spider grid of the background image. Calculated to get: d 1 = ( vh - m 1 ) &Center Dot; f m 1 , d 2 = ( vh - m 2 ) · f m 2 , d 3 = ( vh - m 3 ) &Center Dot; f m 3 ,

ww 11 == (( dd 11 ++ ff )) ·· pp 11 ff ,, ww 22 == (( dd 22 ++ ff )) ·· pp 22 ff ,, ww 33 == (( dd 33 ++ ff )) ·· pp 33 ff ,, hh == vhvh ++ mm 44 ·· (( ff ++ dd 11 )) ff ..

图8是图7实施例经过计算建模以后,在漫游过程中的输出图像效果。图8(a)为对两灭点图像构建网格,提取有关计算数据。图8(b)为原始输入图像,图8(c)为漫游过程中某一角度的输出图像,这是原始图像中不能获得的新视点视觉效果。FIG. 8 is the output image effect during the roaming process of the embodiment in FIG. 7 after computational modeling. Figure 8(a) constructs a grid for the two vanishing point images and extracts relevant calculation data. Figure 8(b) is the original input image, and Figure 8(c) is the output image at a certain angle during the roaming process, which is a new viewpoint visual effect that cannot be obtained in the original image.

Claims (5)

1、一种基于相对深度计算的画中游方法,其特征在于:以一幅图像作为输入进行漫游,其步骤为:1. A method for swimming in a picture based on relative depth calculation, characterized in that: roaming is performed with an image as input, and the steps are: (1)确定图像灭点数目;对图像进行前景背景划分;对于前景部分,将前景从背景中抠出,准备前景掩膜图;对图像背景部分,填充前景被抠出部分,制作背景图像,并构造蜘蛛网格;(1) Determine the number of vanishing points in the image; divide the image into foreground and background; for the foreground part, cut out the foreground from the background, and prepare a foreground mask map; for the background part of the image, fill in the cut out part of the foreground, and make a background image, And construct the spider grid; (2)定义图像平面为垂直于地面的平面,原始图像位于该图像平面上,且置原始图像底边于图像平面和地平面相交线上,相对深度即图像平面与模型后墙之间的距离深度;按照灭点数目对背景图像进行相对深度及模型相对尺寸计算,其中包括视点确定、从蜘蛛网格获取数据和进行相对深度和模型相对尺寸计算这三个子步骤;(2) Define the image plane as a plane perpendicular to the ground, the original image is located on the image plane, and the bottom edge of the original image is placed on the intersection line between the image plane and the ground plane, and the relative depth is the distance between the image plane and the back wall of the model Depth: Calculate the relative depth of the background image and the relative size of the model according to the number of vanishing points, including the three sub-steps of determining the viewpoint, obtaining data from the spider grid, and calculating the relative depth and the relative size of the model; (3)根据相对深度和模型相对尺寸的数值,进行前景和背景的建模;并用背景图像和前景掩膜图分别对背景前景模型进行纹理映射,并定位相机,渲染得到输出图像。(3) Model the foreground and background according to the values of the relative depth and the relative size of the model; use the background image and the foreground mask map to texture map the background and foreground models respectively, position the camera, and render the output image. 2、根据权利要求1所述的一种基于相对深度计算的画中游方法,其特征在于所说的视点确定是:该视点为切换画中游模型和参考图像的固定点,对于一灭点图像,其视点位于过灭点,且垂直于图像平面的直线上,视点到图像平面的距离f可任意确定;对于两灭点图像,两灭点位于同一水平线,即灭线上,其视点位于过两灭点连线中点,且垂直于图像平面的直线上,视点到图像平面的距离f可任意确定。2. A method of midstream based on relative depth calculation according to claim 1, characterized in that said viewpoint determination is: the viewpoint is a fixed point for switching between the midstream model and the reference image, and for a vanishing point image, Its viewpoint is located at the vanishing point and is perpendicular to the straight line of the image plane, and the distance f from the viewpoint to the image plane can be determined arbitrarily; The distance f from the viewpoint to the image plane can be determined arbitrarily on the line connecting the midpoint of the vanishing point and perpendicular to the image plane. 3、根据权利要求2所述的一种基于相对深度计算的画中游方法,其特征在于所说的按照灭点数目对背景图像进行相对深度和模型相对尺寸计算是:对于一个灭点的图像,由背景图像的蜘蛛网格获取以下数据信息:内窗口底边到外窗口底边的距离m1,灭点到外窗口底边的距离vh,即视点高度,灭点到内窗口顶边的距离m2,灭点到内窗口左边的距离p1,灭点到内窗口右边的距离p2,灭点到外窗口左边距离p3,灭点到外窗口右边距离p4,外窗口高度height,采样点到模型左墙为w1,到模型右墙为w2,又根据透视几何原理,计算得到三维盒子模型相对深度和模型相对尺寸如下:相对深度 d = m 1 · f vh - m 1 , 模型高度 h = vh + m 2 · ( f + d ) f , 模型宽度 w = w 1 + w 2 = ( p 1 + p 2 ) · ( f + d ) f . 3. A mid-picture method based on relative depth calculation according to claim 2, characterized in that the calculation of the relative depth and model relative size of the background image according to the number of vanishing points is: for an image of a vanishing point, Obtain the following data information from the spider grid of the background image: the distance m 1 from the bottom edge of the inner window to the bottom edge of the outer window, the distance vh from the vanishing point to the bottom edge of the outer window, which is the height of the viewpoint, and the distance from the vanishing point to the top edge of the inner window m 2 , the distance from the vanishing point to the left of the inner window p 1 , the distance from the vanishing point to the right of the inner window p 2 , the distance from the vanishing point to the left of the outer window p 3 , the distance from the vanishing point to the right of the outer window p 4 , the height of the outer window, From the sampling point to the left wall of the model is w 1 , to the right wall of the model is w 2 , and according to the principle of perspective geometry, the relative depth of the 3D box model and the relative size of the model are calculated as follows: relative depth d = m 1 &Center Dot; f vh - m 1 , model height h = vh + m 2 · ( f + d ) f , model width w = w 1 + w 2 = ( p 1 + p 2 ) &Center Dot; ( f + d ) f . 4、根据权利要求2所述的一种基于相对深度计算的画中游方法,其特征在于所说的按照灭点数目对背景图像进行相对深度和模型相对尺寸计算是:对于两个灭点的图像,由背景图像的蜘蛛网格获取以下数据信息:灭线到内窗口底边距离m1,灭线到左墙底边的距离m2,灭线到右墙底边的距离m3,灭线到外窗口顶边的距离m4,灭线到外窗口底边距离vh,即视点高度,内窗口宽度p1,视点到外窗口左边的距离p2,视点到外窗口右边的距离p3,经过计算得到:后墙相对深度 d 1 = ( vh - m 1 ) · f m 1 , 左墙外沿相对深度 d 2 = ( vh - m 2 ) · f m 2 , 右墙外沿相对深度 d 3 = ( vh - m 3 ) · f m 3 , 后墙宽度 w 1 = ( d 1 + f ) · p 1 f , 左墙外沿宽度 w 2 = ( d 2 + f ) · p 2 f , 右墙外沿宽度 w 3 = ( d 3 + f ) · p 3 f , 模型高度 h = vh + m 4 · ( f + d 1 ) f . 4. A mid-picture method based on relative depth calculation according to claim 2, characterized in that the calculation of the relative depth and model relative size of the background image according to the number of vanishing points is: for the image of two vanishing points , the following data information is obtained from the spider grid of the background image: the distance from the off-line to the bottom of the inner window m 1 , the distance from the off-line to the bottom of the left wall m 2 , the distance from the off-line to the bottom of the right wall m 3 , and the distance from the off-line to the bottom of the right wall m 3 . The distance m 4 to the top edge of the outer window, the distance vh from the vanishing line to the bottom edge of the outer window, that is, the height of the viewpoint, the width p 1 of the inner window, the distance p 2 from the viewpoint to the left side of the outer window, and the distance p 3 from the viewpoint to the right side of the outer window, After calculation: the relative depth of the back wall d 1 = ( vh - m 1 ) &Center Dot; f m 1 , The relative depth of the outer edge of the left wall d 2 = ( vh - m 2 ) &Center Dot; f m 2 , The relative depth of the outer edge of the right wall d 3 = ( vh - m 3 ) &Center Dot; f m 3 , rear wall width w 1 = ( d 1 + f ) &Center Dot; p 1 f , Width of the outer edge of the left wall w 2 = ( d 2 + f ) &Center Dot; p 2 f , Right wall outer edge width w 3 = ( d 3 + f ) · p 3 f , model height h = vh + m 4 &Center Dot; ( f + d 1 ) f . 5、根据权利要求3所述的一种基于相对深度计算的画中游方法,其特征在于所说的一灭点图像计算得到三维盒子模型是:对于一灭点图像,在得到盒子模型相对深度和模型相对尺寸数据之后,确认盒子模型各三维矩形的具体尺寸,其左墙为一个(d-n1)×h的矩形,右墙模型为(d-n2)×h的矩形,天花板模型为(d-n3)×h的矩形,其中, n 1 = ( w 1 - p 3 ) · f p 3 , n 2 = ( w 2 - p 4 ) · f p 4 , n 3 = ( h - height ) · f ( height - vh ) . 5. A mid-picture method based on relative depth calculation according to claim 3, characterized in that said calculation of a vanishing point image to obtain a three-dimensional box model is: for a vanishing point image, after obtaining the relative depth of the box model and After the relative size data of the model, confirm the specific size of each three-dimensional rectangle of the box model. The left wall model is a (dn 1 )×h rectangle, the right wall model is a (dn 2 )×h rectangle, and the ceiling model is (dn 3 ) ×h rectangle, where, no 1 = ( w 1 - p 3 ) · f p 3 , no 2 = ( w 2 - p 4 ) · f p 4 , no 3 = ( h - height ) · f ( height - vh ) .
CNB2004100529740A 2004-07-15 2004-07-15 Travel-in-picture method based on relative depth computing Expired - Fee Related CN1296873C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2004100529740A CN1296873C (en) 2004-07-15 2004-07-15 Travel-in-picture method based on relative depth computing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2004100529740A CN1296873C (en) 2004-07-15 2004-07-15 Travel-in-picture method based on relative depth computing

Publications (2)

Publication Number Publication Date
CN1588453A CN1588453A (en) 2005-03-02
CN1296873C true CN1296873C (en) 2007-01-24

Family

ID=34602677

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2004100529740A Expired - Fee Related CN1296873C (en) 2004-07-15 2004-07-15 Travel-in-picture method based on relative depth computing

Country Status (1)

Country Link
CN (1) CN1296873C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI764672B (en) * 2021-03-08 2022-05-11 宏達國際電子股份有限公司 Background skybox constructing method and electronic device

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101272511B (en) * 2007-03-19 2010-05-26 华为技术有限公司 Method and device for acquiring image depth information and image pixel information
JP5299173B2 (en) * 2009-08-26 2013-09-25 ソニー株式会社 Image processing apparatus, image processing method, and program
CN101697235B (en) * 2009-10-30 2013-04-10 青岛海信移动通信技术股份有限公司 Perspective drawing generation method and perspective drawing generation device
JP5422538B2 (en) * 2010-11-09 2014-02-19 株式会社東芝 Image processing apparatus, display apparatus, method and program thereof
CN102222339B (en) * 2011-06-17 2013-03-20 中国科学院自动化研究所 Multi-dimension background modeling method based on combination of textures and intensity characteristics
CN110070585A (en) * 2019-01-31 2019-07-30 北京字节跳动网络技术有限公司 Image generating method, device and computer readable storage medium
CN111080748B (en) * 2019-12-27 2023-06-02 北京工业大学 Automatic picture synthesizing system based on Internet

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002254900A (en) * 2001-03-06 2002-09-11 Hinako Haraguchi Picture model
US6591005B1 (en) * 2000-03-27 2003-07-08 Eastman Kodak Company Method of estimating image format and orientation based upon vanishing point location

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6591005B1 (en) * 2000-03-27 2003-07-08 Eastman Kodak Company Method of estimating image format and orientation based upon vanishing point location
JP2002254900A (en) * 2001-03-06 2002-09-11 Hinako Haraguchi Picture model

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI764672B (en) * 2021-03-08 2022-05-11 宏達國際電子股份有限公司 Background skybox constructing method and electronic device

Also Published As

Publication number Publication date
CN1588453A (en) 2005-03-02

Similar Documents

Publication Publication Date Title
CN1215443C (en) Layer representation of three-D body and method and device for drawing said body by utilizing it
CN102592275B (en) Virtual viewpoint rendering method
Agarwala et al. Photographing long scenes with multi-viewpoint panoramas
CN102308320B (en) Generating three-dimensional models from images
CN101916454B (en) Method for reconstructing high-resolution human face based on grid deformation and continuous optimization
Kang et al. Tour into the picture using a vanishing line and its extension to panoramic images
Bekins et al. Build-by-number: Rearranging the real world to visualize novel architectural spaces
CN103530907A (en) Complicated three-dimensional model drawing method based on images
JP4680796B2 (en) Image base protrusion displacement mapping method and double displacement mapping method using the method
CN1296873C (en) Travel-in-picture method based on relative depth computing
Döllner et al. Illustrative visualization of 3D city models
CN101334900A (en) Image based plotting method
CN1273940C (en) Fast drawing forest method of graded hierarchical assembling depth paste-up atlas
Laycock et al. Exploring cultural heritage sites through space and time
CN115841539A (en) Three-dimensional light field generation method and device based on visual shell
CN113269819A (en) Method and device for dynamically hiding shelter facing video projection scene
CN119379879A (en) Image processing method, device, equipment and storage medium
Georgiou et al. Projective urban texturing
CN113888683B (en) A method and system for generating a cyclic animation
Perticarini Innovative techniques for the survey of objects no longer accessible and not measurable
Döllner et al. Expressive virtual 3D city models
CN1294538C (en) Improved S-buffer anti-aliasing method
Döllner et al. Non-photorealism in 3D geovirtual environments
Marvie et al. Render-time procedural per-pixel geometry generation.
Shan Building modeling and visualization for urban environment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20070124