Re: libv4l: Possibility of changing the current pixelformat on the fly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Sun, 5 Apr 2009, Jean-Francois Moine wrote:

On Sat, 04 Apr 2009 22:22:19 +0200
Erik Andrén <erik.andren@xxxxxxxxx> wrote:
	[snip]
When flipping the image horizontally, vertically or both, the sensor
pixel ordering changes. In the m5602 driver I was able to compensate
for this in the bridge code. In the stv06xx I don't have this
option. One way of solving this problem is by changing the
pixelformat on the fly, i. e V4L2_PIX_FMT_SGRB8 is the normal
format. When a vertical flip is required, change the format to
V4L2_SBGGR8.

My current understanding of libv4l is that it probes the pixelformat
  upon device open. In order for this to work we would need either
poll the current pixelformat regularly or implement some kind of
notification mechanism upon a flipping request.

What do you think is this the right way to go or is there another
alternative.

Hi Erik,

I saw such a problem in some other webcams. When doing a flip, the
sensor scans the pixels in the reverse order. So,
	R G R G
	G B G B
becomes
	B G B G
	G R G R

The solution is to start the scan one line lower or higher for VFLIP
and one pixel on the left or on the right for HFLIP.

May you do this with all the sensors of the stv06xx?

That is a very clever solution -- if the hardware will do such a thing. I can not speak for the stv06xx cameras, of course. But I am pretty sure it is impossible for the sq905 cameras. Therefore it is not a universal solution. If it can be done, great. But it seems to me that the general way to do this would be just to adjust the Bayer tiling to be in accord with the flipping after it is done (one of the possibilities already mentioned above).

The problem which I would address is that the need for image flipping ought to be handled in a standard way, if possible. The sq905 cameras (with which I have been directly concerned) do give rise to similar problems. The big difference is that there is no way with an sq905 to tell the camera to do any flipping in hardware, nor to shift the pixel reading one space over or down. Hence my obvious interest in seeing this problem analysed completely, and in seeing the best solution adopted. One possible way to do that would be to have the choice for the pixel format to reflect what it ought to be, after any flipping has taken place. From this point of view, it would not matter if the flipping is done in V4L or in hardware, before the data has left the camera. It would only be necessary to agree that any required flipping takes place first, and then the Bayer interpolation afterwards.

Theodore Kilgore

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux