Real Time Processing with sampleBuffer (AVFoundation)

asked 2017-03-07 15:20:17 -0600

Hi,

I am trying to process the real-time camera images on iOS. In the didOutputSampleBuffer-Method of AVCaptureVideoDataOutputSampleBufferDelegate I am creating a matrix out of a sampleBuffer (which works without any problems). But when performing certain methods, such as cv::GaussianBlur, the app crashes because of "exc_bad_access code=1, address = 0x10......"

cv::Mat matrix(bufferHeight, bufferWidth, CV_8UC4, baseAddress);

cv::GaussianBlur(matrix, matrix, cvSize(5,5), 0); // Crahes here

My other question is: how can I update the "camera-view" with points returned from the open-cv-processing function? Currently, I am detecting rectangles and return the four points (one for each point). But when setting these as coordinates for a label, they are not refreshed immediately (takes a very long time...).

I hope my question is understandable :) Thanks for any help!

edit retag flag offensive close merge delete

Comments

Some ideas you could check:

  • are you sure you have a 4-channel image (CV_8UC4)?
  • do you free memory of buffer somewhere before doing GaussianBlur?
  • what happens if your output of GaussianBlur is a new/other Mat?
matman gravatar imagematman ( 2017-03-08 11:48:59 -0600 )edit