Movatterモバイル変換


[0]ホーム

URL:


CN109325992B - Image drawing method and device, computing device and storage medium - Google Patents

Image drawing method and device, computing device and storage medium
Download PDF

Info

Publication number
CN109325992B
CN109325992BCN201811223702.0ACN201811223702ACN109325992BCN 109325992 BCN109325992 BCN 109325992BCN 201811223702 ACN201811223702 ACN 201811223702ACN 109325992 BCN109325992 BCN 109325992B
Authority
CN
China
Prior art keywords
depth
value
drawn
pixel
projection
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.)
Active
Application number
CN201811223702.0A
Other languages
Chinese (zh)
Other versions
CN109325992A (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.)
Chengdu Xishanju Shiyou Technology Co ltd
Zhuhai Kingsoft Digital Network Technology Co Ltd
Original Assignee
Chengdu Xishanju Shiyou Technology Co ltd
Zhuhai Kingsoft Digital Network Technology Co Ltd
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 Chengdu Xishanju Shiyou Technology Co ltd, Zhuhai Kingsoft Digital Network Technology Co LtdfiledCriticalChengdu Xishanju Shiyou Technology Co ltd
Priority to CN201811223702.0ApriorityCriticalpatent/CN109325992B/en
Publication of CN109325992ApublicationCriticalpatent/CN109325992A/en
Application grantedgrantedCritical
Publication of CN109325992BpublicationCriticalpatent/CN109325992B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The specification provides an image drawing method and device, a computing device and a storage medium, wherein the method comprises the following steps: acquiring the real depth of a pixel point in an image to be drawn; comparing the real depth with a preset threshold value; performing first projection on the pixel points with the real depth smaller than a preset threshold value to obtain corresponding first Z value depth, wherein the first Z value depth is used as the Z value depth of the pixel points; performing second projection on the pixel points with the real depths larger than a preset threshold value to obtain corresponding second Z value depths, wherein the second Z value depths are used as Z value depths of the pixel points, and the nonlinearity of the pixel points with the real depths larger than the preset threshold value in the second projection is smaller than that in the first projection; and drawing the pixel point according to the Z value depth of the pixel point.

Description

