Questions tagged [cvpixelbuffer]

141 questions
20
votes
1 answer

How to convert a UIImage to a CVPixelBuffer

Apple's new CoreML framework has a prediction function that takes a CVPixelBuffer. In order to classify a UIImage a conversion must be made between the two. Conversion code I got from an Apple Engineer: 1 // image has been defined earlier 2 3 …
Ryan
  • 209
  • 1
  • 2
  • 3
17
votes
4 answers

Get pixel value from CVPixelBufferRef in Swift

How can I get the RGB (or any other format) pixel value from a CVPixelBufferRef? Ive tried many approaches but no success yet. func captureOutput(captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer:…
scord
  • 1,357
  • 1
  • 17
  • 33
13
votes
5 answers

Get RGB "CVPixelBuffer" from ARKit

I'm trying to get a CVPixelBuffer in RGB color space from the Apple's ARKit. In func session(_ session: ARSession, didUpdate frame: ARFrame) method of ARSessionDelegate I get an instance of ARFrame. On page Displaying an AR Experience with Metal I…
tomas789
  • 1,160
  • 1
  • 8
  • 20
11
votes
1 answer

Unknown underlying OSStatus error -16364 when using AVAssetWriter

I'm building a video export feature for one of my apps. In essence, the video is a series of one of six different images lasting for different (short) durations. The export works fine when I export something containing 283 images of varying…
Linuxios
  • 31,993
  • 12
  • 82
  • 110
9
votes
1 answer

Difficulty Writing Pixel Buffer To Asset Writer on Certain Devices

I am working on a function in my app to write images from my sample buffer to an AVAssetWriter. Curiously, this works fine on a 10.5" iPad Pro, but causes a crash on a 7.9" iPad Mini 2. I can't fathom how the same code could be problematic on two…
ZbadhabitZ
  • 2,461
  • 1
  • 18
  • 39
9
votes
0 answers

create CMSampleBuffer from CVPixelBuffer

I am provided with pixelbuffer, which I need to attach to rtmpStream object from lf.swift library to stream it to youtube. it looks like this: rtmpStream.appendSampleBuffer(sampleBuffer: CMSampleBuffer, withType: CMSampleBufferType) So, I need to…
9
votes
1 answer

Get RAW Bayer pixel data from CVPixelBufferRef

I am using AVCaptureSession & AVCapturePhotoOutput to capture RAW photo data from device's camera in the kCVPixelFormatType_14Bayer_RGGB format. I have got as far as getting the raw photo sample buffer in the AVCapturePhotoCaptureDelegate…
Matt Colliss
  • 1,384
  • 1
  • 11
  • 20
8
votes
3 answers

How do I update a CALayer with a CVPixelBuffer/IOSurface?

I have an IOSurface-backed CVPixelBuffer that is getting updated from an outside source at 30fps. I want to render a preview of the image data in an NSView -- what's the best way for me to do that? I can directly set the .contents of a CALayer on…
andrew
  • 893
  • 2
  • 16
  • 25
8
votes
1 answer

Convert ARFrame's captured image to UIImage orientation issue

I want to detect ball and have AR model interact with it. I used opencv for ball detection and send center of ball which I can use in hitTest to get coordinates in sceneView. I have been converting CVPixelBuffer to UIImage using following…
Alok Subedi
  • 1,531
  • 10
  • 25
7
votes
2 answers

What is plane in a CVPixelbuffer?

In CVPixelBuffer object, have one or many planes. (reference) We have methods to get number, heigh, the base address of plane. So what exactly the plane is? And how it constructed inside a CVPixelBuffer? Sample:
Nhat Dinh
  • 3,202
  • 2
  • 30
  • 45
6
votes
0 answers

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
  • 157
  • 1
  • 10
6
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,307
  • 1
  • 14
  • 43
6
votes
3 answers

Duplicate / Copy CVPixelBufferRef with CVPixelBufferCreate

I need to create a copy of a CVPixelBufferRef in order to be able to manipulate the original pixel buffer in a bit-wise fashion using the values from the copy. I cannot seem to achieve this with CVPixelBufferCreate, or with…
Maxi Mus
  • 675
  • 5
  • 16
6
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
  • 61
  • 3
6
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
  • 675
  • 5
  • 16
1
2 3
9 10