Modify OpenCV4Android source code

asked 2015-02-27 03:02:16 -0500

SARGE553413 gravatar image

updated 2015-02-27 03:09:45 -0500

I have to modify a functiont of OpenCVAandroid and re-build it, but for now, I want to add a new function that does something, for example return some value or print "hello world". This is only for testing. I'm working on windows.

I have try to compile a single OpenCV module (core). What I have done is to go to core folder location and run "cmake .", but I have an error:

CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present.  A line of code such as
cmake_minimum_required(VERSION 3.2)
should be added at the top of the file.
[...]
-- Configuring incomplete, errors occurred!
See also "E:/Mis documentos/git_repos/opencv_android/opencv-master/modules/core/
CMakeFiles/CMakeOutput.log".

Here my questions:

1 - Is there any way to compile only a part (module) of OpenCV instead of to built all library in each compilation?

2 - If the above is "yes", what are the steps I have to follow?

3 - Finally, the code I have to modify will be used from java. It means that, apart of modify c++ pure code, I have to modify the "jni part", and modify the proper .java file, is correct?

edit retag flag offensive close merge delete

Comments

1

1- probably not. if you e.g change something in the core module, anything depending on that will need an update, too.

2 - run cmake, make and make install, and let the tools do their job

3 - the java files are auto-generated, again - see 2.

4 - if you modify the Opencv4Android libs, your version will differ from what the OpenCVManager pulls in (e.g. on a different machine)

5 - can't you just add your own jni/java code to your app, instead of modifying the library ?

berak gravatar imageberak ( 2015-02-27 03:09:27 -0500 )edit

Ok, it means that I will have to wait for fewminutes in each compilation. When I start to modify the real function I have to modify, how can I make test with rapid compilations? Should I extract a little part of opencv to modify and test, and the re-add to library?

SARGE553413 gravatar imageSARGE553413 ( 2015-02-27 03:12:14 -0500 )edit

lean back. why modify the library at all ? that seems to be bad idea in the 1st place.

berak gravatar imageberak ( 2015-02-27 03:15:58 -0500 )edit

There is a function in mser module that returns values that I no need, I need to add a copy of this function without returning this not necessary information. I have to do it because if this function returns me, for example, (3, 5, 7), then I don't know which numbers are that I need, and which not. And yes, of course I only need to add some function that will be a modified copy of another, there is no problem with that.

SARGE553413 gravatar imageSARGE553413 ( 2015-02-27 03:24:49 -0500 )edit

So regarding 2 - what exactly should be typed in? When I follow the instructions here, the java files aren't auto-generated.

chinchee gravatar imagechinchee ( 2015-06-01 20:26:04 -0500 )edit

Hi guys. I built opencv4android but after the execution of "make install" command, a folder have been created named "install". in that folder instead of having a "java" folder I have a "bin" one and all the samples for android are missing. please can someone tells me how to generate the java file?

nanju gravatar imagenanju ( 2015-07-01 09:36:30 -0500 )edit