Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
add UYVY support #357
Consider a camera like this:
Note the pixel format here is UYVY. Attempting to start capture with pygame.camera will give you an error like this:
The attached patch allows pygame to make use of this sort of camera.
I have tested this and I get good output in RGB, and, I think, expected output in YUV, its hard to say, since it doens't look normal like RGB, but its consistent with what I get with other camers in YUV mode.
Damn, just found this PR after creating my own patch.
@adicarlo: It might make sense for your implementation to make the pixel format conversion functions a bit more DRY instead of just copying the
@aszlig You raise a good point about DRY, but speaking of DRY, why is it that pygame needs to include these fundamental pixel format conversions at all? Surely there is an efficient C library version, perhaps in a library we're already using, with an implementation we can use. That would mean less code, easier maintenance, and we'd also pick up a lot of additional unimplemented pixel conversions.
This more minimal approach would benefit pygame more, I think, but its beyond what I wanted to embark upon.