forked from arrayfire/arrayfire-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImage.java
More file actions
98 lines (80 loc) · 3.57 KB
/
Image.java
File metadata and controls
98 lines (80 loc) · 3.57 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package com.arrayfire;
public class Image extends Array {
private native static long erode (long a, long b);
private native static long dilate (long a, long b);
private native static long convolve (long a, long b);
private native static long medfilt (long a, int w, int h);
private native static long bilateral(long a, float space, float color);
private native static long meanshift(long a, float space, float color, int iter);
private native static long histogram(long a, int nbins);
private native static long hist_mnmx(long a, int nbins, float min, float max);
private native static long rotate (long a, float theta, boolean crop);
private native static long resize1 (long a, float scale, char method);
private native static long resize2 (long a, float scalex, float scaley, char method);
private native static long resize3 (long a, int height, int width, char method);
public Image() throws Exception { super(); }
public Image(int[] dims) throws Exception { super(dims); }
public Image(int[] dims, float[] elems) throws Exception { super(dims,elems); }
public static Image erode(Image a, Image b) throws Exception {
Image ret_val = new Image();
ret_val.ref = erode(a.ref,b.ref);
return ret_val;
}
public static Image dilate(Image a, Image b) throws Exception {
Image ret_val = new Image();
ret_val.ref = dilate(a.ref,b.ref);
return ret_val;
}
public static Image convolve(Image a, Image b) throws Exception {
Image ret_val = new Image();
ret_val.ref = convolve(a.ref,b.ref);
return ret_val;
}
public static Image medianfilter(Image a, int width, int height) throws Exception {
Image ret_val = new Image();
ret_val.ref = medfilt(a.ref,width,height);
return ret_val;
}
public static Image bilateral(Image a, float space, float color) throws Exception {
Image ret_val = new Image();
ret_val.ref = bilateral(a.ref,space,color);
return ret_val;
}
public static Image meanshift(Image a, float space, float color, int iterations) throws Exception {
Image ret_val = new Image();
ret_val.ref = meanshift(a.ref,space,color,iterations);
return ret_val;
}
public static Image histogram(Image a, int nbins) throws Exception {
Image ret_val = new Image();
ret_val.ref = histogram(a.ref,nbins);
return ret_val;
}
public static Image histogram(Image a, int nbins, float min, float max) throws Exception {
Image ret_val = new Image();
ret_val.ref = hist_mnmx(a.ref,nbins,min,max);
return ret_val;
}
public static Image rotate(Image a, float theta, boolean crop) throws Exception {
Image ret_val = new Image();
ret_val.ref = rotate(a.ref,theta,crop);
return ret_val;
}
// method ='L' - Linear interpolation
// or 'N' - Nearest neighbor
public static Image resize(Image a, float scale, char method) throws Exception {
Image ret_val = new Image();
ret_val.ref = resize1(a.ref,scale,method);
return ret_val;
}
public static Image resize(Image a, float scalex, float scaley, char method) throws Exception {
Image ret_val = new Image();
ret_val.ref = resize2(a.ref,scalex,scaley,method);
return ret_val;
}
public static Image resize(Image a, int height, int width, char method) throws Exception {
Image ret_val = new Image();
ret_val.ref = resize3(a.ref,height,width,method);
return ret_val;
}
}