• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: drawing onto CVPixelBuffer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: drawing onto CVPixelBuffer


  • Subject: Re: drawing onto CVPixelBuffer
  • From: douglas welton <email@hidden>
  • Date: Sat, 07 May 2011 22:20:09 -0400

Have you taken a look at the CaptureAndCompressIPBMovie sample code?  That code does something very similar to what you appear to be in need of.

On May 6, 2011, at 5:30 PM, Jean-Daniel Dupas wrote:

>
>
> Le 6 mai 2011 à 22:22, eveningnick eveningnick a écrit :
>
>> Hi
>> I have a CVPixelBuffer with some background picture.
>> I need to draw on this background some foreground image. I don't need
>> to preserve the initial CVPixelBuffer's content - i just need to add a
>> small foreground watermark onto that buffer.
>>
>> CIImage does allow to create an image from CVPixelBuffer and paint
>> something on top of it (using Core Image filters), but CIImage is
>> "read only" - it takes a source image and generates a brand new image
>> in a new buffer.
>> I can't afford one more copying, that greatly slows things down,
>> because the CVPixelBuffer itself is kind of big. And there are a lot
>> of them per second (they are generated as frames from a movie).
>>
>> Is there any way i could draw without such a copy? Maybe there is any
>> other imaging framework that allows me to work with CVPixelBufferRef?
>> Or should i just 'CVPixelBufferLock' the buffer, and copy raw bytes
>> onto the buffer from my source NSImage (that contains the foreground
>> image) directly using a loop? This doesn't seem the right way though.
>> Could you please help me, what is better to do here?
>
>
> If your pixel buffer has a format supported by the CGBitmapContext API, you can use the later to draw into it.
>
> Create a CGBitmapContext using the memory from you CVPixelBuffer, and draw using the CGContext API.
>
> -- Jean-Daniel
>
>
>
>
> _______________________________________________
>
> 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

_______________________________________________

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

References: 
 >drawing onto CVPixelBuffer (From: eveningnick eveningnick <email@hidden>)
 >Re: drawing onto CVPixelBuffer (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: NSTextView and NSTextContainer size & clipping area
  • Next by Date: Re: Threading synchronization: does a primitive exists?
  • Previous by thread: Re: drawing onto CVPixelBuffer
  • Next by thread: Re: drawing onto CVPixelBuffer
  • Index(es):
    • Date
    • Thread