Questions tagged [cvpixelbuffer]

159 questions
7
votes
1 answer

CVMetalTextureCacheCreateTextureFromImage always return null

I'm trying to render I420 (YCbCr planner) via MetalKit most of examples are using the CMSampleBuffer which from Camera, but my goal is using a given I420 bytes. I do something like this: let data = NSMutableData(contentsOfURL:…
PatrickSCLin
  • 1,419
  • 3
  • 17
  • 45
7
votes
3 answers

Create CVPixelBuffer with pixels data, but the final image is distorted

I get pixels by OpenGLES method(glReadPixels) or other way, then create CVPixelBuffer (with or without CGImage) for video recording, but the final picture is distorted. This happens on iPhone6 when I test on iPhone 5c, 5s and 6. It looks…
Sinkup
  • 71
  • 1
  • 3
7
votes
3 answers

Replace Part of Pixel Buffer with White Pixels in iOS

I am using the iPhone camera to capture live video and feeding the pixel buffer to a network that does some object recognition. Here is the relevant code: (I won't post the code for setting up the AVCaptureSession etc. as this is pretty standard.) -…
Maxi Mus
  • 795
  • 1
  • 6
  • 20
7
votes
3 answers

How to convert CVImageBuffer to UIImage?

I have temporary variable tmpPixelBuffer with pixel buffer data, which is not nil, and when metadata objects are detected I want to create image from that buffer, so I could crop metadata images from that image. Image is always nil, what do I do…
Shmidt
  • 16,436
  • 18
  • 88
  • 136
6
votes
1 answer

How to crop and flip CVPixelBuffer and return CVPixelBuffer?

I am making an swift video app. In my app, I need to crop and horizontally flip CVPixelBuffer and return result which type is also CVPixelBuffer. I tried few things. First, I used 'CVPixelBufferCreateWithBytes' func resizePixelBuffer(_…
HB.K
  • 167
  • 2
  • 12
6
votes
0 answers

Rotate CMSampleBuffer/CVPixelBuffer

I am currently attempting to change the orientation of a CMSampleBuffer by first converting it to a CVPixelBuffer and then using vImageRotate90_ARGB8888 to convert the buffer. The problem with my code is that when vImageRotate90_ARGB8888 executes,…
5
votes
1 answer

How to Convert Existing OpenGL Texture to Metal Texture

I am working on developing some FxPlug plugins for Motion and FCP X. Ultimately, I'd like to have them render in Metal as Apple is deprecating OpenGL. I'm currently using CoreImage, and while I've been able to use the CoreImage functionality to do…
mredig
  • 1,736
  • 1
  • 16
  • 29
5
votes
0 answers

Fastest way to record video from SCNView

I have SCNView with some object in the middle of screen, user can rotate it, scale, etc. I want to record all this movements in video and add some sound in realtime. Also I want to record only middle part of SCNView (e.g. SCNView frame is 375x812…
Joker
  • 263
  • 2
  • 16
5
votes
0 answers

Memory Leak of CVPixelBuffer In Dispatch Queue Using Vision

I'm using a renderer class within a capture pipeline to add a CI filter to video. Inside the copyRenderedPixelBuffer of the renderer I'd also like to copy the pixel buffer and send it to Vision to detect facial landmarks. I've made a singleton for…
5
votes
1 answer

Byte per row is wrong when creating a CVPixelBuffer with width multiple of 90

I'm processing raw yuv420 biplane frames data which I receive from the network and need to create CVPixelBuffer in order to process it into Core Image as well as writing into disk using AVAssetWriter. When I try to create a CVPixelBuffer with code…
5
votes
0 answers

Metal Render Loop optimization

I'm looking for some direction on how to properly implement a Metal render loop. My render loop is being fed a stream of video frames from an AVPlayer. Here's my current implementation: A CVDisplayLink queries the AVPlayerItemVideoOutput of the…
zzyzy
  • 973
  • 6
  • 21
5
votes
1 answer

convert UIImage to 8-Gray type pixel Buffer

I'm able to convert a UIImage to a ARGB CVPixelBuffer, but now i'm trying to convert the UIImage to a grayscale one buffer. I thought i had it since the code goes through but the coreML model complains saying: "Error Domain=com.apple.CoreML Code=1…
user1988824
  • 2,947
  • 2
  • 22
  • 27
5
votes
1 answer

What is a CVPixelBuffer in iOS?

According to Apple docs, it's an image stored in main memory, but how are those images used to make a movie?
rocky raccoon
  • 514
  • 1
  • 8
  • 23
5
votes
1 answer

How to properly address the pixels in a CVPixelBuffer?

The short question is: What's the formula to address pixel values in a CVPixelBuffer? I'm trying to convert a CVPixelBuffer in a flat byte array and noticed a few odd things: The CVPixelBuffer is obtained from a CMSampleBuffer. It's width and…
SePröbläm
  • 5,142
  • 6
  • 31
  • 45
4
votes
1 answer

Get 5 main colors from CVPixelBuffer MOST efficiently and quickly

I'm trying to get 5 main/dominant colors from a CVPixelBuffer, and I need it to be as quick and efficient as possible. I've tried Pixelating with CIFilter & Resize it, and only than go through the Pixels Data, but it's still pretty slow. Also, how…
1
2
3
10 11