ndkでOpenCV2.3.1を使おうとしたところ,最初から全く進めないため相談させていただきました.
2つのプログラムについて質問です.
1つ目はOpenCVのサンプルであるtutorial-3-nativeについてです.
こちらをcygwinでndk-buildしたところ
$ ndk-build
Install :
libnative_camera_r2.2.2.so => libs/armeabi-v7a/
libnative_camera_r2.2.2.so
install: `./obj/local/armeabi-v7a/
libnative_camera_r2.2.2.so' を 読み込み用に開
くことが出来ません: Permission denied
/cygdrive/c/android-ndk-r8/build/core/
build-binary.mk:409: recipe for
target `libs/armeabi-v7a/
libnative_camera_r2.2.2.so' failed
make: *** [libs/armeabi-v7a/
libnative_camera_r2.2.2.so] Error 1
と表示されうまくいきません.インターネットで調べると皆さん問題なく出来ているようですが,
実機がつながってないとダメだということでしょうか.
sample-15-puzzleやsample-image-manipulationsは実行できました.キャリブレーションに使うような白黒画面
でしたが.
もう一つは
http://www.atmarkit.co.jp/fsmart/articles/armobile06/02.html
でダウンロードできるdetect_image_sampleをndk-buildしたときに起きる
$ ndk-build
Cygwin : Generating dependency file converter script
Compile++ thumb : native_sample <= jni_part.cpp
jni/jni_part.cpp:2:33: error: opencv2/core/core.hpp: No such file or
directory
jni/jni_part.cpp:3:39: error: opencv2/imgproc/imgproc.hpp: No such
file or directory
jni/jni_part.cpp:4:45: error: opencv2/features2d/features2d.hpp: No
such file or directory
jni/jni_part.cpp:13: error: 'cv' is not a namespace-name
jni/jni_part.cpp:13: error: expected namespace-name before ';' token
jni/jni_part.cpp:20: error: 'OrbFeatureDetector' does not name a type
jni/jni_part.cpp:21: error: 'OrbDescriptorExtractor' does not name a
type
jni/jni_part.cpp:23: error: expected constructor, destructor, or type
conversion before '<' token
jni/jni_part.cpp: In function 'void
Java_com_example_detectimage_DetectImageActivity_setTrainingImages(JNIEnv*,
_jobject*, _jintArray*, _jintArray*, _jobjectArray*, jint)':
jni/jni_part.cpp:33: error: 'Mat' was not declared in this scope
jni/jni_part.cpp:33: error: template argument 1 is invalid
jni/jni_part.cpp:33: error: template argument 2 is invalid
jni/jni_part.cpp:33: error: invalid type in declaration before ';'
token
jni/jni_part.cpp:34: error: 'KeyPoint' was not declared in this scope
jni/jni_part.cpp:34: error: template argument 1 is invalid
jni/jni_part.cpp:34: error: template argument 2 is invalid
jni/jni_part.cpp:34: error: invalid type in declaration before ';'
token
jni/jni_part.cpp:35: error: expected ';' before 'trainDescriptors'
jni/jni_part.cpp:43: error: expected ';' before 'mrgba'
jni/jni_part.cpp:45: error: expected ';' before 'gray'
jni/jni_part.cpp:46: error: 'mrgba' was not declared in this scope
jni/jni_part.cpp:46: error: 'gray' was not declared in this scope
jni/jni_part.cpp:46: error: 'CV_RGBA2GRAY' was not declared in this
scope
jni/jni_part.cpp:46: error: 'cvtColor' was not declared in this scope
jni/jni_part.cpp:48: error: 'detector' was not declared in this scope
jni/jni_part.cpp:49: error: 'extractor' was not declared in this scope
jni/jni_part.cpp:49: error: 'trainDescriptors' was not declared in
this scope
jni/jni_part.cpp:50: error: request for member 'push_back' in
'trainDescriptorses', which is of non-class type 'int'
jni/jni_part.cpp:52: error: 'matcher' was not declared in this scope
jni/jni_part.cpp: In function 'jint
Java_com_example_detectimage_CameraPreview_detectImage(JNIEnv*,
_jobject*, jint, jint, _jbyteArray*)':
jni/jni_part.cpp:61: error: 'KeyPoint' was not declared in this scope
jni/jni_part.cpp:61: error: template argument 1 is invalid
jni/jni_part.cpp:61: error: template argument 2 is invalid
jni/jni_part.cpp:61: error: invalid type in declaration before ';'
token
jni/jni_part.cpp:62: error: 'Mat' was not declared in this scope
jni/jni_part.cpp:62: error: expected ';' before 'queryDescriptors'
jni/jni_part.cpp:64: error: expected ';' before 'myuv'
jni/jni_part.cpp:65: error: expected ';' before 'mgray'
jni/jni_part.cpp:67: error: 'detector' was not declared in this scope
jni/jni_part.cpp:67: error: 'mgray' was not declared in this scope
jni/jni_part.cpp:68: error: 'extractor' was not declared in this scope
jni/jni_part.cpp:68: error: 'queryDescriptors' was not declared in
this scope
jni/jni_part.cpp:71: error: 'DMatch' was not declared in this scope
jni/jni_part.cpp:71: error: template argument 1 is invalid
jni/jni_part.cpp:71: error: template argument 2 is invalid
jni/jni_part.cpp:71: error: invalid type in declaration before ';'
token
jni/jni_part.cpp:72: error: 'matcher' was not declared in this scope
jni/jni_part.cpp:78: error: request for member 'size' in 'matches',
which is of non-class type 'int'
jni/jni_part.cpp:79: error: invalid types 'int[int]' for array
subscript
jni/jni_part.cpp:79: error: 'THRESHOLD' cannot appear in a constant-
expression
jni/jni_part.cpp:79: error: parse error in template argument list
jni/jni_part.cpp:80: error: invalid types 'int[int]' for array
subscript
jni/jni_part.cpp:94: error: 'Mat' cannot appear in a constant-
expression
jni/jni_part.cpp:94: error: template argument 1 is invalid
jni/jni_part.cpp:94: error: template argument 2 is invalid
jni/jni_part.cpp:94: error: invalid type in declaration before '='
token
jni/jni_part.cpp:96: error: invalid types 'int[int]' for array
subscript
/cygdrive/c/android-ndk-r8/build/core/
build-binary.mk:243: recipe for
target `obj/local/armeabi-v7a/objs/native_sample/jni_part.o' failed
make: *** [obj/local/armeabi-v7a/objs/native_sample/jni_part.o] Error
1
というものです.opencv2へのパスが通っていないためではないかと考えましたが,どう対処したらいいのかわかりません.
何がいけないのか,またはcppファイル内でOpenCVを使う方法を教えていただければ幸いです.
windows7でeclipse3.7を使用しています.
以上よろしくお願いいたします.