user2204574
user2204574

Reputation: 25

Building OpenCV4Android from trunk

I am now developing a application and plans to use native OpenCV library by jni approach. Reference this tutorial as my environment.

http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/O4A_SDK.html

To use the nonfree module of the OpenCV such as SurfFeatureDetector, I have to build opencv myself and use the tutorial from OpenCV website:

http://code.opencv.org/projects/opencv/wiki/Building_OpenCV4Android_from_trunk

When I follow the steps in tutorial (windows native part) and want to run script cmake_android.cmd to compile them, I get the error message like this:

In file included from E:\git\opencv\3rdparty\libtiff\tif_stream.cxx:30:
E:\git\opencv\3rdparty\libtiff\/tiffiop.h:54:21: error: search.h: No such file or directory
make[2]: *** [3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_stream.cxx.o] Error 1
make[1]: *** [3rdparty/libtiff/CMakeFiles/libtiff.dir/all] Error 2
make: *** [all] Error 2

Is there any way to solve this problem or make me able to use native OpenCV library with nonfree module in Android application?

Upvotes: 2

Views: 1116

Answers (3)

Nil Lu
Nil Lu

Reputation: 1

Compiler Opencv4android,libtiff is opened default. You can close it to complier the sdk because its thirdparty. search.h is not exist in NDK dir,but system path usr/include/ has one,so you compiler the sources for linux or mac,it works ok.

solution: 1、vi CMakeList.txt 2、Search "TIFF",/TIFF

edit

OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) )

to

OCV_OPTION(WITH_TIFF "Include TIFF support" OFF IF (NOT IOS) )

Done!

Upvotes: 0

r.d.
r.d.

Reputation: 26

I have this problem too. My fix was to install the latest version 2.4.5 ,and then to follow the tutorial. 1.Download clean 2.4.5 version and unzip it. 2.Follow tutorial. http://code.opencv.org/projects/opencv/wiki/Trunk_OpenCV_for_Android

This fixes the error that you have mentioned. I had after that another error that I don't remember now what it was,But I saw where the error is and I replaced the line with the line in script of version 2.4.2 and that was it(It's a small difference between them)

Upvotes: 1

Robert Wang
Robert Wang

Reputation: 1221

if you just want to use SIFT or SURF in the nonfree module, you don't need to rebuild the whole opencv package. You can only build nonfree module as a standalone library and use it in your project. This tutorial will give you details about how to do that.

Upvotes: 1

Related Questions