Hi Khashayar,

On Sunday 14 December 2008, Khashayar Naderehvandi wrote:
> Hi all,
>
> I'm one of those unlucky people who has the notorious problem of an
> upside-down mounted web camera in my notebook. The uvcvideo module
> itself works perfectly well with this webcam, which is a Suyin
> (064e:a116).
>
> I came across these patches [1] posted on the Ubuntu forums that
> allows the uvcvideo module to flip the image. I was wondering if there
> are any plans to incorporate those patches in uvc to accomplish
> something similar to the syntek driver's hflip & vflip options?

A little background first. Most UVC cameras are made of a video sensor and a 
USB bridge. Sensors can usually be read in any direction, offering horizontal 
and vertical flip options. Unfortunately, firmware developers often forget to 
expose those functions through the UVC interface, making hardware horizontal 
and vertical flipping impossible.

When a camera mounted upside-down doesn't offer any hardware flip control, the 
image must be rotated by software. Image processing isn't allowed in the 
Linux kernel (or at least hardly discouraged), so I'm not keen on 
implementing software-based image rotation in the UVC driver. I could be 
convinced otherwise if the proposed implementation didn't impact 
performances. This is in theory be possible, as the UVC driver copies data 
from USB buffers to V4L buffers. 'Backward' copy could be implemented without 
hurting the source code readability and performances (please not this isn't 
possible for compressed formats).

However, an alternative now exists through libv4l. The library supports 
software-based image rotation in userspace. If your application is linked to 
libv4l the HFLIP and VFLIP controls should be available (I haven't tried it 
myself so this might require some tweaking). It might be possible to achieve 
the same result for applications not designed for libv4l by preloading the 
library.

In your and David's case, the webcam supports direct access to the I2C bus 
from the host driver, making it possible (at least in theory) to enable image 
rotation on the sensor from the driver. This would require access to the 
datasheet of the video sensor used in the camera. I can assist you with 
driver hacking if you want to experiment with that.

Best regards,

Laurent Pinchart
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to