CN114387378A - Image generation method and device based on digital twin rendering engine and electronic equipment - Google Patents
Image generation method and device based on digital twin rendering engine and electronic equipment Download PDFInfo
- Publication number
- CN114387378A CN114387378A CN202111654187.3A CN202111654187A CN114387378A CN 114387378 A CN114387378 A CN 114387378A CN 202111654187 A CN202111654187 A CN 202111654187A CN 114387378 A CN114387378 A CN 114387378A
- Authority
- CN
- China
- Prior art keywords
- displayed
- image
- distance
- distance interval
- model
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/04—Texture mapping
Landscapes
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Processing Or Creating Images (AREA)
- Image Generation (AREA)
Abstract
本申请实施例提供了基于数字孪生渲染引擎的图像生成方法、装置及电子设备,若待显示对象在较远的距离区间中则该待显示对象的目标对象模型的分辨率较低,若待显示对象在较近的距离区间中则该待显示对象的目标对象模型的分辨率较高,即距离观看者较远的待显示对象的分辨率较低纹理更单一,距离观看者较近的待显示对象的分辨率较高纹理更丰富,从而在生成的图像中能够减少一个像素中渲染多个差异颜色的情况,能够减少图像中的摩尔纹现象;且本申请实施例中生成的消除摩尔纹后的图像是无损图像,处理后不会变模糊。
The embodiments of the present application provide an image generation method, device, and electronic device based on a digital twin rendering engine. If the object to be displayed is in a far distance range, the resolution of the target object model of the object to be displayed is low. If the object is in the shorter distance range, the resolution of the target object model of the object to be displayed is higher, that is, the resolution of the object to be displayed that is farther from the viewer is lower, and the texture is more single, and the object to be displayed that is closer to the viewer is to be displayed. The resolution of the object is higher and the texture is richer, so that in the generated image, the situation of rendering multiple different colors in one pixel can be reduced, and the moiré phenomenon in the image can be reduced; The image is lossless and will not be blurred after processing.
Description
技术领域technical field
本申请涉及图像处理技术领域,特别是涉及基于数字孪生渲染引擎的图像生成方法、装置及电子设备。The present application relates to the technical field of image processing, and in particular, to an image generation method, apparatus and electronic device based on a digital twin rendering engine.
背景技术Background technique
数字孪生是利用物理模型、传感器数据、运行历史数据等数据,集成多学科、多物理量、多尺度、多概率的仿真过程,在虚拟空间中完成映射,从而反映相对应的实体装备的全生命周期过程。数字孪生三维可视化引擎实时渲染部分,需要拥有图像数据采集和图像数据的渲染处理能力,在多源数据的综合展示情况下,经常会出现摩尔纹闪烁情况,影响图像数据的采集、分析、研判以及视觉呈现的感官体验。Digital twin is a multi-disciplinary, multi-physical, multi-scale, multi-probability simulation process that uses physical models, sensor data, operational history data and other data to complete the mapping in virtual space, thereby reflecting the full life cycle of the corresponding physical equipment. process. The real-time rendering part of the digital twin 3D visualization engine needs to have image data acquisition and image data rendering processing capabilities. Visually presented sensory experience.
生成摩尔纹的主要原因包括相邻的像素颜色落差较大以及一个像素渲染多个差异颜色。在数字孪生三维可视化引擎中,比如重复的线条、圆圈或点的图案与不完美的对齐重叠时,就会出现一个新的、不规律的动态图案,这个现象即称为摩尔纹。摩尔纹会出现在三维场景中的3D模型和贴图纹理中,当两个原始图案相对于彼此移动时,摩尔纹改变其元素的形状和频率。The main reasons for generating moiré patterns include the large color difference between adjacent pixels and the rendering of multiple different colors for one pixel. In a digital twin 3D visualization engine, when patterns such as repeating lines, circles or dots overlap with imperfect alignment, a new, irregular dynamic pattern emerges, a phenomenon known as moiré. Moiré appears in 3D models and map textures in 3D scenes, changing the shape and frequency of its elements as the two original patterns move relative to each other.
现有技术中,实时渲染引擎中的摩尔纹解决方案主要包括控制滤波、上采样插值等调整空间及频率的方案,上采样或图像插值的主要目的是放大原图像,从而可以显示在更高分辨率的显示设备上。而对图像的放大操作并不能带来更多的关于图像的细节信息,因此图像的质量将不可避免地受到影响,图像中仍然存在摩尔纹闪烁的问题。In the prior art, the moiré solution in the real-time rendering engine mainly includes control filtering, upsampling interpolation, etc. to adjust the space and frequency. The main purpose of upsampling or image interpolation is to enlarge the original image, so that it can be displayed in a higher resolution. rate on the display device. The magnifying operation of the image cannot bring more detailed information about the image, so the quality of the image will inevitably be affected, and the problem of moiré flicker still exists in the image.
发明内容SUMMARY OF THE INVENTION
本申请实施例的目的在于提供一种基于数字孪生渲染引擎的图像生成方法、装置及电子设备,以减少图像中的摩尔纹现象。具体技术方案如下:The purpose of the embodiments of the present application is to provide an image generation method, device and electronic device based on a digital twin rendering engine, so as to reduce the moiré phenomenon in the image. The specific technical solutions are as follows:
第一方面,本申请实施例提供了一种基于数字孪生渲染引擎的图像生成方法,所述方法包括:In a first aspect, an embodiment of the present application provides an image generation method based on a digital twin rendering engine, the method comprising:
获取三维场景中各待显示对象距离渲染相机的目标距离;Obtain the target distance of each object to be displayed in the 3D scene from the rendering camera;
针对每一个待显示对象,在预先设置的多个距离区间内确定该待显示对象的目标距离所属的距离区间,作为该待显示对象的目标距离区间;For each object to be displayed, determine the distance interval to which the target distance of the object to be displayed belongs within a plurality of preset distance intervals, as the target distance interval of the object to be displayed;
针对每一个待显示对象,确定该待显示对象的目标距离区间对应的细节等级的对象模型,作为该待显示对象的目标对象模型;其中,不同的距离区间对应不同的细节等级,针对任一距离区间,该距离区间表示的距离越长,该距离区间对应的细节等级越低;针对任一细节等级,该细节等级越低,该细节等级下对象模型的分辨率越低;For each object to be displayed, the object model of the level of detail corresponding to the target distance interval of the object to be displayed is determined as the target object model of the object to be displayed; wherein, different distance intervals correspond to different levels of detail, for any distance interval, the longer the distance represented by the distance interval, the lower the level of detail corresponding to the distance interval; for any detail level, the lower the detail level, the lower the resolution of the object model under the detail level;
基于各所述待显示对象各自的目标对象模型,生成待显示的图像。An image to be displayed is generated based on the respective target object models of the objects to be displayed.
在一种可能的实施方式中,所述基于各所述待显示对象各自的目标对象模型,生成待显示的图像,包括:In a possible implementation manner, the generating the image to be displayed based on the respective target object models of the objects to be displayed includes:
获取各所述待显示对象在待显示的图像中的位姿;acquiring the pose of each object to be displayed in the image to be displayed;
针对每一个待显示对象,根据该待显示对象在待显示的图像中的位姿及该待显示对象的目标距离,对该待显示对象的目标对象模型进行渲染,生成该待显示对象在待显示的图像中的像素区域;For each object to be displayed, according to the pose of the object to be displayed in the image to be displayed and the target distance of the object to be displayed, the target object model of the object to be displayed is rendered to generate the object to be displayed in the to-be-displayed object model the pixel area in the image;
基于各所述待显示对象在待显示的图像中的像素区域,生成待显示的图像。The to-be-displayed image is generated based on the pixel area of each of the to-be-displayed objects in the to-be-displayed image.
在一种可能的实施方式中,所述方法还包括:In a possible implementation, the method further includes:
获取不同距离下采集的所述三维场景中各对象的图像纹理贴图、各所述对象的图像纹理贴图的采集距离、预设的各距离区间;acquiring image texture maps of each object in the three-dimensional scene collected at different distances, collection distances of the image texture maps of each object, and preset distance intervals;
针对每一个图像纹理贴图,将该图像纹理贴图划分到该图像纹理贴图的采集距离所属的距离区间所对应的图像集合中;For each image texture map, divide the image texture map into the image set corresponding to the distance interval to which the acquisition distance of the image texture map belongs;
针对每一个距离区间,根据该距离区间所对应的图像集合中各对象的图像纹理贴图,建立该距离区间对应的细节等级下各对象的对象模型。For each distance interval, according to the image texture maps of each object in the image set corresponding to the distance interval, an object model of each object at the level of detail corresponding to the distance interval is established.
在一种可能的实施方式中,所述针对每一个距离区间,根据该距离区间所对应的图像集合中各对象的图像纹理贴图,建立该距离区间对应的细节等级下各对象的对象模型,包括:In a possible implementation manner, for each distance interval, according to the image texture map of each object in the image set corresponding to the distance interval, the object model of each object under the level of detail corresponding to the distance interval is established, including :
针对每一个距离区间,从该距离区间的各对象的图像纹理贴图中选取多个批次的样本数据,利用各批次的样本数据分别确定每一对象在该距离区间对应的细节等级下的多个初级对象模型;For each distance interval, select multiple batches of sample data from the image texture maps of each object in the distance interval, and use the sample data of each batch to determine the amount of each object at the level of detail corresponding to the distance interval. a primary object model;
针对每一个对象,分别对该对象在相同距离区间对应的细节等级下的各初级对象模型进行模型混编,得到该对象在各距离区间对应的细节等级下的对象模型。For each object, model mixing is performed on each primary object model of the object at the level of detail corresponding to the same distance interval, and the object model of the object at the level of detail corresponding to each distance interval is obtained.
在一种可能的实施方式中,所述方法还包括:In a possible implementation, the method further includes:
针对存在摩尔纹的图像纹理贴图中的摩尔纹区域,计算所述摩尔纹区域中相邻像素之间的颜色差值;For the moiré area in the image texture map with moiré, calculating the color difference between adjacent pixels in the moiré area;
针对颜色差值大于预设差值阈值的相邻像素,根据该相邻像素中两个像素的颜色计算得到差值颜色,在该相邻像素之间插入差值颜色的像素。For adjacent pixels with a color difference greater than a preset difference threshold, a difference color is calculated according to the colors of two pixels in the adjacent pixels, and a pixel of the difference color is inserted between the adjacent pixels.
第二方面,本申请实施例提供了一种基于数字孪生渲染引擎的图像生成装置,所述装置包括:In a second aspect, an embodiment of the present application provides an image generation device based on a digital twin rendering engine, the device comprising:
距离获取模块,用于获取三维场景中各待显示对象距离渲染相机的目标距离;A distance acquisition module, used to acquire the target distance of each object to be displayed in the 3D scene from the rendering camera;
区间确定模块,用于针对每一个待显示对象,在预先设置的多个距离区间内确定该待显示对象的目标距离所属的距离区间,作为该待显示对象的目标距离区间;an interval determination module for determining, for each object to be displayed, the distance interval to which the target distance of the object to be displayed belongs within a plurality of preset distance intervals, as the target distance interval of the object to be displayed;
模型确定模块,用于针对每一个待显示对象,确定该待显示对象的目标距离区间对应的细节等级的对象模型,作为该待显示对象的目标对象模型;其中,不同的距离区间对应不同的细节等级,针对任一距离区间,该距离区间表示的距离越长,该距离区间对应的细节等级越低;针对任一细节等级,该细节等级越低,该细节等级下对象模型的分辨率越低;The model determination module is used for determining the object model of the detail level corresponding to the target distance interval of the to-be-displayed object for each to-be-displayed object as the target object model of the to-be-displayed object; wherein, different distance intervals correspond to different details Level, for any distance interval, the longer the distance represented by the distance interval, the lower the level of detail corresponding to the distance interval; for any level of detail, the lower the level of detail, the lower the resolution of the object model under the level of detail ;
图像生成模块,用于基于各所述待显示对象各自的目标对象模型,生成待显示的图像。The image generation module is configured to generate an image to be displayed based on the respective target object models of the objects to be displayed.
在一种可能的实施方式中,所述图像生成模块,具体用于:In a possible implementation manner, the image generation module is specifically used for:
获取各所述待显示对象在待显示的图像中的位姿;acquiring the pose of each object to be displayed in the image to be displayed;
针对每一个待显示对象,根据该待显示对象在待显示的图像中的位姿及该待显示对象的目标距离,对该待显示对象的目标对象模型进行渲染,生成该待显示对象在待显示的图像中的像素区域;For each object to be displayed, according to the pose of the object to be displayed in the image to be displayed and the target distance of the object to be displayed, the target object model of the object to be displayed is rendered to generate the object to be displayed in the to-be-displayed object model the pixel area in the image;
基于各所述待显示对象在待显示的图像中的像素区域,生成待显示的图像。The to-be-displayed image is generated based on the pixel area of each of the to-be-displayed objects in the to-be-displayed image.
在一种可能的实施方式中,所述装置还包括:In a possible implementation, the device further includes:
贴图获取模块,用于获取不同距离下采集的所述三维场景中各对象的图像纹理贴图、各所述对象的图像纹理贴图的采集距离、预设的各距离区间;a map acquisition module, configured to acquire image texture maps of each object in the three-dimensional scene collected at different distances, a collection distance of the image texture maps of each object, and preset distance intervals;
贴图划分模块,用于针对每一个图像纹理贴图,将该图像纹理贴图划分到该图像纹理贴图的采集距离所属的距离区间所对应的图像集合中;A map dividing module, for dividing the image texture map into the image set corresponding to the distance interval to which the acquisition distance of the image texture map belongs for each image texture map;
模型建立模块,用于针对每一个距离区间,根据该距离区间所对应的图像集合中各对象的图像纹理贴图,建立该距离区间对应的细节等级下各对象的对象模型。The model building module is used for, for each distance interval, to establish an object model of each object under the level of detail corresponding to the distance interval according to the image texture maps of each object in the image set corresponding to the distance interval.
在一种可能的实施方式中,所述模型建立模块,具体用于:In a possible implementation manner, the model establishment module is specifically used for:
针对每一个距离区间,从该距离区间的各对象的图像纹理贴图中选取多个批次的样本数据,利用各批次的样本数据分别确定每一对象在该距离区间对应的细节等级下的多个初级对象模型;For each distance interval, select multiple batches of sample data from the image texture maps of each object in the distance interval, and use the sample data of each batch to determine the amount of each object at the level of detail corresponding to the distance interval. a primary object model;
针对每一个对象,分别对该对象在相同距离区间对应的细节等级下的各初级对象模型进行模型混编,得到该对象在各距离区间对应的细节等级下的对象模型。For each object, model mixing is performed on each primary object model of the object at the level of detail corresponding to the same distance interval, and the object model of the object at the level of detail corresponding to each distance interval is obtained.
在一种可能的实施方式中,所述装置还包括颜色补偿模块,用于:In a possible implementation manner, the device further includes a color compensation module for:
针对存在摩尔纹的图像纹理贴图中的摩尔纹区域,计算所述摩尔纹区域中相邻像素之间的颜色差值;For the moiré area in the image texture map with moiré, calculating the color difference between adjacent pixels in the moiré area;
针对颜色差值大于预设差值阈值的相邻像素,根据该相邻像素中两个像素的颜色计算得到差值颜色,在该相邻像素之间插入差值颜色的像素。For adjacent pixels with a color difference greater than a preset difference threshold, a difference color is calculated according to the colors of two pixels in the adjacent pixels, and a pixel of the difference color is inserted between the adjacent pixels.
第三方面,本申请实施例提供了一种电子设备,包括处理器及存储器;In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory;
所述存储器,用于存放计算机程序;the memory for storing computer programs;
所述处理器,用于执行所述存储器上所存放的程序时,实现本申请中任一所述的方法。The processor is configured to implement any of the methods described in this application when executing the program stored in the memory.
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现本申请中任一所述的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any one of the methods described in the present application is implemented .
第五方面,本申请实施例提供了本申请实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行本申请中任一所述的方法。In a fifth aspect, the embodiments of the present application provide the embodiments of the present application and also provide a computer program product including instructions, which, when run on a computer, cause the computer to execute any one of the methods described in the present application.
本申请实施例有益效果:Beneficial effects of the embodiments of the present application:
本申请实施例提供的基于数字孪生渲染引擎的图像生成方法、装置及电子设备,获取三维场景中各待显示对象距离渲染相机的目标距离;针对每一个待显示对象,在预先设置的多个距离区间内确定该待显示对象的目标距离所属的距离区间,作为该待显示对象的目标距离区间;针对每一个待显示对象,确定该待显示对象的目标距离区间对应的细节等级的对象模型,作为该待显示对象的目标对象模型;其中,不同的距离区间对应不同的细节等级,针对任一距离区间,该距离区间表示的距离越长,该距离区间对应的细节等级越低;针对任一细节等级,该细节等级越低,该细节等级下对象模型的分辨率越低;基于各待显示对象各自的目标对象模型,生成待显示的图像。若待显示对象在较远的距离区间中则该待显示对象的目标对象模型的分辨率较低,若待显示对象在较近的距离区间中则该待显示对象的目标对象模型的分辨率较高,即距离观看者较远的待显示对象的分辨率较低纹理更单一,距离观看者较近的待显示对象的分辨率较高纹理更丰富,从而在生成的图像中能够减少一个像素中渲染多个差异颜色的情况,能够减少图像中的摩尔纹现象;且本申请实施例中生成的消除摩尔纹后的图像是无损图像,处理后不会变模糊。The image generation method, device, and electronic device based on a digital twin rendering engine provided by the embodiments of the present application acquire the target distance of each object to be displayed in the three-dimensional scene from the rendering camera; for each object to be displayed, at a plurality of preset distances In the interval, the distance interval to which the target distance of the object to be displayed belongs is determined as the target distance interval of the object to be displayed; for each object to be displayed, the object model of the level of detail corresponding to the target distance interval of the object to be displayed is determined as the target distance interval of the object to be displayed. The target object model of the object to be displayed; wherein, different distance intervals correspond to different detail levels, and for any distance interval, the longer the distance represented by the distance interval, the lower the detail level corresponding to the distance interval; for any detail level level, the lower the level of detail, the lower the resolution of the object model under the level of detail; the image to be displayed is generated based on the respective target object models of the objects to be displayed. If the object to be displayed is in a far distance interval, the resolution of the target object model of the object to be displayed is lower, and if the object to be displayed is in a short distance interval, the resolution of the target object model of the object to be displayed is higher High, that is, the object to be displayed that is far from the viewer has a lower resolution and a more monolithic texture, and the object to be displayed that is closer to the viewer has a higher resolution and richer texture, so that one pixel can be reduced in the generated image. In the case of rendering multiple different colors, the moiré phenomenon in the image can be reduced; and the image after the moiré removal is generated in the embodiment of the present application is a lossless image, and will not become blurred after processing.
当然,实施本申请的任一产品或方法并不一定需要同时达到以上所述的所有优点。Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time.
附图说明Description of drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application, and for those of ordinary skill in the art, other drawings can also be obtained according to these drawings.
图1为本申请实施例的基于数字孪生渲染引擎的图像生成方法的一种示意图;1 is a schematic diagram of an image generation method based on a digital twin rendering engine according to an embodiment of the application;
图2为本申请实施例中步骤S104的一种可能的实施方式的示意图;FIG. 2 is a schematic diagram of a possible implementation of step S104 in the embodiment of the present application;
图3为本申请实施例的对象模型建立方法的一种示意图;3 is a schematic diagram of a method for establishing an object model according to an embodiment of the present application;
图4为本申请实施例的对象模型建立方法的另一种示意图;4 is another schematic diagram of the method for establishing an object model according to an embodiment of the present application;
图5为本申请实施例的基于数字孪生渲染引擎的图像生成装置的一种示意图;5 is a schematic diagram of an image generation device based on a digital twin rendering engine according to an embodiment of the application;
图6为本申请实施例的电子设备的一种示意图。FIG. 6 is a schematic diagram of an electronic device according to an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员基于本申请所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art based on the present application fall within the protection scope of the present application.
为了减少图像中的摩尔纹现象,本申请实施例提供了一种基于数字孪生渲染引擎的图像生成方法,参见图1,所述方法包括:In order to reduce the moiré phenomenon in the image, an embodiment of the present application provides an image generation method based on a digital twin rendering engine, see FIG. 1 , the method includes:
S101,获取三维场景中各待显示对象距离渲染相机的目标距离。S101: Acquire a target distance of each object to be displayed in a three-dimensional scene from a rendering camera.
本申请实施例的基于数字孪生渲染引擎的图像生成方法可以通过电子设备实现,可以应用于数字孪生引擎、三维场景建模、图像数据渲染等场景中。一个例子中,上述电子设备可以为个人电脑、服务器、智能手机或VR(Virtual Reality,虚拟现实)设备等。The image generation method based on the digital twin rendering engine in the embodiment of the present application may be implemented by an electronic device, and may be applied to scenarios such as a digital twin engine, three-dimensional scene modeling, and image data rendering. In an example, the above electronic device may be a personal computer, a server, a smart phone, or a VR (Virtual Reality, virtual reality) device, or the like.
此处三维场景为需要进行图像显示的三维场景,渲染相机是一个虚拟的相机,可以理解为观看该三维场景的视点,而并不是真正的相机设备。为了方便理解,下面举一个简单的例子,例如三维场景为教室三维场景,用户希望在讲台的正中心光看整个教室,则认为渲染相机在讲台的正中心,即渲染相机为用户的视点。渲染相机拍摄到的图像即为待显示的图像,也即用户看到的图像。Here, the three-dimensional scene is a three-dimensional scene that needs to be displayed, and the rendering camera is a virtual camera, which can be understood as a viewpoint for viewing the three-dimensional scene, rather than a real camera device. To facilitate understanding, a simple example is given below. For example, the 3D scene is a classroom 3D scene. If the user wants to see the entire classroom from the center of the podium, the rendering camera is considered to be in the center of the podium, that is, the rendering camera is the user's viewpoint. The image captured by the rendering camera is the image to be displayed, that is, the image that the user sees.
一个例子中,待显示对象距离渲染相机的目标距离可以通过前端感知算法得到。前端感知算法是指数字孪生引擎的三维场景中的对象距离渲染相机距离与相对设备显示器分辨率尺寸的算法。In one example, the target distance between the object to be displayed and the rendering camera can be obtained through a front-end perception algorithm. The front-end perception algorithm refers to the algorithm of the distance of the objects in the 3D scene of the digital twin engine from the rendering camera and the relative size of the device display resolution.
在一种可能的实施方式中,所述获取三维场景中各待显示对象距离渲染相机的目标距离,包括:获取渲染相机在三维场景中的位姿;根据所述渲染相机的位姿,确定所述三维场景中各待显示对象及所述渲染相机距离各所述待显示对象的目标距离。In a possible implementation manner, the acquiring the target distance of each object to be displayed in the three-dimensional scene from the rendering camera includes: acquiring the pose of the rendering camera in the three-dimensional scene; determining the pose of the rendering camera according to the pose of the rendering camera. Each object to be displayed in the three-dimensional scene and the target distance from the rendering camera to each of the objects to be displayed.
位姿包括位置及姿态两个方面,渲染相机的姿态表示渲染相机的拍摄方向,在结合渲染相机的位置,可以确定渲染相机可以拍摄到三维场景中的哪些对象,将渲染相机拍摄到的三维场景中的对象称为待显示对象,根据待显示对象在三维场景中的位姿,还可以得到渲染相机距离每一个待显示对象的目标距离。The pose includes two aspects: position and attitude. The pose of the rendering camera represents the shooting direction of the rendering camera. Combined with the position of the rendering camera, which objects in the 3D scene can be captured by the rendering camera, the 3D scene captured by the rendering camera can be determined. The object in is called the object to be displayed. According to the pose of the object to be displayed in the 3D scene, the target distance between the rendering camera and each object to be displayed can also be obtained.
渲染相机在三维场景中的位姿的获取方式可以参见现有技术,一个例子中,以VR设备为例,可以根据VR设备中的陀螺仪、定位仪等来得到VR设备在世界坐标系中的位姿,结合显示器的分辨率及世界坐标系与三维场景坐标系的转换关系,从而可以得到渲染相机在三维场景中的位姿。For the acquisition method of the pose of the rendering camera in the three-dimensional scene, reference may be made to the prior art. In an example, taking a VR device as an example, the VR device in the world coordinate system can be obtained according to a gyroscope, a locator, etc. in the VR device. The pose, combined with the resolution of the display and the conversion relationship between the world coordinate system and the three-dimensional scene coordinate system, can obtain the pose of the rendering camera in the three-dimensional scene.
S102,针对每一个待显示对象,在预先设置的多个距离区间内确定该待显示对象的目标距离所属的距离区间,作为该待显示对象的目标距离区间。S102 , for each object to be displayed, determine a distance interval to which the target distance of the object to be displayed belongs within a plurality of preset distance intervals as the target distance interval of the object to be displayed.
距离区间是预先设置好的,距离区间的数量以及每个距离区间的距离跨度可以根据实际情况自定义设置,不同距离区间的距离跨度可以相同也可以不同。一个例子中,以三个距离区间为例,距离区间1为0米到10米,距离区间2为10米到50米,距离区间3为50米以上;此种情况下若待显示对象1的目标距离为5米,5米属于0米到10米的距离区间1,则距离区间1即为待显示对象1的目标距离区间;若待显示对象2的目标距离为15米,15米属于10米到50米的距离区间2,则距离区间2即为待显示对象2的目标距离区间。The distance interval is preset. The number of distance intervals and the distance span of each distance interval can be customized according to the actual situation. The distance spans of different distance intervals can be the same or different. In an example, take three distance intervals as an example, the distance interval 1 is 0 to 10 meters, the distance interval 2 is 10 to 50 meters, and the distance interval 3 is more than 50 meters; The target distance is 5 meters, and 5 meters belongs to the distance interval 1 from 0 meters to 10 meters, then the distance interval 1 is the target distance interval of the object 1 to be displayed; if the target distance of the object 2 to be displayed is 15 meters, 15 meters belong to 10 If the distance interval 2 is between meters and 50 meters, the distance interval 2 is the target distance interval of the object 2 to be displayed.
S103,针对每一个待显示对象,确定该待显示对象的目标距离区间对应的细节等级的对象模型,作为该待显示对象的目标对象模型;其中,不同的距离区间对应不同的细节等级,针对任一距离区间,该距离区间表示的距离越长,该距离区间对应的细节等级越低;针对任一细节等级,该细节等级越低,该细节等级下对象模型的分辨率越低。S103, for each object to be displayed, determine the object model of the level of detail corresponding to the target distance interval of the object to be displayed, as the target object model of the object to be displayed; wherein, different distance intervals correspond to different levels of detail, for any A distance interval, the longer the distance represented by the distance interval, the lower the level of detail corresponding to the distance interval; for any detail level, the lower the detail level, the lower the resolution of the object model under the detail level.
不同距离区间对应不同的细节等级,同一对象在不同细节等级下的对象模型的分辨率不同。距离区间表示的距离越长,则该距离区间对应的细节等级越低,细节等级越低,则该细节等级下对象模型的分辨率越低。不同细节等级的下对象模型的分辨率可以根据显示器的分辨率尺寸设置。Different distance intervals correspond to different levels of detail, and the object models of the same object at different levels of detail have different resolutions. The longer the distance represented by the distance interval, the lower the level of detail corresponding to the distance interval, and the lower the level of detail, the lower the resolution of the object model under the level of detail. The resolution of the lower object model at different levels of detail can be set according to the resolution size of the display.
为了方便理解,下面举一个简单的例子,以三个距离区间为例,距离区间1为0米到10米,对应细节等级3;距离区间2为10米到50米,对应细节等级2;距离区间3为50米以上,对应细节等级1;则对象1在细节等级3下的对象模型可以通过1000个像素表示,对象1在细节等级2下的对象模型可以通过100个像素表示,对象1在细节等级1下的对象模型可以通过10个像素表示。可以理解的是,此处的数值仅为举例,实际场景中可以按照本申请中的原则自定义设置。In order to facilitate understanding, a simple example is given below. Taking three distance intervals as an example, distance interval 1 is 0 to 10 meters, corresponding to detail level 3; distance interval 2 is 10 meters to 50 meters, corresponding to detail level 2; distance The interval 3 is more than 50 meters, corresponding to the detail level 1; then the object model of object 1 at detail level 3 can be represented by 1000 pixels, the object model of object 1 at detail level 2 can be represented by 100 pixels, and the object model of object 1 at detail level 2 can be represented by 100 pixels. Object models at detail level 1 can be represented by 10 pixels. It can be understood that the numerical values here are only examples, and in actual scenarios, custom settings can be made according to the principles in this application.
一个例子中,本申请实施例中的细节等级具体可以为LOD(Levels of Detail),LOD指根据对象的关键节点在显示环境中所处的位置和重要度,决定待显示图像中渲染资源的分配,降低非重要物体的精度和细节度,从而获得高效率的计算结果。在本申请实施例中根据不同的可视距离(即待显示对象的目标距离)分别显示各对象。In one example, the level of detail in the embodiment of the present application may be LOD (Levels of Detail), and LOD refers to determining the allocation of rendering resources in the image to be displayed according to the position and importance of key nodes of the object in the display environment. , reduce the accuracy and detail of non-important objects, so as to obtain high-efficiency calculation results. In the embodiment of the present application, each object is displayed separately according to different visual distances (ie, the target distance of the object to be displayed).
用z buffer表示待显示对象距离渲染相机的目标距离,在跨距离区间的情况下,zbuffer值越大,该待显示对象的LOD等级就越低,LOD等级越低,则同一对象的对象模型的分辨率也就越低。根据z buffer值的变化自动计算并切换不同的LOD等级,得到各待显示对象各自对应的LOD下的对象模型。The z buffer is used to represent the target distance of the object to be displayed from the rendering camera. In the case of spanning distance intervals, the larger the zbuffer value is, the lower the LOD level of the object to be displayed. The resolution is also lower. According to the change of the z buffer value, different LOD levels are automatically calculated and switched, and the object model under the LOD corresponding to each object to be displayed is obtained.
S104,基于各所述待显示对象各自的目标对象模型,生成待显示的图像。S104, based on the respective target object models of the objects to be displayed, generate an image to be displayed.
对各待显示对象的目标对象模型进行渲染,从而得到待显示的图像。一个例子中可以基于各待显示对象的目标对象模型,通过多尺度算法融合图像纹理数据和三维模型数据特征图还原消除摩尔纹后的图像。The target object model of each object to be displayed is rendered to obtain the image to be displayed. In one example, based on the target object model of each object to be displayed, a multi-scale algorithm can be used to fuse the image texture data and the feature map of the three-dimensional model data to restore the image after the moiré has been eliminated.
根据数字孪生渲染引擎的渲染相机到待显示对象的目标距离(z buffer),来判断待显示对象的LOD等级,最终确定待显示对象在显示器中的显示分辨率,待显示对象的zbuffer值越小,其引擎分辨率的LOD等级越大。待显示对象的Z buffer值越大,其引擎分辨率展示的LOD等级越小,从而减少摩尔纹闪烁现象。According to the target distance (z buffer) from the rendering camera of the digital twin rendering engine to the object to be displayed, the LOD level of the object to be displayed is determined, and the display resolution of the object to be displayed in the display is finally determined. The smaller the zbuffer value of the object to be displayed is , the higher the LOD level of its engine resolution. The larger the Z buffer value of the object to be displayed, the smaller the LOD level displayed by its engine resolution, thereby reducing the moiré flickering phenomenon.
在本申请实施例中,若待显示对象在较远的距离区间中则该待显示对象的目标对象模型的分辨率较低,若待显示对象在较近的距离区间中则该待显示对象的目标对象模型的分辨率较高,即距离观看者较远的待显示对象的分辨率较低纹理更单一,距离观看者较近的待显示对象的分辨率较高纹理更丰富,从而在生成的图像中能够减少一个像素中渲染多个差异颜色的情况,能够减少图像中的摩尔纹现象;且本申请实施例中生成的消除摩尔纹后的图像是无损图像,处理后不会变模糊。In the embodiment of the present application, if the object to be displayed is in a far distance interval, the resolution of the target object model of the object to be displayed is lower, and if the object to be displayed is in a relatively short distance interval, the resolution of the object to be displayed is The resolution of the target object model is higher, that is, the object to be displayed that is farther from the viewer has a lower resolution and a simpler texture, and the object to be displayed that is closer to the viewer has a higher resolution and richer texture. In the image, the situation of rendering multiple different colors in one pixel can be reduced, and the moiré phenomenon in the image can be reduced; and the image after the moiré removal generated in the embodiment of the present application is a lossless image, and will not become blurred after processing.
在一种可能的实施方式中,参见图2,所述基于各所述待显示对象各自的目标对象模型,生成待显示的图像,包括:In a possible implementation manner, referring to FIG. 2 , the generation of the image to be displayed based on the respective target object models of the objects to be displayed includes:
S1041,获取各所述待显示对象在待显示的图像中的位姿。S1041: Acquire the pose of each object to be displayed in the image to be displayed.
一个例子中,可以根据渲染相机的位姿以及各待显示对象在三维场景中的位姿,来确定各待显示对象在待显示的图像中的位姿。In one example, the pose of each object to be displayed in the image to be displayed may be determined according to the pose of the rendering camera and the pose of each object to be displayed in the three-dimensional scene.
S1042,针对每一个待显示对象,根据该待显示对象在待显示的图像中的位姿及该待显示对象的目标距离,对该待显示对象的目标对象模型进行渲染,生成该待显示对象在待显示的图像中的像素区域。S1042, for each to-be-displayed object, according to the pose of the to-be-displayed object in the to-be-displayed image and the target distance of the to-be-displayed object, render the target object model of the to-be-displayed object, and generate the to-be-displayed object at The area of pixels in the image to be displayed.
针对每一个待显示对象,根据该待显示对象的目标距离,可以得到该待显示对象的目标对象模型在待显示的图像中的大小,在结合该待显示对象在待显示的图像中的位姿,对该待显示对象的目标对象模型进行渲染,可以生成该待显示对象在待显示的图像中的像素区域。For each object to be displayed, according to the target distance of the object to be displayed, the size of the target object model of the object to be displayed in the image to be displayed can be obtained. Combined with the pose of the object to be displayed in the image to be displayed , the target object model of the object to be displayed is rendered, and the pixel area of the object to be displayed in the image to be displayed can be generated.
一个例子中,同一细节等级下的对象模型还可以分为不同的精细程度。在显示器的分辨率固定的情况下,假设待显示对象的目标距离D为1时该待显示对象的精细程度比为1,则该待显示对象的精细程度可以表示为:In one example, the object models at the same level of detail can also be classified into different levels of finesse. In the case where the resolution of the display is fixed, assuming that the target distance D of the object to be displayed is 1, the fineness ratio of the object to be displayed is 1, then the fineness of the object to be displayed can be expressed as:
L=|1/D|L=|1/D|
L表示模型的精细程度,当D小于1时,随着D的减小,L无限趋近于正无穷,则应用对应的LOD下最高清的对象模型;当D大于1时,随着D的增长,L无限趋近于0,则应用对应的LOD下精度最低的对象模型。L represents the fineness of the model. When D is less than 1, as D decreases, L is infinitely close to positive infinity, and the highest-definition object model under the corresponding LOD is applied; when D is greater than 1, as D decreases If L grows, L approaches 0 infinitely, and the object model with the lowest accuracy under the corresponding LOD is applied.
S1043,基于各所述待显示对象在待显示的图像中的像素区域,生成待显示的图像。S1043 , generating an image to be displayed based on the pixel area of each of the objects to be displayed in the image to be displayed.
在本申请实施例中,对各待显示对象的目标对象模型进行渲染,得到各待显示对象在待显示的图像中的像素区域,进一步得到待显示的图像。In the embodiment of the present application, the target object model of each object to be displayed is rendered, the pixel area of each object to be displayed in the to-be-displayed image is obtained, and the to-be-displayed image is further obtained.
下面对对象模型的建立过程进行说明,在一种可能的实施方式中,参见图3,所述方法还包括:The establishment process of the object model will be described below. In a possible implementation manner, referring to FIG. 3 , the method further includes:
S301,获取不同距离下采集的所述三维场景中各对象的图像纹理贴图、各所述对象的图像纹理贴图的采集距离、预设的各距离区间。S301: Acquire image texture maps of each object in the three-dimensional scene collected at different distances, acquisition distances of the image texture maps of each object, and preset distance intervals.
一个例子中,可以对采集的图像纹理贴图进行预处理,利用数字孪生渲染引擎对不同细节等级的图像纹理贴图进行处理,图像纹理贴图的尺寸需要为2的次幂,其中,2的次幂参照表有2,4,8,16,32,64,128,256,512,1024,2048尺寸的图片。In one example, the collected image texture maps can be preprocessed, and the digital twin rendering engine is used to process image texture maps of different levels of detail. The size of the image texture map needs to be a power of 2, where the power of 2 refers to The table has 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 size pictures.
S302,针对每一个图像纹理贴图,将该图像纹理贴图划分到该图像纹理贴图的采集距离所属的距离区间所对应的图像集合中。S302 , for each image texture map, divide the image texture map into image sets corresponding to the distance intervals to which the acquisition distance of the image texture map belongs.
针对每一个图像纹理贴图,根据渲染相机到采集该图像纹理贴图的距离来判断该图像纹理贴图对应的细节等级,不同细节等级对应不同的距离区间,将该图像纹理贴图划分到该图像纹理贴图的采集距离所属的距离区间所对应的图像集合中。图像纹理贴图的采集距离越小,该图像纹理贴图对应的细节等级越高。图像纹理贴图的采集距离越大,该图像纹理贴图对应的细节等级越低,从而可以减少图像纹理贴图因素造成的摩尔纹闪烁现象。For each image texture map, the detail level corresponding to the image texture map is determined according to the distance from the rendering camera to the acquisition of the image texture map. Different detail levels correspond to different distance intervals, and the image texture map is divided into the image texture map. In the image set corresponding to the distance interval to which the collection distance belongs. The smaller the acquisition distance of the image texture map, the higher the level of detail corresponding to the image texture map. The larger the collection distance of the image texture map, the lower the level of detail corresponding to the image texture map, which can reduce the moiré flickering phenomenon caused by the image texture map factor.
S303,针对每一个距离区间,根据该距离区间所对应的图像集合中各对象的图像纹理贴图,建立该距离区间对应的细节等级下各对象的对象模型。S303 , for each distance interval, establish an object model of each object at the level of detail corresponding to the distance interval according to the image texture maps of each object in the image set corresponding to the distance interval.
一个例子中,可以结合图像纹理贴图数据、对象的三维模型数据、多分辨率参数数据分别对不同细节等级下的对象进行建模。In one example, objects at different levels of detail can be modeled separately by combining image texture map data, 3D model data of the object, and multi-resolution parameter data.
在一种可能的实施方式中,所述针对每一个距离区间,根据该距离区间所对应的图像集合中各对象的图像纹理贴图,建立该距离区间对应的细节等级下各对象的对象模型,包括:In a possible implementation manner, for each distance interval, according to the image texture map of each object in the image set corresponding to the distance interval, the object model of each object under the level of detail corresponding to the distance interval is established, including :
步骤一,针对每一个距离区间,从该距离区间的各对象的图像纹理贴图中选取多个批次的样本数据,利用各批次的样本数据分别确定每一对象在该距离区间对应的细节等级下的多个初级对象模型。Step 1: For each distance interval, select multiple batches of sample data from the image texture maps of each object in the distance interval, and use the sample data of each batch to determine the level of detail corresponding to each object in the distance interval. Multiple primary object models below.
步骤二,针对每一个对象,分别对该对象在相同距离区间对应的细节等级下的各初级对象模型进行模型混编,得到该对象在各距离区间对应的细节等级下的对象模型。Step 2: For each object, model mixing is performed on each primary object model of the object at the level of detail corresponding to the same distance interval, to obtain the object model of the object at the level of detail corresponding to each distance interval.
一个例子中,可以采用多数据模型混编算法实现模型混编,多数据模型混编算法是指将多个维度的数据源模型进行混编融合计算,可达到精准的分析预判能力,多数据模型混编算法是把多个不同类型的弱模型混编成一个强模型。针对每一个距离区间,从该距离区间的各对象的图像纹理贴图中进行多个批次样本数据的自动采样,每个批次的采样数据中均包含多个样本数据,共N个批次,分别利用N个批次的样本数据训练得到N个初级对象模型,然后对同一对象的N个初级对象模型结果进行融合混编,得到对象在该距离区间对应的细节等级下的对象模型。In one example, the multi-data model mixing algorithm can be used to realize model mixing. The multi-data model mixing algorithm refers to the mixing and fusion of data source models of multiple dimensions, which can achieve accurate analysis and prediction ability, and multi-data model mixing can be achieved. The model shuffling algorithm is to shuffle multiple weak models of different types into a strong model. For each distance interval, automatic sampling of multiple batches of sample data is performed from the image texture map of each object in the distance interval. The sampling data of each batch contains multiple sample data, with a total of N batches. N primary object models are obtained by training with N batches of sample data respectively, and then the N primary object model results of the same object are fused and mixed to obtain the object model of the object at the level of detail corresponding to the distance interval.
模型混编算法可以分别采用投票法和均值法。其中,投票法是指如果是分类模型,每个模型都会给出一个类别预测结果,通过投票的方式,按照少数服从多数的原则融合得到一个新的预测结果。均值法是指如果是回归模型,每个模型给出的预测结果都是数值型的,这时候我们可以通过求所有子模型的预测结果的均值作为最终的融合结果。模型混编算法中各初级对象模型间没有相互联系,是一种并行的融合方法,可同时并行处理N个初级对象模型,能够大大提升算法执行效率;其过程可以如图4所示,其中,LOD数据中除了图像纹理贴图外还可以包括对象的的三维模型数据等。The model mixing algorithm can use the voting method and the mean method respectively. Among them, the voting method means that if it is a classification model, each model will give a category prediction result. Through voting, a new prediction result is obtained by fusion according to the principle of minority obeying the majority. The mean method means that if it is a regression model, the prediction results given by each model are numerical. At this time, we can calculate the mean of the prediction results of all sub-models as the final fusion result. In the model mixing algorithm, there is no mutual connection between the primary object models. It is a parallel fusion method. It can process N primary object models in parallel at the same time, which can greatly improve the execution efficiency of the algorithm. The process can be shown in Figure 4, where, In addition to image texture maps, LOD data can also include 3D model data of objects and the like.
在本申请实施例中,建立对象模型所使用的的数据源获取简单便捷,实施成本低,使用的模型混编的方式来得到对象模型,算法简单无需大量深度学习训练;可以应用于无法无人机采集数据的数字孪生项目中,能够大大降低实施成本低。In the embodiment of the present application, the data source used for establishing the object model is simple and convenient to obtain, the implementation cost is low, and the model is mixed to obtain the object model, and the algorithm is simple and does not require a large amount of deep learning training; In the digital twin project of data collection by computer, the implementation cost can be greatly reduced.
为了进一步减少摩尔纹闪烁的现象,在一种可能的实施方式中,所述方法还包括:In order to further reduce the phenomenon of moiré flickering, in a possible implementation manner, the method further includes:
步骤A,针对存在摩尔纹的图像纹理贴图中的摩尔纹区域,计算所述摩尔纹区域中相邻像素之间的颜色差值。Step A, for the moiré area in the image texture map where the moiré exists, calculate the color difference between adjacent pixels in the moiré area.
步骤B,针对颜色差值大于预设差值阈值的相邻像素,根据该相邻像素中两个像素的颜色计算得到差值颜色,在该相邻像素之间插入差值颜色的像素。Step B: For adjacent pixels with a color difference greater than a preset difference threshold, calculate a difference color according to the colors of two pixels in the adjacent pixels, and insert a pixel of the difference color between the adjacent pixels.
预设差值阈值可以根据实际情况自定义设置,可以为实验值或经验值。一个例子中,可以对相邻像素中两个像素的颜色进行加权平均,从而得到差值颜色。The preset difference threshold can be customized according to the actual situation, which can be an experimental value or an empirical value. In one example, a weighted average of the colors of two adjacent pixels may be performed to obtain a difference color.
在某个LOD等级下的图像纹理贴图中出现摩尔纹时,可以通过补差值的辅助方法,来减少摩尔纹闪烁的现象。补差值是指相邻像素的颜色差别太大时,如相邻像素分别为黑色与白色时,在黑色与白色之间增加插值色作为中间值,从而进一步减少摩尔纹闪烁现象。除了增加插值色之外,还可以去除颜色差异大的相邻的2个像素的模型结构,或将像素调整为相近颜色的模型结构等。When moiré appears in the image texture map under a certain LOD level, the flickering phenomenon of moiré can be reduced by the auxiliary method of compensating the difference value. Compensation value means that when the color difference between adjacent pixels is too large, such as when the adjacent pixels are black and white, an interpolated color is added between black and white as an intermediate value, thereby further reducing the moiré flickering phenomenon. In addition to adding interpolated colors, the model structure of two adjacent pixels with large color differences can also be removed, or the model structure of pixels with similar colors can be adjusted.
在本申请实施例中,通过补颜色差值的方式,可以减少相邻像素间颜色的落差,从而进一步减少摩尔纹闪烁的现象。In the embodiment of the present application, the color difference between adjacent pixels can be reduced by means of compensating the color difference, thereby further reducing the phenomenon of moiré flickering.
本申请实施例提供了一种基于数字孪生渲染引擎的图像生成装置,参见图5,所述装置包括:An embodiment of the present application provides an image generation device based on a digital twin rendering engine, referring to FIG. 5 , the device includes:
距离获取模块501,用于获取三维场景中各待显示对象距离渲染相机的目标距离;A
区间确定模块502,用于针对每一个待显示对象,在预先设置的多个距离区间内确定该待显示对象的目标距离所属的距离区间,作为该待显示对象的目标距离区间;The
模型确定模块503,用于针对每一个待显示对象,确定该待显示对象的目标距离区间对应的细节等级的对象模型,作为该待显示对象的目标对象模型;其中,不同的距离区间对应不同的细节等级,针对任一距离区间,该距离区间表示的距离越长,该距离区间对应的细节等级越低;针对任一细节等级,该细节等级越低,该细节等级下对象模型的分辨率越低;The
图像生成模块504,用于基于各所述待显示对象各自的目标对象模型,生成待显示的图像。The
在一种可能的实施方式中,所述图像生成模块,具体用于:In a possible implementation manner, the image generation module is specifically used for:
获取各所述待显示对象在待显示的图像中的位姿;acquiring the pose of each object to be displayed in the image to be displayed;
针对每一个待显示对象,根据该待显示对象在待显示的图像中的位姿及该待显示对象的目标距离,对该待显示对象的目标对象模型进行渲染,生成该待显示对象在待显示的图像中的像素区域;For each object to be displayed, according to the pose of the object to be displayed in the image to be displayed and the target distance of the object to be displayed, the target object model of the object to be displayed is rendered to generate the object to be displayed in the to-be-displayed object model the pixel area in the image;
基于各所述待显示对象在待显示的图像中的像素区域,生成待显示的图像。The to-be-displayed image is generated based on the pixel area of each of the to-be-displayed objects in the to-be-displayed image.
在一种可能的实施方式中,所述装置还包括:In a possible implementation, the device further includes:
贴图获取模块,用于获取不同距离下采集的所述三维场景中各对象的图像纹理贴图、各所述对象的图像纹理贴图的采集距离、预设的各距离区间;a map acquisition module, configured to acquire image texture maps of each object in the three-dimensional scene collected at different distances, a collection distance of the image texture maps of each object, and preset distance intervals;
贴图划分模块,用于针对每一个图像纹理贴图,将该图像纹理贴图划分到该图像纹理贴图的采集距离所属的距离区间所对应的图像集合中;a map dividing module, for dividing the image texture map into the image set corresponding to the distance interval to which the acquisition distance of the image texture map belongs for each image texture map;
模型建立模块,用于针对每一个距离区间,根据该距离区间所对应的图像集合中各对象的图像纹理贴图,建立该距离区间对应的细节等级下各对象的对象模型。The model building module is used for, for each distance interval, to establish an object model of each object under the level of detail corresponding to the distance interval according to the image texture maps of each object in the image set corresponding to the distance interval.
在一种可能的实施方式中,所述模型建立模块,具体用于:In a possible implementation manner, the model establishment module is specifically used for:
针对每一个距离区间,从该距离区间的各对象的图像纹理贴图中选取多个批次的样本数据,利用各批次的样本数据分别确定每一对象在该距离区间对应的细节等级下的多个初级对象模型;For each distance interval, select multiple batches of sample data from the image texture maps of each object in the distance interval, and use the sample data of each batch to determine the amount of each object at the level of detail corresponding to the distance interval. a primary object model;
针对每一个对象,分别对该对象在相同距离区间对应的细节等级下的各初级对象模型进行模型混编,得到该对象在各距离区间对应的细节等级下的对象模型。For each object, model mixing is performed on each primary object model of the object at the level of detail corresponding to the same distance interval, and the object model of the object at the level of detail corresponding to each distance interval is obtained.
在一种可能的实施方式中,所述装置还包括颜色补偿模块,用于:In a possible implementation manner, the device further includes a color compensation module for:
针对存在摩尔纹的图像纹理贴图中的摩尔纹区域,计算所述摩尔纹区域中相邻像素之间的颜色差值;For the moiré area in the image texture map with moiré, calculating the color difference between adjacent pixels in the moiré area;
针对颜色差值大于预设差值阈值的相邻像素,根据该相邻像素中两个像素的颜色计算得到差值颜色,在该相邻像素之间插入差值颜色的像素。For adjacent pixels with a color difference greater than a preset difference threshold, a difference color is calculated according to the colors of two pixels in the adjacent pixels, and a pixel of the difference color is inserted between the adjacent pixels.
本申请实施例还提供了一种电子设备,包括:处理器及存储器;Embodiments of the present application also provide an electronic device, including: a processor and a memory;
上述存储器,用于存放计算机程序;The above-mentioned memory is used to store computer programs;
上述处理器用于执行上述存储器存放的计算机程序时,实现本申请中任一所述的基于数字孪生渲染引擎的图像生成方法。When the above-mentioned processor is configured to execute the computer program stored in the above-mentioned memory, any one of the image generation methods based on a digital twin rendering engine described in this application can be implemented.
可选的,参见图6,本申请实施例的电子设备还包括通信接口602和通信总线604,其中,处理器601,通信接口602,存储器603通过通信总线604完成相互间的通信。Optionally, referring to FIG. 6 , the electronic device in the embodiment of the present application further includes a
上述电子设备提到的通信总线可以是PCI(Peripheral ComponentInterconnect,外设部件互连标准)总线或EISA(Extended Industry StandardArchitecture,扩展工业标准结构)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus mentioned in the above electronic device may be a PCI (Peripheral Component Interconnect, Peripheral Component Interconnect Standard) bus or an EISA (Extended Industry Standard Architecture, Extended Industry Standard Architecture) bus or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
通信接口用于上述电子设备与其他设备之间的通信。The communication interface is used for communication between the above electronic device and other devices.
存储器可以包括RAM(RandomAccess Memory,随机存取存储器),也可以包括NVM(Non-Volatile Memory,非易失性存储器),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory may include RAM (Random Access Memory, random access memory), or may include NVM (Non-Volatile Memory, non-volatile memory), for example, at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
上述的处理器可以是通用处理器,包括CPU(Central Processing Unit,中央处理器)、NP(Network Processor,网络处理器)等;还可以是DSP(Digital Signal Processing,数字信号处理器)、ASIC(Application Specific Integrated Circuit,专用集成电路)、FPGA(Field-Programmable GateArray,现场可编程门阵列)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above-mentioned processor may be a general-purpose processor, including a CPU (Central Processing Unit, central processing unit), an NP (Network Processor, network processor), etc.; it may also be a DSP (Digital Signal Processing, digital signal processor), an ASIC ( Application Specific Integrated Circuit), FPGA (Field-Programmable GateArray, Field Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
本申请实施例还提供了一种计算机可读存储介质,上述计算机可读存储介质内存储有计算机程序,上述计算机程序被处理器执行时实现本申请中任一所述的基于数字孪生渲染引擎的图像生成方法。Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any one of the digital twin rendering engine-based rendering engine described in the present application is implemented. Image generation method.
在本申请提供的又一实施例中,还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行本申请中任一所述的基于数字孪生渲染引擎的图像生成方法。In yet another embodiment provided by the present application, a computer program product including instructions is also provided, which, when run on a computer, enables the computer to execute any one of the digital twin rendering engine-based image generation described in the present application method.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘SolidState Disk(SSD))等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server, or data center Transmission to another website site, computer, server, or data center by wire (eg, coaxial cable, optical fiber, digital subscriber line) or wireless (eg, infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that includes an integration of one or more available media. The usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), and the like.
需要说明的是,在本文中,各个可选方案中的技术特征只要不矛盾均可组合来形成方案,这些方案均在本申请公开的范围内。诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this article, the technical features in each optional solution can be combined to form solutions as long as they are not contradictory, and these solutions are all within the scope of the disclosure of the present application. Relational terms such as first and second, etc. are only used to distinguish one entity or operation from another and do not necessarily require or imply any such actual relationship between these entities or operations or order. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion such that a process, method, article or device comprising a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置、电子设备、计算机程序产品及存储介质的实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner, and the same and similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the apparatus, electronic equipment, computer program product and storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for related parts.
以上所述仅为本申请的较佳实施例,并非用于限定本申请的保护范围。凡在本申请的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本申请的保护范围内。The above descriptions are only preferred embodiments of the present application, and are not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application are included in the protection scope of this application.
Claims (12)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111654187.3A CN114387378B (en) | 2021-12-30 | 2021-12-30 | Image generation method, device and electronic device based on digital twin rendering engine |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111654187.3A CN114387378B (en) | 2021-12-30 | 2021-12-30 | Image generation method, device and electronic device based on digital twin rendering engine |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114387378A true CN114387378A (en) | 2022-04-22 |
CN114387378B CN114387378B (en) | 2025-06-10 |
Family
ID=81200688
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111654187.3A Active CN114387378B (en) | 2021-12-30 | 2021-12-30 | Image generation method, device and electronic device based on digital twin rendering engine |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114387378B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115408552A (en) * | 2022-07-28 | 2022-11-29 | 深圳市磐鼎科技有限公司 | Display adjustment method, device, equipment and storage medium |
CN117475053A (en) * | 2023-09-12 | 2024-01-30 | 广州益聚未来网络科技有限公司 | Grass rendering method and device |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1431919A1 (en) * | 2002-12-05 | 2004-06-23 | Samsung Electronics Co., Ltd. | Method and apparatus for encoding and decoding three-dimensional object data by using octrees |
CN106910236A (en) * | 2017-01-22 | 2017-06-30 | 北京微视酷科技有限责任公司 | Rendering indication method and device in a kind of three-dimensional virtual environment |
CN108615227A (en) * | 2018-05-08 | 2018-10-02 | 浙江大华技术股份有限公司 | A kind of suppressing method and equipment of image moire fringes |
CN110730336A (en) * | 2019-07-02 | 2020-01-24 | 珠海全志科技股份有限公司 | Demosaicing method and device |
CN113269858A (en) * | 2021-07-19 | 2021-08-17 | 腾讯科技(深圳)有限公司 | Virtual scene rendering method and device, computer equipment and storage medium |
WO2021178731A1 (en) * | 2020-03-04 | 2021-09-10 | Karl Denninghoff | Neurological movement detection to rapidly draw user attention to search results |
-
2021
- 2021-12-30 CN CN202111654187.3A patent/CN114387378B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1431919A1 (en) * | 2002-12-05 | 2004-06-23 | Samsung Electronics Co., Ltd. | Method and apparatus for encoding and decoding three-dimensional object data by using octrees |
CN106910236A (en) * | 2017-01-22 | 2017-06-30 | 北京微视酷科技有限责任公司 | Rendering indication method and device in a kind of three-dimensional virtual environment |
CN108615227A (en) * | 2018-05-08 | 2018-10-02 | 浙江大华技术股份有限公司 | A kind of suppressing method and equipment of image moire fringes |
CN110730336A (en) * | 2019-07-02 | 2020-01-24 | 珠海全志科技股份有限公司 | Demosaicing method and device |
WO2021178731A1 (en) * | 2020-03-04 | 2021-09-10 | Karl Denninghoff | Neurological movement detection to rapidly draw user attention to search results |
CN113269858A (en) * | 2021-07-19 | 2021-08-17 | 腾讯科技(深圳)有限公司 | Virtual scene rendering method and device, computer equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
李丹: ""基于虚拟现实技术的校园场景研究与实现"", 《中国优秀硕士学位论文全文数据库(电子期刊)信息科技辑》, 26 May 2020 (2020-05-26) * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115408552A (en) * | 2022-07-28 | 2022-11-29 | 深圳市磐鼎科技有限公司 | Display adjustment method, device, equipment and storage medium |
CN117475053A (en) * | 2023-09-12 | 2024-01-30 | 广州益聚未来网络科技有限公司 | Grass rendering method and device |
Also Published As
Publication number | Publication date |
---|---|
CN114387378B (en) | 2025-06-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10154246B2 (en) | Systems and methods for 3D capturing of objects and motion sequences using multiple range and RGB cameras | |
WO2018119889A1 (en) | Three-dimensional scene positioning method and device | |
CN108848367B (en) | Image processing method and device and mobile terminal | |
WO2015178217A1 (en) | Image processing apparatus and method | |
WO2022022260A1 (en) | Image style transfer method and apparatus therefor | |
US11288774B2 (en) | Image processing method and apparatus, storage medium, and electronic apparatus | |
CN108230434B (en) | Image texture processing method and device, storage medium and electronic device | |
CN114387378A (en) | Image generation method and device based on digital twin rendering engine and electronic equipment | |
CN111626919B (en) | Image synthesis method and device, electronic equipment and computer readable storage medium | |
CN113643414A (en) | Three-dimensional image generation method and device, electronic equipment and storage medium | |
CN117612470B (en) | Color lookup table generating method and color correcting method | |
CN116109765A (en) | Three-dimensional rendering method and device for labeling objects, computer equipment and storage medium | |
CN115170637A (en) | Virtual visual angle image construction method and device, control equipment and readable storage medium | |
CN112633065A (en) | Face detection method, system, storage medium and terminal based on data enhancement | |
CN114928718B (en) | Video monitoring method, device, electronic equipment and storage medium | |
CN113808246B (en) | Method and device for generating map, computer equipment and computer readable storage medium | |
CN114862998A (en) | DEM editing processing method and device | |
CN109829963A (en) | A kind of image drawing method and device calculate equipment and storage medium | |
WO2025050831A1 (en) | Building group rendering method and apparatus, computer device, and storage medium | |
CN117456076B (en) | Material map generation method and related equipment | |
CN113110733A (en) | Virtual field interaction method and system based on remote duplex | |
JP2003233836A (en) | Image processor for conducting rendering shading processing by using distance component in modeling and its method | |
CN112634439B (en) | 3D information display method and device | |
CN112652056B (en) | 3D information display method and device | |
CN115761099A (en) | Image rendering method, apparatus, computer device, storage medium, and program product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |