1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* File : foobar.i */
%module OpenCV_SAMPLE
/*
* 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
*/
%pragma(java) jniclassimports=%{
import com.opencv.jni.*; //import the android-opencv jni wrappers
%}
%pragma(java) jniclasscode=%{
static {
try {
//load up our shared libraries
System.loadLibrary("android-opencv");
System.loadLibrary("OpenCV_SAMPLE");
} catch (UnsatisfiedLinkError e) {
//badness
throw e;
}
}
%}
//import the android-cv.i file so that swig is aware of all that has been previous defined
//notice that it is not an include....
%import "android-cv.i"
%{
#include "cvsample.h"
using cv::Mat;
%}
//make sure to import the image_pool as it is
//referenced by the Processor java generated
//class
%typemap(javaimports) CVSample "
import com.opencv.jni.*;// import the opencv java bindings
"
class CVSample
{
public:
void canny(const Mat& input, Mat& output, int edgeThresh);
void invert(Mat& inout);
void blur(Mat& inout, int half_kernel_size);
};