Avatar ·

How to generate an image in Python?

📁 python, пример, ии

I can load an image and display it on the screen like this:

import cv2img = cv2.imread(""1.jpg"")cv2.imshow(""Original"", img)

For example, to get a white image, I can load any image, draw a white rectangle on top of it, and display it on the screen.

However, what should I do if I want to get a white image without loading one beforehand? How can I replace the load operation with an operation that generates an image object?

Avatar ·

About video processing in Python

PS. Suggest a technology better than FFMpeg for solving the task, if such exists.

PyAV

There is such a wonderful project: . These are Python bindings to libav. I use it for working with video in Python. The PyAV API differs significantly from the arguments of ffmpeg and vanilla libav, but it seems quite clear and logical in the context of Python.

PyAV: Example

import av
from av.video.frame import VideoFrame
from av.video.stream import VideoStream
# In this list we will store frames as numpy vectors                                

Log in to leave an answer

Blogs