Ask Your Question

bskrt's profile - activity

2014-01-21 08:29:37 -0600 received badge  Teacher (source)
2014-01-21 05:34:43 -0600 received badge  Necromancer (source)
2014-01-20 15:27:45 -0600 answered a question CvVideoCamera on iOS7

I've been running into the same issue. I managed to fix it partially though.

I pulled the latest opencv version of github and rebuild the framework myself after editing the following: In "cap_ios_abstract_camera.mm" edit the stop method to the following:

- (void)stop;
{
     NSLog(@"[Camera] video stopped");
    running = NO;

    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;

    [self.captureSession stopRunning];
    [self.captureSession release];
    self.captureSession = nil;
    self.captureVideoPreviewLayer = nil;
    self.videoCaptureConnection = nil;
    captureSessionLoaded = NO;
}

The only difference with the original is [self.captureSession release] which seems to "properly" clean the AVCaptureSession. Memory usage is still rising slightly on each start/stop (might even be bad memory management in the rest of my code) but not exponentially like before this fix (which resulted into a crash).

(if you're having troubles building the opencv2.framework from source, you can always have a look at a previous answer of mine.)

Hope this helps!

2014-01-20 14:00:51 -0600 received badge  Critic (source)
2014-01-20 09:52:18 -0600 received badge  Editor (source)
2014-01-20 09:50:50 -0600 answered a question opencv ios7 installation issue

I managed to "fix" this (more like a hack really) by combining a couple of stackoverflow answers.

The issue I was having when following the building procedure you describe was related to "jmemansi.o" not being found. Following this tip fixed that issue.

Filtering out jmemansi.o from the linker input in modules/world/CMakeLists.txt:84:

Add ocv_list_filterout(objlist jmemansi) # <<= dirty fix

macro(ios_include_3party_libs)
  foreach(l ${ARGN})
    add_dependencies(${the_module} ${l})
    string(REGEX REPLACE "<MODULE_NAME>" "${l}" objpath1 "${CMAKE_BINARY_DIR}/3rdparty/${l}/${objpath0}")
    file(GLOB sources ${CMAKE_SOURCE_DIR}/3rdparty/${l}/*.c)
    foreach(srcname ${sources})
      if(IS_ABSOLUTE "${srcname}")
        file(RELATIVE_PATH srcname "${CMAKE_SOURCE_DIR}/3rdparty/${l}" "${srcname}")
      endif()

      string(REPLACE ".." "__" srcname "${srcname}")
      get_filename_component(srcname_we ${srcname} NAME_WE)
      string(REGEX REPLACE <SRC_NAME_WE> "${srcname_we}" objpath2 "${objpath1}")
      string(REGEX REPLACE <RELATIVE_SRC_NAME> "${srcname}" objpath3 "${objpath2}")

      list(APPEND objlist "\"${objpath3}\"")
    endforeach() # (srcname ${sources})
  endforeach()
  ocv_list_filterout(objlist jmemansi) # <<= dirty fix
endmacro()

The next issue I had was related to zlib:

implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration] if (close(state->fd) == -1)

I fixed this with this answer:

Add -Wno-implicit-function-declaration to your C_FLAGS ... this can be added to build_framework.py in the cmakeargs list as -DCMAKE_C_FLAGS=\"-Wno-implicit-function-declaration\"

cmakeargs = ("-GXcode " +
        "-DCMAKE_BUILD_TYPE=Release " +
        "-DCMAKE_C_FLAGS=\"-Wno-implicit-function-declaration\" " +
        "-DCMAKE_TOOLCHAIN_FILE=%s/platforms/ios/cmake/Toolchains/Toolchain-%s_Xcode.cmake " +
        "-DBUILD_opencv_world=ON " +
        "-DCMAKE_INSTALL_PREFIX=install") % (srcroot, target)

After those 2 dirty hacks everything built properly! Hope this helps, good luck!

(for reference: I built it on osx 10.9 on with xcode 5 command line tools) btw: most tests all seem to fail, but it works anyway, no clue why that's happening.