-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
more: https://stackoverflow.com/questions/48540004/converting-cvpixelbuffer-to-mat-opencv
opencv(1934,0x16f087000) malloc: *** error for object 0x16f086108: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
my Swift code:
fileprivate func configureVideoOutput() {
let videoOutput = AVCaptureVideoDataOutput()
videoOutput.setSampleBufferDelegate(self, queue: DispatchQueue(label: "sample buffer"))
if self.session.canAddOutput(videoOutput) {
print("canAddOutput yes")
self.session.addOutput(videoOutput)
print("canAddOutput yes added")
} else {
print("canAddOutput no")
}
}
private func matFromSampleBuffer(sampleBuffer: CMSampleBuffer) -> OCVMat? {
guard let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { return nil }
return OCVMat(pixelBuffer: imageBuffer)
}
public func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
count = count + 1
print("Got a frame # \(count)")
guard let mat = matFromSampleBuffer(sampleBuffer: sampleBuffer) else { return }
}
https://github.com/Legoless/LegoCV/blob/master/LegoCV/LegoCV/Wrapper/Core/Mat/OCVMatDataAllocator.mm
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
