Search code examples
videorotationvideo-streamingreal-timenvidia-jetson

real-time video rotation by arbitrary angle


TL;DR: is it feasible to rotate a video stream in real-time by an arbitrary angle (not 90 or 180)?

More details: In a medical device being designed, a camera will feed a video stream to a single-board computer (SBC). Think Raspberry Pi, Nvidia Jetson or similar SBC. The video will be output to another video port after an overlay of semi-static data is added to the video.

We are considering whether it is possible to also rotate the video by a fixed, known angle (which is not 90 or 180) before it's sent out. The video should not have a significant lag that the user can feel - I imagine this means no more than a few frames of lag.

The video stream specs are not finalized yet but are somewhere between 400x400 to 1024x768 resolution, 30 fps. Interface / format / encoding not yet defined.

sub-questions:

  • Would you say this is already considered a computationally "easy" task today, i.e. any random recent SBC or phone or basic PC could do it? or "medium" i.e. a full-fledged PC with a dedicated GPU can handle this but not a small SBC? or "hard" i.e. you'd need some specialized and/or expensive hardware for that?

  • Does a GPU help? I know they are mostly 3D-rendering oriented while this is a purely 2D video stream manipulation task.

  • Is the video encoding / incoming port (HDMI / DP / USB / other) changes the difficulty of achieving this?

  • What SW environment / framework / library / tools seem natural for such a task?

Thank you!


Solution

  • For your video mode requirement, the answer is yes, a jetson would probably be able to do this. Jetsons are a range of family and obviously the lower grade modules wouldn't acheive the same performance as higher grade modules.

    With recent JetPack releases you may be able to use PVA or more from VPI API.

    You may also use opencv with CUDA support. Once you have an opencv installed build with CUDA and GStreamer support, you may see: https://forums.developer.nvidia.com/t/opencv-cuda-processing-from-gstreamer-pipeline-jp4-jp5/273745/ for accessing NVMM memory buffers and https://forums.developer.nvidia.com/t/jetson-nano-real-time-rotation/229282/2 for an old example.