0

I am trying to implement image rotation for 1920x1080@60fps video stream that is received from a camera. (I am using i.MX8M-Mini and streaming video using GStreamer. And the video stream is planned to be transmitted using RTP, so I'm not working with a display unit.)

I've used a planar YUV (I420) camera before, and it was easy to implement rotation: I was just rotating Y, U and V planes separately with OpenCV's related functions**. But the thing is, current camera sends frames in a packed YUV format (YUY2).

Converting packed YUV frames to planar YUV format is expensive for me, since related hardware does not support YUY2-I420 conversion.

Is there any way to perform angular rotation on packed YUV frames (preferably using OpenCV)?

*: getRotationMatrix2D(), warpAffine()

ddyn
  • 55
  • 1
  • 1
  • 9
  • did you try using GStreamer API for rotation ? https://gstreamer.freedesktop.org/documentation/geometrictransform/rotate.html?gi-language=c – Ziri Aug 11 '20 at 06:57
  • Yes, but sadly, ended up with 3fps stream. – ddyn Aug 11 '20 at 07:06
  • 1
    In that case, you can use stream thread and processing thread separately, check this answer: https://stackoverflow.com/questions/22041699/rotate-an-image-without-cropping-in-opencv-in-c – Ziri Aug 11 '20 at 07:23
  • @Ziri I thought about it, but one YUY2-I420 conversion takes ~180 msecs. For a minimum of 25fps stream, threads & buffering won't work – ddyn Aug 11 '20 at 07:45
  • So you mean Opencv cvtColor width flag ( cv::COLOR_YUV2RGB_I420) takes 180 ms ? – Ziri Aug 11 '20 at 07:50

0 Answers0