Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merging CVPixelBuffers

I have CVPixelBuffers of 2 images. I want to merge the two such that the second image is on top of the first one at the co-ordinates I want. Appreciate if anyone can guide me in that.

I don't want to use context draws as I'm trying to lower the CPU utilization. The images would be screenshots that gets processed so it's real-time and doing thousands of context draws increases CPU utilization.

like image 895
user1044328 Avatar asked Nov 19 '25 13:11

user1044328


1 Answers

You can use Core Image to

  1. create two CIImages from the CVPixelBuffers
  2. combine the two using CISourceOverCompositing
  3. use CIContext render:toCVPixelBuffer: to render the result into a third CVPixelBuffer
like image 170
David Hayward Avatar answered Nov 22 '25 02:11

David Hayward



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!