Image drawing method and device, computing device and storage medium
Technical Field
The present disclosure relates to the field of image drawing technologies, and in particular, to an image drawing method and apparatus, a computing device, and a storage medium.
Background
In 3D rendering, a pixel point in an image to be drawn is projected along the Z-axis direction to obtain a Z-value depth corresponding to the real depth of the pixel point, and the Z-value depth of the measured pixel point and the Z-value depth of the current pixel point at the same position are compared to determine whether to draw the measured pixel point or not: and if the Z value depth of the measured pixel point is larger than that of the current pixel point, drawing is not performed, otherwise, drawing is performed. And drawing corresponding images after all the pixel points are drawn.
The relationship between the true depth of the pixel point and the Z value is linear in orthographic projection, but not in perspective projection. Referring to fig. 1, the horizontal axis represents the true depth of a pixel point, the vertical axis represents the Z-value depth of the pixel point obtained by the perspective coordinate transformation, and the relationship is nonlinear in the perspective projection. In the prior art, perspective projection is adopted to project an image pixel point along the Z-axis direction, so as to obtain a corresponding Z-value depth.
As can be seen from fig. 1, the degree of nonlinearity of the true depth of the pixel point is related to the magnitude of the Z value, and thus, the Z-pinning phenomenon may occur where the depth is large. When the depth of the two pixel points is larger and the depth of the two pixel points is closer, the Z values of the two pixel points are very close, and once the Z values of the two pixel points reach the lower precision limit of the Z cache, the Z values of the two pixel points are completely consistent in the Z cache. The result of the depth test is unpredictable, and the system cannot judge which of the two pixels is in front of and behind the bottom, so that the phenomenon of staggered flicker is displayed on the front and rear pictures.
Disclosure of Invention
In view of this, the embodiments of the present disclosure provide an image drawing method and apparatus, a computing device, and a storage medium, so as to solve the technical drawbacks in the prior art.
According to a first aspect of embodiments of the present specification, there is provided an image drawing method including:
acquiring the real depth of pixel points in an image to be drawn, wherein the position information of each pixel point is represented by a three-dimensional coordinate, and the depth value of each pixel point is represented by a Z-axis value in the three-dimensional coordinate; comparing the real depth with a preset threshold value;
performing first projection on the pixel point with the real depth smaller than a preset threshold along the Z-axis direction to obtain a first Z-value depth, wherein the first Z-value depth is used as the Z-value depth of the pixel point;
performing second projection on the pixel points with the real depths larger than the preset threshold along the Z axis direction to obtain second Z value depths, wherein the second Z value depths are used as the Z value depths of the pixel points, and the nonlinearity of the pixel points with the real depths larger than the preset threshold in the second projection is smaller than that in the first projection;
and drawing the pixel point according to the Z value depth of the pixel point.
Optionally, performing a first projection on the pixel point with the real depth smaller than the preset threshold along the Z-axis direction includes:
and performing first projection on the pixel points with the real depth smaller than the preset threshold along the Z-axis direction by adopting a perspective projection method along the Z-axis direction.
Optionally, performing a second projection on the pixel point with the real depth greater than the preset threshold along the Z-axis direction, including:
and performing second projection on the pixel points with the real depths larger than the preset threshold value along the Z-axis direction by adopting a linear projection method along the Z-axis direction.
Optionally, performing the second projection on the pixel point with the true depth greater than the preset threshold along the Z-axis direction further includes:
and carrying out second projection on the pixel points with the real depths larger than the preset threshold value along the Z-axis direction by adopting a reverse mapping method along the Z-axis direction.
Optionally, the reverse mapping method includes:
and according to the second Z value depth, reversing the second Z value to realize reverse mapping.
Optionally, the drawing the pixel point according to the Z value depth of the pixel point includes:
judging whether the pixel points of the drawn image exist at the positions of the pixel points to be drawn;
if not, directly drawing the pixel points to be drawn;
if the Z value depth of the pixel point to be drawn is larger than the Z value depth of the pixel point of the drawn image, drawing is not performed; and if the Z-value depth of the pixel point to be drawn is smaller than that of the pixel point of the drawn image, drawing.
According to a second aspect of the embodiments of the present specification, there is provided an image drawing apparatus comprising:
the pixel point acquisition module is configured to acquire the real depth of a pixel point in an image to be drawn, the position information of each pixel point is represented by a three-dimensional coordinate, and the depth value of each pixel point is represented by a Z-axis value in the three-dimensional coordinate;
a depth comparison module configured to compare the true depth with a preset threshold;
the first projection module is configured to perform first projection on the pixel points with the real depth smaller than a preset threshold along the Z-axis direction to obtain first Z-value depth, wherein the first Z-value depth is used as the Z-value depth of the pixel points;
the second projection module is configured to perform second projection on the pixel points with the real depths larger than a preset threshold along the Z-axis direction to obtain second Z-value depth, wherein the second Z-value depth is used as the Z-value depth of the pixel points, and the nonlinearity of the pixel points with the real depths larger than the preset threshold in the second projection is smaller than that in the first projection;
and the image drawing module is configured to draw the pixel points according to the Z-value depth of the pixel points.
Optionally, the first projection module performs a first projection on the pixel point with the real depth smaller than the preset threshold along the Z-axis direction by adopting a perspective projection method along the Z-axis direction.
Optionally, the second projection module performs a second projection on the pixel point with the real depth greater than the preset threshold along the Z-axis direction by adopting a linear projection method along the Z-axis direction.
Optionally, the second projection module performs a second projection on the pixel point with the real depth greater than the preset threshold along the Z-axis direction by adopting a reverse mapping method along the Z-axis direction.
Optionally, the reverse mapping method includes:
and according to the second Z value depth, reversing the second Z value to realize reverse mapping.
Optionally, the image drawing module includes:
the judging submodule is configured to judge whether the pixel points of the drawn image exist at the positions of the pixel points to be drawn or not;
the drawing submodule: is configured to directly draw a pixel to be drawn under the condition that no pixel of an image is drawn on the position of the pixel to be drawn; under the condition that the pixel point of the drawn image exists at the position of the pixel point to be drawn, comparing the Z-value depth of the pixel point to be drawn with the Z-value depth of the pixel point of the drawn image, and if the Z-value depth of the pixel point to be drawn is larger than the Z-value depth of the pixel point of the drawn image, not drawing; and if the Z-value depth of the pixel point to be drawn is smaller than that of the pixel point of the drawn image, drawing.
According to a third aspect of embodiments of the present specification, there is provided a computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the image rendering method when executing the instructions.
According to a fourth aspect of embodiments of the present description, there is provided a computer-readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the image rendering method.
In the embodiment of the present disclosure, perspective projection is performed on an image pixel point with a real depth smaller than a preset threshold along a Z-axis direction to obtain a first Z-value depth, and then second projection is performed on an image pixel point with a real depth larger than the preset threshold along the Z-axis direction to obtain a second Z-value depth, where the second projection includes two methods of linear projection or reverse mapping. Compared with the first projection, the second Z value depth obtained by the second projection of the pixel point image with the real depth larger than the preset threshold value is lower in nonlinearity and higher in Z value precision, so that the problem that the system cannot judge the spatial position relation among a plurality of pixel points and displays a front-back staggered flickering picture due to the fact that the second Z value depth obtained by the second projection of a plurality of image pixel points with the real depth larger than the preset threshold value in the conventional perspective projection technology is solved, and the precision of image drawing is improved.
Drawings
FIG. 1 is a schematic diagram illustrating a nonlinear relationship in perspective projection provided in accordance with the background of the present specification;
FIG. 2 is a block diagram illustrating a configuration of acomputing device 200 according to an embodiment of the present description;
fig. 3 is a flowchart showing an image drawing method according to an embodiment of the present specification;
fig. 4 is a schematic diagram showing image rendering by a linear projection method of the second projection according to an embodiment of the present specification;
FIG. 5 is a schematic diagram illustrating image rendering of a second projection using a reverse mapping method according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram showing drawing of pixel points to be drawn according to an embodiment of the present specification;
fig. 7 is a schematic diagram showing the structure of an image drawing apparatus according to an embodiment of the present specification.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present description. This description may be embodied in many other forms than described herein and similarly generalized by those skilled in the art to whom this disclosure pertains without departing from the spirit of the disclosure and, therefore, this disclosure is not limited by the specific implementations disclosed below.
Fig. 2 is a block diagram illustrating a configuration of acomputing device 200 according to an embodiment of the present description. The components of thecomputing device 100 include, but are not limited to, a memory 210 and a processor 220. The processor 220 is connected to the memory 210 via a bus 230, and the database 250 is used for storing the actual depth data of the pixels in the image to be drawn.
Computing device 200 also includes an access device 240, access device 240 enablingcomputing device 200 to communicate via one or more networks 260. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. The access device 140 may include one or more of any type of network interface, wired or wireless (e.g., a Network Interface Card (NIC)), such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present description, the other components ofcomputing device 200 described above and not shown in FIG. 2 may also be connected to each other, such as via a bus. It should be understood that the block diagram of the computing device shown in FIG. 2 is for exemplary purposes only and is not intended to limit the scope of the present description. Those skilled in the art may add or replace other components as desired.
Computing device 200 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smart phone), wearable computing device (e.g., smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC.Computing device 200 may also be a mobile or stationary server.
Wherein the processor 220 may perform the steps of the method shown in fig. 3. Fig. 3 is a flow schematic diagram showing an image drawing method according to an embodiment of the present specification, includingsteps 302 to 310.
Step 302: and acquiring the real depth of the pixel points in the image to be drawn, wherein the position information of each pixel point is represented by a three-dimensional coordinate, and the depth value of each pixel point is represented by a Z-axis value in the three-dimensional coordinate.
In an embodiment of the present disclosure, the position information of each pixel point is represented by a three-dimensional coordinate, and the depth value of each pixel point is represented by a Z-axis value in the three-dimensional coordinate. Each pixel in the image to be drawn has a real depth, which indicates the distance between the pixel and the screen in the Z-axis direction in the three-dimensional coordinate system, for example, the depth of a pixel is 400, which indicates the distance between the pixel and the screen in the Z-axis direction in the three-dimensional coordinate system is 400.
Step 304: and comparing the real depth with a preset threshold value.
In an embodiment of the present disclosure, a preset threshold is preset for comparing with an obtained true depth of a pixel, for example, the preset threshold is set to be 500, and the pixel is divided into a pixel with a true depth less than 500 and a pixel with a true depth greater than 500 according to the magnitude of the true depth, and different projection methods are used for the two pixels respectively.
Step 306: and carrying out first projection on the pixel points with the real depth smaller than the preset threshold along the Z-axis direction to obtain a first Z-value depth, wherein the first Z-value depth is used as the Z-value depth of the pixel points.
In an embodiment of the present disclosure, performing a first projection on the pixel point with the true depth smaller than the preset threshold along the Z-axis direction includes:
and performing first projection on the pixel points with the real depth smaller than the preset threshold along the Z-axis direction by adopting a perspective projection method along the Z-axis direction.
The nonlinearity of the first Z value depth and the real depth, which are obtained by the perspective projection method of the pixel point with the real depth smaller than the preset threshold value, is low, and the nonlinearity is larger than the lower limit of the Z value precision in the process of caching, so that the pixel point can be directly used for image drawing, for example, thereal depth 400 of the pixel point in the image to be drawn is smaller than thepreset threshold value 500, and the first Z value depth obtained by the perspective projection method is 0.88 and larger than the lower limit of the Z value precision and can be used as the Z value depth of the pixel point.
Step 308: and carrying out second projection on the pixel points with the real depths larger than the preset threshold along the Z axis direction to obtain second Z value depth, wherein the second Z value depth is used as the Z value depth of the pixel points, and the nonlinearity of the pixel points with the real depths larger than the preset threshold in the second projection is smaller than that in the first projection.
In an embodiment of the present disclosure, performing a second projection on the pixel point with the true depth greater than the preset threshold along the Z-axis direction includes:
and performing second projection on the pixel points with the real depths larger than the preset threshold value along the Z-axis direction by adopting a linear projection method along the Z-axis direction.
And the second Z value depth obtained by adopting the linear projection is 0.8 and is larger than the Z value precision lower limit, and can be used as the Z value depth of the pixel point.
In an embodiment of the present disclosure, performing a second projection on the pixel point with the true depth greater than the preset threshold along the Z-axis direction further includes:
and carrying out second projection on the pixel points with the real depths larger than the preset threshold value along the Z-axis direction by adopting a reverse mapping method along the Z-axis direction.
And the second Z value depth obtained by reverse mapping of the pixel point with the real depth larger than thepreset threshold 500 has low nonlinearity with the real depth, and is larger than the lower limit of Z value precision in caching, so that the second Z value depth can be used as the Z value depth of the pixel point.
In an embodiment of the present disclosure, the threshold is determined by drawing precision, where the smaller the threshold is, the lower the precision requirement is, and the larger the threshold is.
In an embodiment of the present disclosure, the reverse mapping method includes:
and according to the second Z value depth, performing inverse operation on the second Z value to realize inverse mapping and performing second projection along the Z axis direction.
For example, the projection range is 1000, the threshold value is determined to be 500 according to the drawing precision, the pixel point with the real depth larger than 500 obtains the depth of the second Z value by using reverse mapping, the Z value obtained by mapping the pixel point with the largest obtained depth value is 0 by the reverse mapping, the Z value obtained by mapping the pixel point with the smallest depth value is 1, and the Z value obtained by mapping the pixel point with the larger depth value is smaller.
Step 310: and drawing the pixel point according to the Z value depth of the pixel point.
In an embodiment of the present disclosure, the drawing the pixel according to the Z-value depth of the pixel includes:
judging whether the pixel points of the drawn image exist at the positions of the pixel points to be drawn;
if not, directly drawing the pixel points to be drawn;
if the Z value depth of the pixel point to be drawn is larger than the Z value depth of the pixel point of the drawn image, drawing is not performed; and if the Z-value depth of the pixel point to be drawn is smaller than that of the pixel point of the drawn image, drawing.
For example, for the position of the pixel point to be drawn on the screen, judging that the pixel point with the Z value depth of 0.7 is drawn, if the Z value depth of the pixel point to be drawn is 0.6 and less than 0.7, drawing the pixel point to be drawn by the system; if the Z value depth of the pixel to be drawn is 0.8 and is larger than 0.7, the system does not draw the pixel to be drawn.
By the image drawing method, the problem that in the prior art, the Z value depth obtained by perspective projection of the pixel points with the real depth larger than the preset threshold value is cached to the same Z value depth because the Z value depth reaches the lower limit of Z value precision in caching is effectively solved, so that the system cannot judge the spatial position relation between the pixel points, and the display positions are staggered and flash images in front and back is solved, and the image drawing precision is improved.
Fig. 4 is a schematic view showing a second projection according to an embodiment of the present specification using a linear projection method.
In an embodiment of the present disclosure, the actual depth of a pixel in an image to be drawn is obtained, where the actual depth of each pixel is any value between 0 and 1000, for example, the actual depth of a certain pixel is 400.
In an embodiment of the present disclosure, the preset threshold is set to be 500, and the real depth of each pixel to be drawn is compared with thepreset threshold 500, so that the pixel to be drawn is divided into a pixel with the real depth smaller than thepreset threshold 500 and a pixel with the real depth larger than thepreset threshold 500.
In an embodiment of the present disclosure, for pixels to be drawn having different true depths, a projection method is adopted:
Figure BDA0001835417540000101
the abscissa in the projection method function diagram represents the real depth of the pixel point to be drawn, and the ordinate represents the Z-value depth obtained by projecting the pixel point to be drawn.
In an embodiment of the present disclosure, a first projection is performed on a pixel point with the real depth smaller than a preset threshold along a Z-axis direction, for example, the real depth of a pixel point C in an image to be drawn is 300 and smaller than apreset threshold 500, and then a perspective projection method is adopted to project the pixel point C along the Z-axis direction, where the obtained first Z-value depth is 0.8 and larger than a lower precision limit of the Z-value, and may be used as the Z-value depth of the pixel point;
in an embodiment of the present disclosure, the second projection is performed on the pixel point with the true depth greater than the preset threshold along the Z-axis direction, for example, the true depths of the other pixel points A, B in the image to be drawn are 600 and 650 respectively and greater than thepreset threshold 500, and then the obtained second Z-value depths are 0.6 and 0.65 respectively by adopting a linear projection method, which are different from the second Z-value depth obtained by perspective projection, and the second Z-value depths obtained by linear projection are both greater than the lower limit of the Z-value precision and can be used as the Z-value depths of the two pixel points.
In an embodiment of the present disclosure, the pixel point is drawn according to the Z value depth of the pixel point, and whether there is a pixel point of the drawn image at the position of the pixel point to be drawn is first determined, if not, the pixel point to be drawn is directly drawn;
if so, comparing the Z value depth of the pixel to be drawn with the Z value depth of the pixel of the drawn image, if the Z value depth of the pixel to be drawn is larger than the Z value depth of the pixel of the drawn image, not drawing, for example, if the position of the pixel to be drawn on a screen is judged that the pixel with the Z value depth of 0.7 is already drawn, and if the Z value depth of the pixel to be drawn is 0.6 and smaller than 0.7, drawing the pixel to be drawn by the system; if the Z value depth of the pixel to be drawn is 0.8 and is larger than 0.7, the system does not draw the pixel to be drawn.
By the image drawing method, the problem that in the prior art, the Z value depth obtained by perspective projection of the pixel points with the real depth larger than the preset threshold value is cached to the same Z value depth because the Z value depth reaches the lower limit of Z value precision in caching is effectively solved, so that the system cannot judge the spatial position relation between the pixel points, and the display positions are staggered and flash images in front and back is solved, and the image drawing precision is improved.
Fig. 5 is a schematic view showing a second projection using a reverse mapping method according to an embodiment of the present specification.
In an embodiment of the present disclosure, the actual depth of a pixel in an image to be drawn is obtained, where the actual depth of each pixel is any value between 0 and 1000, for example, the actual depth of a certain pixel is 400.
In an embodiment of the present disclosure, the preset threshold is set to be 500, and the pixel to be drawn is divided into a pixel with a real depth smaller than thepreset threshold 500 and a pixel with a real depth larger than thepreset threshold 500 by comparing the real depth of each pixel to be drawn with thepreset threshold 500.
In an embodiment of the present disclosure, for pixels to be drawn having different true depths, a projection method is adopted:
Figure BDA0001835417540000121
the abscissa in the projection method function diagram represents the real depth of the pixel point to be drawn, and the ordinate represents the Z-value depth obtained by projecting the pixel point to be drawn.
In an embodiment of the present disclosure, a first projection is performed on a pixel point with the real depth smaller than a preset threshold along a Z-axis direction, for example, the real depth of a pixel point C in an image to be drawn is 300 and smaller than apreset threshold 500, and then a perspective projection method is adopted to project the pixel point C along the Z-axis direction, where the obtained first Z-value depth is 0.8 and larger than a lower precision limit of the Z-value, and may be used as the Z-value depth of the pixel point;
in an embodiment of the present disclosure, the second projection is performed on the pixel points with the true depth greater than the preset threshold along the Z-axis direction, for example, the true depths of the other pixel points A, B in the image to be drawn are all greater than thepreset threshold 500, and then the inverse mapping method is adopted, where the obtained second Z-value depths are respectively 0.46 and 0.45, and different from the second Z-value depth obtained through perspective projection, the second Z-value depths obtained through inverse mapping are both greater than the lower precision limit of the Z-value, and may be used as the Z-value depths of the two pixel points.
In an embodiment of the present disclosure, the pixel point is drawn according to the Z value depth of the pixel point, and whether there is a pixel point of the drawn image at the position of the pixel point to be drawn is first determined, if not, the pixel point to be drawn is directly drawn;
if so, comparing the Z value depth of the pixel to be drawn with the Z value depth of the pixel of the drawn image, if the Z value depth of the pixel to be drawn is larger than the Z value depth of the pixel of the drawn image, not drawing, for example, if the position of the pixel to be drawn on a screen is judged that the pixel with the Z value depth of 0.7 is already drawn, and if the Z value depth of the pixel to be drawn is 0.6 and smaller than 0.7, drawing the pixel to be drawn by the system; if the Z value depth of the pixel to be drawn is 0.8 and is larger than 0.7, the system does not draw the pixel to be drawn.
By the image drawing method, the problem that in the prior art, the Z value depth obtained by perspective projection of the pixel points with the real depth larger than the preset threshold value is cached to the same Z value depth because the Z value depth reaches the lower limit of Z value precision in caching is effectively solved, so that the system cannot judge the spatial position relation between the pixel points, and the display positions are staggered and flash images in front and back is solved, and the image drawing precision is improved.
Fig. 6 is a schematic diagram showing drawing of a pixel to be drawn according to an embodiment of the present specification.
In an embodiment of the present disclosure, the position information of each pixel point is represented by a three-dimensional coordinate x-y-Z, and the depth value of each pixel point is represented by a value of a Z-axis in the three-dimensional coordinate. The screen plane is an x-o-y plane, and the drawn image B in the three-dimensional coordinates has a pixel point B1 with a Z value depth of 0.5 and a pixel point B2 with a Z value depth of 0.7. The image a is an image to be drawn in three-dimensional coordinates, and the gray area represents an area where the image a to be drawn and the drawn image B overlap in the Z-axis direction.
In an embodiment of the present disclosure, the actual depth of the pixel in the image a to be drawn is obtained, the pixel includes the pixel in the gray area and the pixel outside the gray area in the image a to be drawn, for example, the actual depth of the pixel A1 outside the gray area in the image a to be drawn is 300, the actual depth of the pixel A2 in the gray area in the image a to be drawn is 600, and the actual depth of the pixel A3 in the gray area in the image a to be drawn is 650.
In an embodiment of the present disclosure, a preset threshold is set to be 500, the actual depth of the pixel in the image to be drawn is compared with thepreset threshold 500, and the pixel to be drawn is divided into a pixel with the actual depth smaller than the preset threshold and a pixel with the actual depth larger than the preset threshold.
In an embodiment of the present disclosure, a first projection is performed on a pixel point with a real depth smaller than a preset threshold along a Z-axis direction, for example, a perspective projection method is adopted on a pixel point A1 to be drawn with a real depth smaller than apreset threshold 500 along the Z-axis direction, and the obtained first Z-value depth is 0.8 and larger than a lower precision limit of the Z-value, which can be used as the Z-value depth of the pixel point A1 to be drawn.
In an embodiment of the present disclosure, a second projection is performed on a pixel point with a real depth greater than a preset threshold along a Z-axis direction, for example, a linear projection method is adopted on pixel points A2 and A3 to be drawn with a real depth greater than apreset threshold 500 along the Z-axis direction, so as to obtain corresponding second Z-value depths of 0.6 and 0.65, which are used as Z-value depths of the pixel points A2 and A3 to be drawn.
In an embodiment of the present disclosure, according to a Z-value depth drawing pixel of the pixel, whether a pixel of the drawn image exists at a position where the pixel to be drawn is first determined, and if not, the pixel to be drawn is directly drawn;
if yes, comparing the Z value depth of the pixel point to be drawn with the Z value depth of the pixel point of the drawn image, and if the Z value depth of the pixel point to be drawn is larger than the Z value depth of the pixel point of the drawn image, not drawing.
For example, if the pixel point A1 to be drawn is not located at the position where the pixel point A1 to be drawn is located, the pixel point A1 to be drawn is directly drawn;
the pixel point A2 to be drawn is provided with a pixel point B2 of the drawn image B, the pixel point A2 to be drawn and the pixel point B2Z value depth to be drawn are compared, the Z value depth of the pixel point A2 to be drawn is 0.6 and is smaller than the Z value depth of the pixel point B2 to be drawn by 0.7, and the pixel point A2 to be drawn is drawn to cover the pixel point B2 to be drawn;
and the pixel point A3 to be drawn is provided with a pixel point B1 of the drawn image B, the Z value depth of the pixel point A3 to be drawn is compared with the Z value depth of the pixel point B1 to be drawn, the Z value depth of the pixel point A3 to be drawn is 0.65 and is larger than the Z value depth of the pixel point B1 to be drawn by 0.5, and the pixel point A3 to be drawn is not drawn.
In an embodiment of the present disclosure, a second projection is performed on a pixel point with a real depth greater than a preset threshold along a Z-axis direction, for example, a reverse mapping method is adopted on pixel points A2 and A3 to be drawn with a real depth greater than apreset threshold 500 along the Z-axis direction, so as to obtain corresponding second Z-value depths of 0.4 and 0.6, which are used as Z-value depths of the pixel points A2 and A3 to be drawn.
In an embodiment of the present disclosure, according to a Z-value depth drawing pixel of the pixel, whether a pixel of the drawn image exists at a position where the pixel to be drawn is first determined, and if not, the pixel to be drawn is directly drawn;
if yes, comparing the Z value depth of the pixel point to be drawn with the Z value depth of the pixel point of the drawn image, and if the Z value depth of the pixel point to be drawn is larger than the Z value depth of the pixel point of the drawn image, not drawing.
For example, if the pixel point A1 to be drawn is not located at the position where the pixel point A1 to be drawn is located, the pixel point A1 to be drawn is directly drawn;
the pixel point A2 to be drawn is provided with a pixel point B2 of the drawn image B, the pixel point A2 to be drawn and the pixel point B2Z value depth to be drawn are compared, the Z value depth of the pixel point A2 to be drawn is 0.4 and is smaller than the Z value depth of the pixel point B2 to be drawn by 0.7, and the pixel point A2 to be drawn is drawn to cover the pixel point B2 to be drawn;
and the pixel point A3 to be drawn is provided with a pixel point B1 of the drawn image B, the Z value depth of the pixel point A3 to be drawn is compared with the Z value depth of the pixel point B1 to be drawn, the Z value depth of the pixel point A3 to be drawn is 0.6 and is larger than the Z value depth of the pixel point B1 to be drawn by 0.5, and the pixel point A3 to be drawn is not drawn.
By the image drawing method, the problem that in the prior art, the Z value depth obtained by perspective projection of the pixel points with the real depth larger than the preset threshold value is cached to the same Z value depth because the Z value depth reaches the lower limit of Z value precision in caching is effectively solved, so that the system cannot judge the spatial position relation between the pixel points, and the display positions are staggered and flash images in front and back is solved, and the image drawing precision is improved.
The present specification also provides an image rendering apparatus embodiment, in accordance with the above-described method embodiment. Fig. 7 is a block diagram showing an image drawing apparatus according to an embodiment of the present specification. As shown in fig. 7, the apparatus 700 includes:
the pixelpoint obtaining module 710 is configured to obtain the real depth of the pixel point in the image to be drawn;
adepth comparison module 720 configured to compare the true depth to a preset threshold;
thefirst projection module 730 is configured to perform a first projection on the pixel point with the real depth smaller than the preset threshold value to obtain a first Z value depth, where the first Z value depth is used as the Z value depth of the pixel point;
thesecond projection module 740 is configured to perform second projection on the pixel point with the real depth being greater than the preset threshold value to obtain a second Z value depth, where the second Z value depth is used as the Z value depth of the pixel point, and the nonlinearity of the pixel point with the real depth being greater than the preset threshold value in the second projection is smaller than that in the first projection;
theimage drawing module 750 is configured to draw the pixel point according to the Z-value depth of the pixel point.
In an optional embodiment, the first projection module performs a first projection on the pixel point with the real depth smaller than the preset threshold along the Z-axis direction by adopting a perspective projection method along the Z-axis direction.
In an optional embodiment, the second projection module performs a second projection on the pixel point with the real depth greater than the preset threshold along the Z-axis direction by using a linear projection method along the Z-axis direction.
In an optional embodiment, the second projection module performs a second projection on the pixel point with the real depth greater than the preset threshold along the Z-axis direction by adopting a reverse mapping method along the Z-axis direction.
In an alternative embodiment, the reverse mapping method includes:
and according to the second Z value depth, reversing the second Z value to realize reverse mapping.
In an alternative embodiment, the image rendering module includes:
judging whether the pixel points of the drawn image exist on the screen position where the pixel points to be drawn are located;
and a judging sub-module: the method comprises the steps of judging whether a pixel point of a drawn image exists at a position of the pixel point to be drawn;
the drawing submodule: is configured to directly draw a pixel to be drawn under the condition that no pixel of an image is drawn on the position of the pixel to be drawn; under the condition that the pixel point of the drawn image exists at the position of the pixel point to be drawn, comparing the Z-value depth of the pixel point to be drawn with the Z-value depth of the pixel point of the drawn image, and if the Z-value depth of the pixel point to be drawn is larger than the Z-value depth of the pixel point of the drawn image, not drawing; and if the Z-value depth of the pixel point to be drawn is smaller than that of the pixel point of the drawn image, drawing.
The implementation process of the functions and roles of each unit in the above device is specifically shown in the implementation process of the corresponding steps in the above method, and will not be described herein again.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present description. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
An embodiment of the present disclosure also provides a computing device including a memory, a processor, and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the image rendering method described above when executing the instructions.
An embodiment of the present specification also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the image rendering method as described above.
The above is an exemplary version of a computer-readable storage medium of the present embodiment. It should be noted that, the technical solution of the storage medium and the technical solution of the image drawing method belong to the same concept, and details of the technical solution of the storage medium which are not described in detail can be referred to the description of the technical solution of the image drawing method.
The computer instructions include computer program code that may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
It should be noted that, for the sake of simplicity of description, the foregoing method embodiments are all expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the present description is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present description. Further, those skilled in the art will appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily all necessary in the specification.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
The preferred embodiments of the present specification disclosed above are merely used to help clarify the present specification. Alternative embodiments are not intended to be exhaustive or to limit the invention to the precise form disclosed. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the disclosure and the practical application, to thereby enable others skilled in the art to best understand and utilize the disclosure. This specification is to be limited only by the claims and the full scope and equivalents thereof.

Claims (14)

1. An image rendering method, comprising:
acquiring the real depth of pixel points in an image to be drawn, wherein the position information of each pixel point is represented by a three-dimensional coordinate, and the depth value of each pixel point is represented by a Z-axis value in the three-dimensional coordinate;
comparing the real depth with a preset threshold value;
performing first projection on the pixel point with the real depth smaller than a preset threshold along the Z-axis direction to obtain a first Z-value depth, wherein the first Z-value depth is used as the Z-value depth of the pixel point;
performing second projection on the pixel points with the real depth larger than the preset threshold along the Z axis direction to obtain second Z value depth which is used as the Z value depth of the pixel points, wherein the method for performing first projection on the pixel points with the real depth smaller than the preset threshold along the Z axis direction is different from the method for performing second projection on the pixel points with the real depth larger than the preset threshold along the Z axis direction, and the nonlinearity of the pixel points with the real depth larger than the preset threshold in the second projection is smaller than that in the first projection;
and drawing the pixel point according to the Z value depth of the pixel point.
2. The method according to claim 1, wherein performing a first projection on the pixel point with the true depth smaller than the preset threshold along the Z-axis direction includes:
and performing first projection on the pixel points with the real depth smaller than the preset threshold along the Z-axis direction by adopting a perspective projection method along the Z-axis direction.
3. The method according to claim 1, wherein performing a second projection on the pixel point with the true depth greater than the preset threshold along the Z-axis direction includes:
and performing second projection on the pixel points with the real depths larger than the preset threshold value along the Z-axis direction by adopting a linear projection method along the Z-axis direction.
4. The method of claim 1, wherein performing a second projection in the Z-axis direction on the pixel points having the true depth greater than the preset threshold value further comprises:
and adopting an inverse mapping method for the pixel points with the real depth larger than a preset threshold along the Z-axis direction.
5. The method of claim 4, wherein the reverse mapping method comprises:
and according to the second Z value depth, reversing the second Z value to realize reverse mapping.
6. The method of claim 1, wherein rendering the pixel from the Z-value depth of the pixel comprises:
judging whether the pixel points of the drawn image exist at the positions of the pixel points to be drawn;
if not, directly drawing the pixel points to be drawn;
if the Z value depth of the pixel point to be drawn is larger than the Z value depth of the pixel point of the drawn image, drawing is not performed; and if the Z-value depth of the pixel point to be drawn is smaller than that of the pixel point of the drawn image, drawing.
7. An image drawing apparatus comprising:
the pixel point acquisition module is configured to acquire the real depth of a pixel point in an image to be drawn, the position information of each pixel point is represented by a three-dimensional coordinate, and the depth value of each pixel point is represented by a Z-axis value in the three-dimensional coordinate;
a depth comparison module configured to compare the true depth with a preset threshold;
the first projection module is configured to perform first projection on the pixel points with the real depth smaller than a preset threshold along the Z-axis direction to obtain first Z-value depth, wherein the first Z-value depth is used as the Z-value depth of the pixel points;
the second projection module is configured to perform second projection on the pixel points with the real depth larger than the preset threshold value along the Z-axis direction to obtain second Z-value depth, wherein the second Z-value depth is used as the Z-value depth of the pixel points, and the method for performing first projection on the pixel points with the real depth smaller than the preset threshold value along the Z-axis direction is different from the method for performing second projection on the pixel points with the real depth larger than the preset threshold value along the Z-axis direction, and the nonlinearity of the pixel points with the real depth larger than the preset threshold value in the second projection is smaller than that in the first projection;
and the image drawing module is configured to draw the pixel points according to the Z-value depth of the pixel points.
8. The apparatus of claim 7, wherein the first projection module performs a first projection of the pixel points with the true depth smaller than the preset threshold along the Z-axis direction by using a perspective projection method along the Z-axis direction.
9. The apparatus of claim 7, wherein the second projection module performs a second projection on the pixel point with the true depth greater than the preset threshold along the Z-axis direction by using a linear projection method along the Z-axis direction.
10. The apparatus of claim 7, wherein the second projection module performs a second projection on the pixel points with the true depth greater than the preset threshold along the Z-axis direction by using a reverse mapping method along the Z-axis direction.
11. The apparatus of claim 10, wherein the reverse mapping method comprises:
and according to the second Z value depth, reversing the second Z value to realize reverse mapping.
12. The apparatus of claim 7, wherein the image rendering module comprises:
and a judging sub-module: the method comprises the steps of judging whether a pixel point of a drawn image exists at a position of the pixel point to be drawn;
the drawing submodule: is configured to directly draw a pixel to be drawn under the condition that no pixel of an image is drawn on the position of the pixel to be drawn; under the condition that the pixel point of the drawn image exists at the position of the pixel point to be drawn, comparing the Z-value depth of the pixel point to be drawn with the Z-value depth of the pixel point of the drawn image, and if the Z-value depth of the pixel point to be drawn is larger than the Z-value depth of the pixel point of the drawn image, not drawing; and if the Z-value depth of the pixel point to be drawn is smaller than that of the pixel point of the drawn image, drawing.
13. A computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, wherein the processor, when executing the instructions, implements the steps of the method of any one of claims 1 to 6.
14. A computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the method of any one of claims 1 to 6.
CN201811223702.0A2018-10-192018-10-19Image drawing method and device, computing device and storage mediumActiveCN109325992B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201811223702.0ACN109325992B (en)2018-10-192018-10-19Image drawing method and device, computing device and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201811223702.0ACN109325992B (en)2018-10-192018-10-19Image drawing method and device, computing device and storage medium

Publications (2)

Publication NumberPublication Date
CN109325992A CN109325992A (en)2019-02-12
CN109325992Btrue CN109325992B (en)2023-07-04

Family

ID=65262977

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201811223702.0AActiveCN109325992B (en)2018-10-192018-10-19Image drawing method and device, computing device and storage medium

Country Status (1)

CountryLink
CN (1)CN109325992B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JP2001160153A (en)*1999-12-032001-06-12Namco Ltd Image generation system and information storage medium
CN1830007A (en)*2003-07-302006-09-06皇家飞利浦电子股份有限公司 A system for adaptive resampling in texture maps
CN101231754A (en)*2008-02-032008-07-30四川虹微技术有限公司Multi-visual angle video image depth detecting method and depth estimating method
CN102163324A (en)*2010-03-262011-08-24微软公司Deep image de-aliasing technique
CN102959945A (en)*2010-06-292013-03-06皇家飞利浦电子股份有限公司Method and system for producing a virtual output image from data obtained by an array of image capturing devices
CN104899924A (en)*2015-06-162015-09-09桂林电子科技大学Linear projection depth estimating method based on frog-leaping algorithm
CN105051790A (en)*2013-03-252015-11-11株式会社吉奥技术研究所Three-dimensional map display system
CN106709865A (en)*2015-11-132017-05-24杭州海康威视数字技术股份有限公司Depth image synthetic method and device
CN107274476A (en)*2017-08-162017-10-20城市生活(北京)资讯有限公司The generation method and device of a kind of echo

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN102208112B (en)*2011-05-252015-08-05威盛电子股份有限公司 Depth of Field Concealment Method, Three-dimensional Graphics Processing Method and Device
CN103914874B (en)*2014-04-082017-02-01中山大学Compact SFM three-dimensional reconstruction method without feature extraction

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JP2001160153A (en)*1999-12-032001-06-12Namco Ltd Image generation system and information storage medium
CN1830007A (en)*2003-07-302006-09-06皇家飞利浦电子股份有限公司 A system for adaptive resampling in texture maps
CN101231754A (en)*2008-02-032008-07-30四川虹微技术有限公司Multi-visual angle video image depth detecting method and depth estimating method
CN102163324A (en)*2010-03-262011-08-24微软公司Deep image de-aliasing technique
CN102959945A (en)*2010-06-292013-03-06皇家飞利浦电子股份有限公司Method and system for producing a virtual output image from data obtained by an array of image capturing devices
CN105051790A (en)*2013-03-252015-11-11株式会社吉奥技术研究所Three-dimensional map display system
CN104899924A (en)*2015-06-162015-09-09桂林电子科技大学Linear projection depth estimating method based on frog-leaping algorithm
CN106709865A (en)*2015-11-132017-05-24杭州海康威视数字技术股份有限公司Depth image synthetic method and device
CN107274476A (en)*2017-08-162017-10-20城市生活(北京)资讯有限公司The generation method and device of a kind of echo

Also Published As

Publication numberPublication date
CN109325992A (en)2019-02-12

Similar Documents

PublicationPublication DateTitle
US12260572B2 (en)Single image 3D photography with soft-layering and depth-aware inpainting
US11222235B2 (en)Method and apparatus for training image processing model, and storage medium
CN113596573B (en)Image processing method, image processing device, electronic equipment and computer readable storage medium
WO2021145913A1 (en)Estimating depth based on iris size
US20220358675A1 (en)Method for training model, method for processing video, device and storage medium
CN113658085B (en)Image processing method and device
CN111626919B (en)Image synthesis method and device, electronic equipment and computer readable storage medium
US8995784B2 (en)Structure descriptors for image processing
CN106919246A (en)The display methods and device of a kind of application interface
CN109257540A (en)Take the photograph photography bearing calibration and the camera of lens group more
US20170206050A1 (en)Content sharing methods and apparatuses
CN109377552B (en)Image occlusion calculating method, device, calculating equipment and storage medium
CN109829963B (en)Image drawing method and device, computing equipment and storage medium
CN111383166A (en)Method and device for processing image to be displayed, electronic equipment and readable storage medium
CN110399802B (en)Method, apparatus, medium, and electronic device for processing eye brightness of face image
JP2004229093A (en) Stereoscopic image generating method and stereoscopic image generating apparatus, and stereoscopic image generating program and recording medium
CN109816620B (en)Image processing method and device, electronic equipment and storage medium
CN109615583B (en)Game map generation method and device
CN113643343A (en)Training method and device of depth estimation model, electronic equipment and storage medium
CN114170068A (en) Image special effect generation method, device, electronic device and storage medium
CN109325992B (en)Image drawing method and device, computing device and storage medium
US20170206051A1 (en)Content sharing methods and apparatuses
CN114820348B (en) Image processing method, device, electronic device and storage medium
CN106875450A (en)For the training set optimization method and device of camera reorientation
CN113744172A (en)Document image processing method and device and training sample generation method and device

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
CB02Change of applicant information

Address after:519000 Room 102, 202, 302 and 402, No. 325, Qiandao Ring Road, Tangjiawan Town, high tech Zone, Zhuhai City, Guangdong Province, Room 102 and 202, No. 327 and Room 302, No. 329

Applicant after:Zhuhai Jinshan Digital Network Technology Co.,Ltd.

Applicant after:CHENGDU XISHANJU SHIYOU TECHNOLOGY Co.,Ltd.

Address before:519000 Room 102, 202, 302 and 402, No. 325, Qiandao Ring Road, Tangjiawan Town, high tech Zone, Zhuhai City, Guangdong Province, Room 102 and 202, No. 327 and Room 302, No. 329

Applicant before:ZHUHAI KINGSOFT ONLINE GAME TECHNOLOGY Co.,Ltd.

Applicant before:CHENGDU XISHANJU SHIYOU TECHNOLOGY Co.,Ltd.

CB02Change of applicant information
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp