Re: Convert CGImageRef from BGR to RGB
Re: Convert CGImageRef from BGR to RGB
- Subject: Re: Convert CGImageRef from BGR to RGB
- From: Michael Vannorsdel <email@hidden>
- Date: Mon, 16 Jun 2008 23:33:38 -0600
If you get your image data into a bitmap form you can use vImage's
(Accelerate Framework) permute functions to quickly rearrange the
channel ordering. There might be another way using color spaces, but
none that I know off hand.
On Jun 16, 2008, at 5:09 PM, Rodrigo Gutierrez wrote:
I'm pulling data off a streaming web camera, and it appears that the
camera sends jpeg data using the BGR color space. Right now I am
creating a CGImageRef by doing the following:
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL,
jpegData, jpegDataLength, NULL);
CGImageRef imageRef = CGImageCreateWithJPEGDataProvider(provider,
NULL, true, kCGRenderingIntentDefault);
Where jpegData is the payload of several packets concatenated, and
jpegDataLength is the length of the jpegData buffer... basic stuff.
This approach gets me an image but my reds and blues are flipped. I
checked out the documentation and google and I couldn't find a clear
way to swap the red and blue using Cocoa. Can someone steer me in
the right direction?
I appreciate any help.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden