Ask Your Question

Ben Carpenter's profile - activity

2016-04-27 16:41:04 -0600 received badge  Enthusiast
2016-04-21 19:41:24 -0600 commented question videoCapture not opening correctly in iOS

I just found this stackoverflow post where someone had this same problem 2 years ago http://stackoverflow.com/questions/22.... Is openCV videoCapture from a file just completely non-functional on iOS?

2016-04-20 16:19:57 -0600 asked a question videoCapture not opening correctly in iOS

I am working on an iOS app that records video then does some processing on that video to create another video file. I'm getting really odd behavior from videoCapture though. It acts like the file has been opened but get() calls seem to return 1 for all the properties I care about (and I know they are not 1). My code looks like this:

VideoCapture cap(fileIn); // open the video file for reading

if ( !cap.isOpened() )  // if not success, exit program
  {
    cout << "Cannot open the video file" << endl;
    return -1;
  }
  else{
    cout << "File Open " << fileIn << endl;
  }

  double dFps = cap.get(CV_CAP_PROP_FPS); //get the frames per seconds of the video
  cout << "Frames per second = " << dFps << endl;

  double dWidth = cap.get(CV_CAP_PROP_FRAME_WIDTH); //get the width of frames of the video
  double dHeight = cap.get(CV_CAP_PROP_FRAME_HEIGHT); //get the height of frames of the video
  cout << "Frame Size = " << dWidth << "x" << dHeight << endl;

  Size frameSize(static_cast<int>(dWidth), static_cast<int>(dHeight));

  double dFrameCount = cap.get(CV_CAP_PROP_FRAME_COUNT);
  cout << "Frame count = " << dFrameCount << endl;

  VideoWriter oVideoWriter (fileOut, CV_FOURCC('m','p', '4', 'v'), dFps, frameSize, true); //initialize the VideoWriter object

  if ( !oVideoWriter.isOpened() ) //if not initialize the VideoWriter successfully, exit the program
  {
    cout << "ERROR: Failed to write the video" << endl;
    return -1;
  }
  else{
    cout << "Output file open." << endl;
  }

and the console output is:

File Open /var/mobile/Containers/Data/Application/7CEE8B87-BD50-4172-8F62-A74AD7F
3C45A/Documents/15318B74-07D9-43EE-932F-224EDCA9CDA7.mov
Frames per second = 1
Frame Size = 1x1
Frame count = 1
Output file open.

I tried changing the file path to an invalid file in case it wasn't finding the file at all but that gave me "Cannot open the video file". Any ideas would be appreciated. I'm thinking it could possibly be a permissions issue because I saw similar behavior when I tried to access a video in the camera roll with this code but this file is in my app's documents directory so I should have full access to it.

2016-04-19 11:34:38 -0600 asked a question iOS Compile Errors

I'm trying to load an app onto an ipad. It builds and runs fine in the simulator but when I try to load it on a real ipad and I get the following error using the 3.1 download from http://opencv.org/downloads.html: 'Undefined symbols for architecture arm64: "_png_init_filter_functions_neon", referenced from: _png_read_filter_row in opencv2(pngrutil.o)'

I have also tried the downloads for 3.0 and 2.4.11. They also work fine in the simulator but I get other errors when loading this to the ipad.

I saw this pull request that claims to have fixed the problem in January https://github.com/Itseez/opencv/pull... but when I try to do my own build so I would get this fix using the instructions from http://docs.opencv.org/2.4/doc/tutori... but I get even more compile errors there.

I'm stumped on what to try next. Any suggestions are welcome.