hoffstadt / hoffstadt/DearPyGui
Rendering an image in dpg. plot takes too much time
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
## Version of Dear PyGui
Version: 1.11.1
Operating System:Windows 11&Windows 10
## My Issue/Question
To render a 1920 * 1280 pixel image in dpg. plot, it takes a huge amount of time (usually around 35ms) and it is difficult to achieve a frame rate of 30fps/s or higher. My graphics card is 3060ti. If I run it on a computer with poorer hardware or render a higher resolution image, the time will further increase. For better demonstration, I loop through the code to render the same image (in actual projects, I render each frame of the video), and the code and image attachments used will be placed in the front of the bottom
## To Reproduce
Put my code and the provided images in the same directory, run the code, and the console will print the rendering time for each frame
## Expected behavior
I hope to render the image data as quickly as possible after receiving it, and I hope to render a 1920 * 1280 pixel image with a time limit of less than 10ms ,I hope to render the image data as quickly as possible after receiving it, and I hope to render a 1920 * 1280 pixel image with a time limit of less than 10ms
Also, it is hoped that add_dynamic_texture can receive the original pixel data: [R, G, B, A], rather than having to convert it to floatation: [R/255, G/255, B/255, A/255] in order to be received
Because most third-party libraries currently return image data in RGB format, converting it to floating-point data will increase preprocessing time
## Screenshots/Video

## Standalone, minimal, complete and verifiable example

import time
import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.create_viewport(title='Visualization Tool')
with dpg.window(no_scrollbar=True, delay_search=True, no_move=False, label="main", width=2000,
height=1500) as window1:
w, h, _, d = dpg.load_image("./img.png")
with dpg.texture_registry(show=False) as dynamic_texture_registry:
transparent_background = dpg.add_dynamic_texture(w, h,d)
with dpg.plot(no_title=True, no_menus=True, no_child=True,delay_search=False,width=900,height=600) as image_plot:
plot_x = dpg.add_plot_axis(dpg.mvXAxis, no_tick_labels=True, no_tick_marks=True, no_gridlines=True, )
with dpg.plot_axis(dpg.mvYAxis, no_tick_labels=True, no_tick_marks=True, no_gridlines=True,
invert=True) as plot_y:
dpg.add_image_series(transparent_background, [0, h], [w, 0])
dpg.add_button(label="start",callback=lambda :mystart())
def mystart():
while True:
tt1=time.time()
dpg.configure_item(transparent_background,default_value=d)
tt2=time.time()
print("渲染耗时",tt2-tt1)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
Contributor guide
Assessment
This issue has not been assessed yet.