|
发表于 2005-8-2 10:06:00
|
显示全部楼层
>When the OV7640 is reset, the registers have their default values.
>
>The ones that interest me are :
>
>COMA (at address 12h) ; default value 14h
>COMB (at address 13h) ; default value A3h
>COMD (at address 15h) ; default value 00h
>
>As a result of these settings, the datasheet specifies the data coming out
>of Y[7:0] is structured as follows : UYVYUYVY
>
>On the front page of the datasheet a feature is listed as YUV (4:2:2)
>
>I understand the 4:2:2 means that Y is sampled at twice the frequency of U
>and V, which is why Y appears twice as frequently as U or V in the extract :
>UYVYUYVY
Alternatively look at this way for every TWO Y pixels, there is only ONE
corresponding U and ONE corresponding V. You have to decode the colour
matrix of U and V to use with TWO adjacent Y points. U used with one pair
of Y and V used with a different pair (ideally).
>I would like to clarify my understanding of the data I capture :
>
>For each frame, I capture 640 x 480 pixels = 307200 pixels
>
>UYVYUYVY
>
>Pixel 1 : is a U value
>Pixel 2 : is a Y value
>Pixel 3 : is a V value
>Pixel 4 : is a Y value
>...
No that is four data points and TWO pixels.
>the first pixel of line 2 : Pixel 641 : is a U value ?
>Pixel 642 : is a Y value ?
>Pixel 643 : is a V value ?
>Pixel 644 : is a Y value ?
I would expect the first data BYTE of line 2 to be data BYTE 1281 (starting
at 1 or 1280 starting at 0).
>For example, for pixel 642, I have the Y value, but no corresponding U or V.
>So in order to estimate the U or V value for this pixel, I need to use an
>algorithm such as nearest neighbor replication or bilinear interpolation?
The bytes coming out should be in multiples of FOUR to give 4:2:2 coding,
which correspond in CCIR656 format (4:2:2 down one byte wide stream) as
twice as many data points as pixels.
>Is this understanding correct? Or is the data packed in a similar way to
>RGB 5:6:5 where within 2 bytes of Y[7:0] you get an R,G and a B value
>(albeit not at 8 bits resolution!)
You really need FOUR bytes to obtain an RGB matrix conversion as 4:2:2 should
be sampled as
Y Y Y
U U
V V
Hence the pairings of U and V for diffeent pairs of Y. Until you have the
THIRD byte at least you cannot give an RGB value for the first PIXEL.
However they are often sampled for simpler clocking and data pipeline
Y Y Y Y
U U
V V
Until you have the second pair of bytes the RGB values cannot be determined.
A good reference is Keith Jack's Video Demystified (now edition 4)
with a link from the Omnivision technical pages.
ISBN 0-7506-7822-4
Just gone from 1st edition to 4th edition myself. |
|