• 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: Jean-Daniel Dupas <email@hidden>
  • Date: Fri, 06 May 2011 23:30:03 +0200


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

  • Follow-Ups:
    • Re: drawing onto CVPixelBuffer
      • From: douglas welton <email@hidden>
References: 
 >drawing onto CVPixelBuffer (From: eveningnick eveningnick <email@hidden>)

  • Prev by Date: Re: Threading synchronization: does a primitive exists?
  • Next by Date: Re: drawing onto CVPixelBuffer
  • Previous by thread: drawing onto CVPixelBuffer
  • Next by thread: Re: drawing onto CVPixelBuffer
  • Index(es):
    • Date
    • Thread