Dima_kras2020-03-16 10:35:27
Dima_kras, 2020-03-16 10:35:27

3d graphics in python, which library to use?

Hello. The task is this, there is a video file. The task is to display a video file on the screen and draw 3d graphics, primitives, such as a rotating cube on top.

Now I do it like this, I read the frame with the help of imread, with the help of opencv and drawline I draw what I need. Display video frame by frame using imshow.

The problem is that opencv uses the CPU to draw lines, and it slows down, I want to use the GPU for drawing and output to free the CPU, which library would you recommend?

Now I'm looking at OpenGL, but maybe there is something simpler? The task seems to be not difficult for me to bother with OpenGL.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Sergey Sokolov, 2020-03-16

I would generate 3D primitives on a transparent background in one thing,
and merge with the original video using ffmpeg. On the fly, quite.

Andrey Dugin, 2020-03-16

You are solving the problem from the wrong end. OpenCV is a very fast library (especially if you use it correctly, avoid unnecessary memory allocations for arrays, etc.). Try to read (decode) the video asynchronously or in a separate thread. For example, you can use FileVideoStream from imutils.

RDaneel, 2020-03-16

PyQtGraph. It is based on OpenGl, but it is very easy to use, and the described task can be solved there right out of the box.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question