Reputation: 1198
I'm using videoInput to interface with DirectShow and get pixel data from my webcam.
From another question I've asked, people have suggested that the pixel format is just appended arrays in the order of the Y, U, and V channels.
FourCC's website suggests that the pixel format does not actually follow this pattern, and is instead |Y0|U0|Y1|V0|Y2|U0|Y3|V0|
I'm working on a few functions that convert the YUY2 input image into RGB and YV12, and after having little to no success, thought that it might be an issue with how I'm interpreting the initial YUY2 image data.
Am I correct in assuming that the pixel data should be in the format from the FourCC website, or are the Y, U and V channels separate arrays that have be concentrated (so the data is in the order of channels, for example: YYYYUUVV?
Upvotes: 2
Views: 1209
Reputation: 1046
In YUY2 each row is a sequence of 4-byte packets: YUYV describing two adjacent pixels. In YV12 there are 3 separate planes: first Y of size width*height then V and then U, both of size width/2 * height/2.
Upvotes: 2