swig 파일
/* File : android-cv.i */
%module cvcamera
/*
* the java import code muse be included for the opencv jni wrappers
* this means that the android project must reference opencv/android as a project
* see the default.properties for how this is done
*/
//생성된 자바파일에 import 됨
%pragma(java) jniclassimports=%{
import com.opencv.jni.*; //import the android-opencv jni wrappers
%}
//생성된 자바파일에 아래 내용이 추가 "static ~ throw e"
%pragma(java) jniclasscode=%{
static {
try {
//load the cvcamera library, make sure that libcvcamera.so is in your <project>/libs/armeabi directory
//so that android sdk automatically installs it along with the app.
//the android-opencv lib must be loaded first inorder for the cvcamera
//lib to be found
//check the apk generated, by opening it in an archive manager, to verify that
//both these libraries are present
System.loadLibrary("android-opencv");
System.loadLibrary("cvcamera");
} catch (UnsatisfiedLinkError e) {
//badness
throw e;
}
}
%}
//include the Processor class swig interface file
//Processor.i의 내용이 추가되어서 java파일을 생성함
%include "Processor.i"
<Processor.i>
//다음 내용을 노출시킴
class Processor {
public:
Processor();
virtual ~Processor();
void detectAndDrawFeatures(int idx, image_pool* pool, int feature_type);
bool detectAndDrawChessboard(int idx,image_pool* pool);
void resetChess();
int getNumberDetectedChessboards();
void calibrate(const char* filename);
void drawText(int idx, image_pool* pool, const char* text);
};