Skip to contentSkip to conversation

video rotate or flip

DISCUSSION René Doss 2 participants 2 messages Oct 30, 2024 – Nov 4, 2024 Media (V4L/DVB)

lore
Share & tools
lore

René Doss

author
#0 lore raw

Hallo,

I have to rotate the camera. I have a optical spectrometer and the spectrum is mirrored.

I can not turn the sensor. It is all fixed with glue.

How can I set the option flip or rotate the picture in the driver?

I collect all my datas of my videodevice.

lsusb

Bus 003 Device 007: ID 0c68:6464 Sonix Technology Co., Ltd. USB 2.0 Camera

lsmod |grep  video
uvcvideo                     106496  0
videobuf2_vmalloc      20480  1 uvcvideo
videobuf2_memops       20480  1 videobuf2_vmalloc
videobuf2_v4l2             32768  1 uvcvideo
videobuf2_common       77824  4 videobuf2_vmalloc,videobuf2_v4l2,uvcvideo,videobuf2_memops videodev                       253952  3 videobuf2_v4l2,uvcvideo,videobuf2_common mc                                 61440  4 videodev,videobuf2_v4l2,uvcvideo,videobuf2_common video                              61440  0

v4l2-ctl --list-devices
USB 2.0 Camera: USB-ZH (usb-0000:00:14.0-5):
    /dev/video0
    /dev/video1

I hope you have some hints.

Best regards

René Doss

#1 lore raw

Hi Rene'

Quoted 33 lines · René Doss

Hallo,

I have to rotate the camera. I have a optical spectrometer and the spectrum is mirrored.

I can not turn the sensor. It is all fixed with glue.

How can I set the option flip or rotate the picture in the driver?

I collect all my datas of my videodevice.

lsusb

Bus 003 Device 007: ID 0c68:6464 Sonix Technology Co., Ltd. USB 2.0 Camera

lsmod |grep  video
uvcvideo                     106496  0 videobuf2_vmalloc      20480  1 uvcvideo videobuf2_memops       20480  1 videobuf2_vmalloc videobuf2_v4l2             32768  1 uvcvideo videobuf2_common       77824  4 videobuf2_vmalloc,videobuf2_v4l2,uvcvideo,videobuf2_memops videodev                       253952  3 videobuf2_v4l2,uvcvideo,videobuf2_common
mc                                 61440  4 videodev,videobuf2_v4l2,uvcvideo,videobuf2_common video                              61440  0

Quoted 4 lines

v4l2-ctl --list-devices
USB 2.0 Camera: USB-ZH (usb-0000:00:14.0-5):
    /dev/video0
    /dev/video1

You should check if your devices support the hflip control.

v4l2-ctl --list-ctrls -d /dev/video0 | grep flip
v4l2-ctl --list-ctrls -d /dev/video1 | grep flip

If it does you can set the control before starting the streaming and the video stream should be horizontally flipped natively.

I've been told the UVC specs do not officially support flips, but some devices implement them through an extension of the specs.

If your camera device does not natively support flips, you could probably use gstreamer and pass the video through the 'videoflip' element.
https://gstreamer.freedesktop.org/documentation/videofilter/videoflip.html?gi-language=c

Hope it helps

Quoted 8 lines

I hope you have some hints.

Best regards

René Doss