Re: CVPixelBuffer and Color profiles
Re: CVPixelBuffer and Color profiles
- Subject: Re: CVPixelBuffer and Color profiles
- From: Kevin Meaney <email@hidden>
- Date: Mon, 19 Jan 2015 12:02:02 +0000
Thanks Quincey,
I've now pulled a color profile from a CVPixelBuffer obtained from iterating through video frames of a movie file which I can use when creating my CGBitmapContext which I hadn't been doing before so I'm sure this will also work going the other way.
What I'd like to be able to do is to compare profiles obtained this way with what I think must be AVFoundation's equivalent e.g.:
AVVideoColorPropertiesKey : [
AVVideoColorPrimariesKey : AVVideoColorPrimaries_ITU_R_709_2,
AVVideoTransferFunctionKey : AVVideoTransferFunction_ITU_R_709_2,
AVVideoYCbCrMatrixKey : AVVideoYCbCrMatrix_ITU_R_601_4
],
But the documentation is so poor, I do not understand what things like AVVideoColorPrimaries_ITU_R_709_2 mean, Apple docs don't help and my duck duck go searches haven't helped.
When I get info about a movie file in Finder some will include a color profile name e.g.: HD (1-1-1)
If I get info for an image file created from a movie using AVAssetImageGenerator then the profile name is: Composite NTSC. But I have no idea how to get this information in code. CGColorSpaceCopyName doesn't work as it is only returns a string from a CGColorSpace created with CGColorSpaceCreateWithName.
What I'd like to know is, is the color profile of the image generated from an imported movie the same as the color profile equivalent for the movie (see AVFoundation color property keys above) I'm creating from individual frames? It would be ideal if I could keep everything using the same profile color space in my processing pipeline.
Kevin
On 19 Jan 2015, at 01:56, Quincey Morris <email@hidden> wrote:
> On Jan 18, 2015, at 17:22 , Kevin Meaney <email@hidden> wrote:
>>
>> How can I make sure that the CGBitmapContext and CVPixelBuffer view the pixel data in the same way from a color matching perspective?
>
> You can attach a color space to the pixel buffer as follows:
>
> CVBufferSetAttachment (pixelBuffer, kCVImageBufferCGColorSpaceKey, …, kCVAttachmentMode_ShouldNotPropagate);
>
> Depending on what you do next, I would expect the pixel buffer data to either be converted to a destination color space, or to have its color space propagated to the destination. (Note that the attachment mode “should not propagate” refers to something unrelated, AFAIK. But I’m not an expert on any of this.)
>
_______________________________________________
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