Volume rendering method for diamond pixel arrangement

文档序号:9438 发布日期:2021-09-17 浏览:39次 中文

1. A method for drawing a diamond-shaped pixel arrangement volume is characterized by comprising the following steps:

s1, projecting the three-dimensional data field by adopting a ray projection method to obtain a projection imaging plane;

s2, rotating the projection imaging plane for 45 degrees around the normal vector direction of the projection imaging plane to obtain a rhombic projection plane space;

and S3, converting the pixels arranged in the diamond shape in the projection plane space into the pixels arranged in the square shape to obtain the final drawing image.

2. The method for volume rendering with a diamond pixel arrangement according to claim 1, wherein the step S1 further includes:

starting from each pixel point f (x, y) in the image space, projecting a plurality of rays in the sight line direction, and selecting a sampling point on each ray;

and calculating to obtain a color value of each pixel point f (x, y) according to the sampling point data on the projected ray, and synthesizing the obtained color value of each pixel point f (x, y) to obtain a projection imaging plane.

3. The method for volume rendering with a diamond-shaped pixel arrangement according to claim 2, further comprising:

each ray passes through the three-dimensional data field according to a set step length;

selecting K equidistant sampling points along one of the rays;

performing cubic linear interpolation on color values and opacity values of 8 data points closest to the sampling point to obtain the color value and opacity of the sampling point;

solving the color values and the opacities of all sampling points on the emergent line;

and then the color value and the opacity value of each sampling point on the ray are synthesized from front to back or from back to front to obtain the color value of the pixel point f (x, y) emitting the ray.

4. The method for volume rendering with a diamond-shaped pixel arrangement according to claim 2, wherein the number of rays is equal to the number of image space pixels f (x, y).

5. The method for volume rendering with a diamond-shaped pixel arrangement according to claim 1,

the method for converting the diamond-shaped pixels into the square-shaped pixels in the projection plane space in step S3 further includes:

performing secondary sampling in the projection plane space along the horizontal direction and the vertical direction to obtain secondary sampling points;

and finally, drawing according to the pixel values of the secondary sampling points to obtain a final image.

6. The method for volume rendering with a diamond-shaped pixel arrangement according to claim 5,

the secondary sampling points include: the method comprises the following steps that (1) rhombic pixels and middle pixels of a rhombic area are arranged;

the pixel value of the diamond-shaped pixel point is an original pixel value;

and the pixel value of the middle pixel point is the average value of the pixel values of the four adjacent vertexes.

7. The method for volume rendering with a diamond-shaped pixel arrangement according to claim 6,

when the resolution of the diamond-shaped projection plane in step S3 is n × n, the resolution of the final drawn image is 2n × 2n by converting the pixels arranged in the diamond shape in the projection plane space into pixels arranged in a square shape.

Background

The volume rendering is one of core algorithms for realizing the visualization of a three-dimensional data field, can directly and effectively display the physical phenomenon in the data field, and has very strong expressive force. The three-dimensional volume rendering is used for projecting and displaying a three-dimensional data field distributed in a discrete mode onto a two-dimensional screen, however, sampling calculation and image synthesis in the volume rendering are very time-consuming, and the calculation cost of the sampling calculation and the image synthesis is in proportion to the total number of sampling points.

The algorithm for accelerating volume rendering mostly adopts a mode of jumping aiming at a volume data space at present, and in the process of light transmission, a data field is coded, so that a background and an area which is invisible aiming at a specific transmission function are skipped. The coding of the volume data field is based on hierarchical coding modes such as octree and k-d tree.

The space jump mode based on volume data coding can effectively improve the calculation efficiency of the volume rendering process and reduce the rendering time, but the coding information needs to be stored at the same time, extra system overhead is increased, coding depends on the transmission function information, when the transmission function is changed, coding needs to be adjusted from a new coding, and an effective rendering result is guaranteed.

Disclosure of Invention

Technical problem to be solved

Aiming at the existing technical problems, the invention provides a diamond-shaped pixel arrangement volume rendering method, which is a volume rendering acceleration rendering scheme for improving the display effect in a pixel arrangement mode, the effect can be greatly improved under the same resolution ratio, and the rendering efficiency is improved by reducing the rendering resolution ratio under the premise of ensuring the rendering precision in the volume rendering application.

(II) technical scheme

In order to achieve the purpose, the invention adopts the following main technical scheme:

a method for drawing a diamond-shaped pixel arrangement volume comprises the following steps:

s1, projecting the three-dimensional data field by adopting a ray projection method to obtain a projection imaging plane;

s2, rotating the projection imaging plane for 45 degrees around the normal vector direction of the projection imaging plane to obtain a rhombic projection plane space;

and S3, converting the pixels arranged in the diamond shape in the projection plane space into the pixels arranged in the square shape to obtain the final drawing image.

Preferably, the step S1 further includes:

starting from each pixel point f (x, y) in the image space, projecting a plurality of rays in the sight line direction, and selecting a sampling point on each ray;

and calculating to obtain a color value of each pixel point f (x, y) according to the sampling point data on the projected ray, and synthesizing the obtained color value of each pixel point f (x, y) to obtain a projection imaging plane.

Preferably, the method further comprises:

each ray passes through the three-dimensional data field according to a set step length;

selecting K equidistant sampling points along one of the rays;

performing cubic linear interpolation on color values and opacity values of 8 data points closest to the sampling point to obtain the color value and opacity of the sampling point;

solving the color values and the opacities of all sampling points on the emergent line;

