CVVideoCamera on iOS 7 (Bug #3389)


Added by Vo Long over 11 years ago. Updated almost 10 years ago.


Status:Done Start date:2013-11-20
Priority:Normal Due date:
Assignee:Alexander Shishkov % Done:

100%

Category:ios
Target version:2.4.10
Affected version:2.4.7 (latest release) Operating System:iOS
Difficulty: HW Platform:ARM
Pull request:

Description

Following the image detection, I'm calling [videoCamera stop]; when I detect an image then [videoCamera start]; if something when wrong during the retrieving image process on the main thread but the more I use stop and start function, the more my application become slow until my camera stop moving :S
Furthermore due to iOS7 I'm getting 4 warning when calling [videoCamera start] function due to deprecated method which are :
AVCaptureConnection - isVideoMinFrameDurationSupported
AVCaptureConnection - setVideoMinFrameDuration:
AVCaptureConnection - isVideoMaxFrameDurationSupported
AVCaptureConnection - setVideoMaxFrameDuration:
is something can be done for not getting CvVideoCamera slow?


OpenCV_Camera_Test.zip - minimum project demonstrating the issue (35.2 kB) Robert Nitsch, 2013-11-20 06:02 pm


Associated revisions

Revision da6898f7
Added by Vadim Pisarevsky over 10 years ago

Merge pull request #3389 from blackibiza84:master

Revision e9bc9c47
Added by Ehren Metcalfe almost 10 years ago

Fix resource leak with iOS camera due to failure to remove AVCaptureSession input/outputs on stop (Bug #3389)

Conflicts:
modules/highgui/src/cap_ios_abstract_camera.mm

History

Updated by Sergei Nosov over 11 years ago

Hi!

This sounds like a resource leak or smth. Could you, please, provide a very minimal piece of code which has the problem?

  • Status changed from New to Incomplete

Updated by Robert Nitsch over 11 years ago

I am dealing with that problem for a while now. Eventually I created a minimum project (see attachment) which reproduced the issue and thus proved that the problem is with OpenCV (or iOS), and not with my own code. By the way, the problem itself is not restricted to iOS7 (the deprecation warnings, of course, are).

This is a really bad issue... I have not been able to get any useful information out of Instruments. It seems there are millions of (very small) memory allocations going on... and the CPU usage goes up to 100% and memory usage grows exponentially.

Updated by Robert Nitsch over 11 years ago

  • Status changed from Incomplete to Open

Updated by Sergei Nosov over 11 years ago

Thx, Robert!

Alexander, could you, please try to reproduce the issue using the provided .zip?

Updated by Alexander Smorkalov about 11 years ago

  • Target version changed from 2.4.8 to 2.4.9

Updated by Andrew Kwiatkowski almost 11 years ago

Is something going on with that issue? It is very critical bug on iOS.

Updated by Alexander Smorkalov almost 11 years ago

  • Target version changed from 2.4.9 to 2.4.10

Updated by Ehren Metcalfe almost 11 years ago

I created pull request https://github.com/Itseez/opencv/pull/2816 for this.

Updated by Ramdhan Choudhary about 10 years ago

I am getting below deprecated error While trying to do Video Processing using OpenCV

-[<AVCaptureConnection: 0x70012bf0> isVideoMinFrameDurationSupported] is deprecated. Please use AVCaptureDevice activeFormat.videoSupportedFrameRateRanges

and

-[<AVCaptureConnection: 0x70012bf0> setVideoMaxFrameDuration:] is deprecated. Please use AVCaptureDevice setActiveVideoMaxFrameDuration

Here is code snip

self.videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView];
self.videoCamera.delegate = self;
//AVCaptureDevicePositionFront
self.videoCamera.defaultAVCaptureDevicePosition = AVCaptureDevicePositionBack;
self.videoCamera.defaultAVCaptureSessionPreset = AVCaptureSessionPreset352x288;
self.videoCamera.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationPortrait;
self.videoCamera.defaultFPS = 30;
self.videoCamera.grayscaleMode = NO;

Regrds,
Ramdhan Choudhary
iOS Developer

Updated by Philip L almost 10 years ago

setting this to done since the pr was merged please try again with latest version and reopen if needed.
Currently the PR which was provided here solves the problem for OpenCV 2.4.x.
OpenCV 3 should still have this problem. Will fix this in the next days.

  • Status changed from Open to Done
  • % Done changed from 0 to 100

Also available in: Atom PDF