and then the color value and the opacity value of each sampling point on the ray are synthesized from front to back or from back to front to obtain the color value of the pixel point f (x, y) emitting the ray.

Preferably, the number of rays is equal to the number of image space pixel points f (x, y).

Preferably, the method for converting the diamond-shaped pixels into the square-shaped pixels in the projection plane space in step S3 further includes:

performing secondary sampling in the projection plane space along the horizontal direction and the vertical direction to obtain secondary sampling points;

and finally, drawing according to the pixel values of the secondary sampling points to obtain a final image.

Preferably, the secondary sampling points include: the method comprises the following steps that (1) rhombic pixels and middle pixels of a rhombic area are arranged;

the pixel value of the diamond-shaped pixel point is an original pixel value;

and the pixel value of the middle pixel point is the average value of the pixel values of the four adjacent vertexes.

Preferably, when the resolution of the diamond-shaped projection plane in step S3 is n × n, the resolution of the final drawn image is 2n × 2n by converting the diamond-shaped pixels in the projection plane space into square-shaped pixels.

(III) advantageous effects

The diamond-shaped pixel arrangement volume rendering method provided by the invention has the following beneficial effects: under the same calculation amount, the display effect of volume rendering is improved.

Specifically, the effect can be greatly improved under the same resolution, and then in the volume rendering application, on the premise of ensuring the rendering precision, the rendering efficiency is improved by reducing the rendering resolution.

Drawings

FIG. 1 is a block flow diagram of a method for volume rendering with diamond pixel arrangement according to the present invention;

FIG. 2 is a schematic diagram of ray casting in a diamond pixel arrangement volume rendering method according to the present invention;

fig. 3 is a schematic projection plane diagram with a resolution of 7 × 7 in the diamond pixel arrangement volume rendering method according to the present invention;

fig. 4 is a schematic diagram of a subsampling of a projection plane with a resolution of 7 × 7 according to a volume rendering method for a diamond pixel arrangement of the present invention;

fig. 5 is a schematic diagram showing a comparison between a square arrangement a and a diamond arrangement b at the same resolution in an embodiment of the volume rendering method for a diamond pixel arrangement according to the present invention.

Detailed Description

For the purpose of better explaining the present invention and to facilitate understanding, the present invention will be described in detail by way of specific embodiments with reference to the accompanying drawings.

As shown in fig. 1 and 5: the embodiment provides a method for drawing a diamond-shaped pixel arrangement volume, which specifically comprises the following steps:

s1, projecting the three-dimensional data field by adopting a ray projection method to obtain a projection imaging plane;

s2, rotating the projection imaging plane for 45 degrees around the normal vector direction of the projection imaging plane to obtain a rhombic projection plane space;

and S3, converting the pixels arranged in the diamond shape in the projection plane space into the pixels arranged in the square shape to obtain the final drawing image.

As shown in fig. 2: step S1 in this embodiment further includes:

starting from each pixel point f (x, y) in the image space, projecting a plurality of rays in the sight line direction, and selecting a sampling point on each ray;

and calculating to obtain a color value of each pixel point f (x, y) according to the sampling point data on the projected ray, and synthesizing the obtained color value of each pixel point f (x, y) to obtain a projection imaging plane.

The method in this embodiment further includes:

each ray passes through the three-dimensional data field according to a set step length;

selecting K equidistant sampling points along one of the rays;

performing cubic linear interpolation on color values and opacity values of 8 data points closest to the sampling point to obtain the color value and opacity of the sampling point;

solving the color values and the opacities of all sampling points on the emergent line;

and then the color value and the opacity value of each sampling point on the ray are synthesized from front to back or from back to front to obtain the color value of the pixel point f (x, y) emitting the ray.

It should be noted that the number of rays in this embodiment is equal to the number of image space pixels f (x, y).

The method for converting the diamond-shaped pixels into the square-shaped pixels in the projection plane space in step S3 described in this embodiment further includes:

performing secondary sampling in the projection plane space along the horizontal direction and the vertical direction to obtain secondary sampling points;

and finally, drawing according to the pixel values of the secondary sampling points to obtain a final image.

In this embodiment, the secondary sampling points include: the method comprises the following steps that (1) rhombic pixels and middle pixels of a rhombic area are arranged;

the pixel value of the diamond-shaped pixel point is an original pixel value;

and the pixel value of the middle pixel point is the average value of the pixel values of the four adjacent vertexes.

Preferably, when the resolution of the diamond-shaped projection plane in step S3 is n × n, the resolution of the final drawn image is 2n × 2n by converting the diamond-shaped pixels in the projection plane space into square-shaped pixels.

As shown in fig. 3, taking a 7 × 7 projection plane as an example, the projection result obtained by volume rendering is in a diamond pixel arrangement manner, and since square pixels are required for display, the diamond pixels need to be converted into square pixels before rendering.

As shown in fig. 4, sampling is performed in the horizontal direction and the vertical direction, and there are two types of sampling points, the first type is a diamond-shaped pixel point and takes a value directly, the second type is a middle pixel point of a diamond-shaped area, and a pixel value of the point is an average value of pixel values of four adjacent vertexes of the point. And finally, obtaining a drawing result with the resolution of the effective area of 14 × 14.

In summary, as shown in fig. 5, the comparison result of two images obtained under the same resolution in this embodiment has richer detail information than the result of the square sampling.

Finally, it should be noted that the above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art; the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not cause the essence of the corresponding technical solutions to depart from the scope of the technical solutions of the embodiments of the present invention.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:一种虚拟角色捏脸的方法、装置、电子设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!