79 | * This function converts an Android Bitmap image to the OpenCV Mat.
80 | *
'ARGB_8888' and 'RGB_565' input Bitmap formats are supported.
81 | *
The output Mat is always created of the same size as the input Bitmap and of the 'CV_8UC4' type,
82 | * it keeps the image in RGBA format.
83 | *
This function throws an exception if the conversion fails.
84 | * @param bmp is a valid input Bitmap object of the type 'ARGB_8888' or 'RGB_565'.
85 | * @param mat is a valid output Mat object, it will be reallocated if needed, so it may be empty.
86 | * @param unPremultiplyAlpha is a flag, that determines, whether the bitmap needs to be converted from alpha premultiplied format (like Android keeps 'ARGB_8888' ones) to regular one; this flag is ignored for 'RGB_565' bitmaps.
87 | */
88 | public static void bitmapToMat(Bitmap bmp, Mat mat, boolean unPremultiplyAlpha) {
89 | if (bmp == null)
90 | throw new java.lang.IllegalArgumentException("bmp == null");
91 | if (mat == null)
92 | throw new java.lang.IllegalArgumentException("mat == null");
93 | nBitmapToMat2(bmp, mat.nativeObj, unPremultiplyAlpha);
94 | }
95 |
96 | /**
97 | * Short form of the bitmapToMat(bmp, mat, unPremultiplyAlpha=false).
98 | * @param bmp is a valid input Bitmap object of the type 'ARGB_8888' or 'RGB_565'.
99 | * @param mat is a valid output Mat object, it will be reallocated if needed, so Mat may be empty.
100 | */
101 | public static void bitmapToMat(Bitmap bmp, Mat mat) {
102 | bitmapToMat(bmp, mat, false);
103 | }
104 |
105 |
106 | /**
107 | * Converts OpenCV Mat to Android Bitmap.
108 | *
109 | *
This function converts an image in the OpenCV Mat representation to the Android Bitmap.
110 | *
The input Mat object has to be of the types 'CV_8UC1' (gray-scale), 'CV_8UC3' (RGB) or 'CV_8UC4' (RGBA).
111 | *
The output Bitmap object has to be of the same size as the input Mat and of the types 'ARGB_8888' or 'RGB_565'.
112 | *
This function throws an exception if the conversion fails.
113 | *
114 | * @param mat is a valid input Mat object of types 'CV_8UC1', 'CV_8UC3' or 'CV_8UC4'.
115 | * @param bmp is a valid Bitmap object of the same size as the Mat and of type 'ARGB_8888' or 'RGB_565'.
116 | * @param premultiplyAlpha is a flag, that determines, whether the Mat needs to be converted to alpha premultiplied format (like Android keeps 'ARGB_8888' bitmaps); the flag is ignored for 'RGB_565' bitmaps.
117 | */
118 | public static void matToBitmap(Mat mat, Bitmap bmp, boolean premultiplyAlpha) {
119 | if (mat == null)
120 | throw new java.lang.IllegalArgumentException("mat == null");
121 | if (bmp == null)
122 | throw new java.lang.IllegalArgumentException("bmp == null");
123 | nMatToBitmap2(mat.nativeObj, bmp, premultiplyAlpha);
124 | }
125 |
126 | /**
127 | * Short form of the matToBitmap(mat, bmp, premultiplyAlpha=false)
128 | * @param mat is a valid input Mat object of the types 'CV_8UC1', 'CV_8UC3' or 'CV_8UC4'.
129 | * @param bmp is a valid Bitmap object of the same size as the Mat and of type 'ARGB_8888' or 'RGB_565'.
130 | */
131 | public static void matToBitmap(Mat mat, Bitmap bmp) {
132 | matToBitmap(mat, bmp, false);
133 | }
134 |
135 |
136 | private static native void nBitmapToMat2(Bitmap b, long m_addr, boolean unPremultiplyAlpha);
137 |
138 | private static native void nMatToBitmap2(long m_addr, Bitmap b, boolean premultiplyAlpha);
139 | }
140 |
--------------------------------------------------------------------------------
/opencv/src/main/java/org/opencv/contrib/Contrib.java:
--------------------------------------------------------------------------------
1 |
2 | //
3 | // This file is auto-generated. Please don't modify it!
4 | //
5 | package org.opencv.contrib;
6 |
7 | import java.util.List;
8 | import org.opencv.core.Mat;
9 | import org.opencv.core.MatOfFloat;
10 | import org.opencv.core.MatOfPoint;
11 | import org.opencv.utils.Converters;
12 |
13 | public class Contrib {
14 |
15 | public static final int
16 | ROTATION = 1,
17 | TRANSLATION = 2,
18 | RIGID_BODY_MOTION = 4,
19 | COLORMAP_AUTUMN = 0,
20 | COLORMAP_BONE = 1,
21 | COLORMAP_JET = 2,
22 | COLORMAP_WINTER = 3,
23 | COLORMAP_RAINBOW = 4,
24 | COLORMAP_OCEAN = 5,
25 | COLORMAP_SUMMER = 6,
26 | COLORMAP_SPRING = 7,
27 | COLORMAP_COOL = 8,
28 | COLORMAP_HSV = 9,
29 | COLORMAP_PINK = 10,
30 | COLORMAP_HOT = 11,
31 | RETINA_COLOR_RANDOM = 0,
32 | RETINA_COLOR_DIAGONAL = 1,
33 | RETINA_COLOR_BAYER = 2;
34 |
35 |
36 | //
37 | // C++: void applyColorMap(Mat src, Mat& dst, int colormap)
38 | //
39 |
40 | /**
41 | *
Applies a GNU Octave/MATLAB equivalent colormap on a given image.
42 | * 43 | *Currently the following GNU Octave/MATLAB equivalent colormaps are
44 | * implemented: enum
// C++ code:
47 | * 48 | * 49 | *COLORMAP_AUTUMN = 0,
50 | * 51 | *COLORMAP_BONE = 1,
52 | * 53 | *COLORMAP_JET = 2,
54 | * 55 | *COLORMAP_WINTER = 3,
56 | * 57 | *COLORMAP_RAINBOW = 4,
58 | * 59 | *COLORMAP_OCEAN = 5,
60 | * 61 | *COLORMAP_SUMMER = 6,
62 | * 63 | *COLORMAP_SPRING = 7,
64 | * 65 | *COLORMAP_COOL = 8,
66 | * 67 | *COLORMAP_HSV = 9,
68 | * 69 | *COLORMAP_PINK = 10,
70 | * 71 | *COLORMAP_HOT = 11
72 | * 73 | * 74 | * @param src The source image, grayscale or colored does not matter. 75 | * @param dst The result is the colormapped source image. Note: "Mat.create" is 76 | * called on dst. 77 | * @param colormap The colormap to apply, see the list of available colormaps 78 | * below. 79 | * 80 | * @see org.opencv.contrib.Contrib.applyColorMap 81 | */ 82 | public static void applyColorMap(Mat src, Mat dst, int colormap) 83 | { 84 | 85 | applyColorMap_0(src.nativeObj, dst.nativeObj, colormap); 86 | 87 | return; 88 | } 89 | 90 | 91 | // 92 | // C++: int chamerMatching(Mat img, Mat templ, vector_vector_Point& results, vector_float& cost, double templScale = 1, int maxMatches = 20, double minMatchDistance = 1.0, int padX = 3, int padY = 3, int scales = 5, double minScale = 0.6, double maxScale = 1.6, double orientationWeight = 0.5, double truncate = 20) 93 | // 94 | 95 | public static int chamerMatching(Mat img, Mat templ, Listtemplate
// C++ code:
7 | * 8 | * 9 | *public:
10 | * 11 | *typedef _Tp value_type;
12 | * 13 | *// various constructors
14 | * 15 | *Point_();
16 | * 17 | *Point_(_Tp _x, _Tp _y);
18 | * 19 | *Point_(const Point_& pt);
20 | * 21 | *Point_(const CvPoint& pt);
22 | * 23 | *Point_(const CvPoint2D32f& pt);
24 | * 25 | *Point_(const Size_<_Tp>& sz);
26 | * 27 | *Point_(const Vec<_Tp, 2>& v);
28 | * 29 | *Point_& operator = (const Point_& pt);
30 | * 31 | *//! conversion to another data type
32 | * 33 | *template
//! conversion to the old-style C structures
36 | * 37 | *operator CvPoint() const;
38 | * 39 | *operator CvPoint2D32f() const;
40 | * 41 | *operator Vec<_Tp, 2>() const;
42 | * 43 | *//! dot product
44 | * 45 | *_Tp dot(const Point_& pt) const;
46 | * 47 | *//! dot product computed in double-precision arithmetics
48 | * 49 | *double ddot(const Point_& pt) const;
50 | * 51 | *//! cross-product
52 | * 53 | *double cross(const Point_& pt) const;
54 | * 55 | *//! checks whether the point is inside the specified rectangle
56 | * 57 | *bool inside(const Rect_<_Tp>& r) const;
58 | * 59 | *_Tp x, y; //< the point coordinates
60 | * 61 | *};
62 | * 63 | *Template class for 2D points specified by its coordinates
64 | * 65 | *x and y.
66 | * An instance of the class is interchangeable with C structures,
67 | * CvPoint
and CvPoint2D32f
. There is also a cast
68 | * operator to convert point coordinates to the specified type. The conversion
69 | * from floating-point coordinates to integer coordinates is done by rounding.
70 | * Commonly, the conversion uses thisoperation for each of the coordinates.
71 | * Besides the class members listed in the declaration above, the following
72 | * operations on points are implemented:
// C++ code:
75 | * 76 | *pt1 = pt2 + pt3;
77 | * 78 | *pt1 = pt2 - pt3;
79 | * 80 | *pt1 = pt2 * a;
81 | * 82 | *pt1 = a * pt2;
83 | * 84 | *pt1 += pt2;
85 | * 86 | *pt1 -= pt2;
87 | * 88 | *pt1 *= a;
89 | * 90 | *double value = norm(pt); // L2 norm
91 | * 92 | *pt1 == pt2;
93 | * 94 | *pt1 != pt2;
95 | * 96 | *For your convenience, the following type aliases are defined:
97 | * 98 | *typedef Point_
typedef Point2i Point;
101 | * 102 | *typedef Point_
typedef Point_
Example:
107 | * 108 | *Point2f a(0.3f, 0.f), b(0.f, 0.4f);
109 | * 110 | *Point pt = (a + b)*10.f;
111 | * 112 | *cout << pt.x << ", " << pt.y << endl;
113 | * 114 | * @see org.opencv.core.Point_ 115 | */ 116 | public class Point { 117 | 118 | public double x, y; 119 | 120 | public Point(double x, double y) { 121 | this.x = x; 122 | this.y = y; 123 | } 124 | 125 | public Point() { 126 | this(0, 0); 127 | } 128 | 129 | public Point(double[] vals) { 130 | this(); 131 | set(vals); 132 | } 133 | 134 | public void set(double[] vals) { 135 | if (vals != null) { 136 | x = vals.length > 0 ? vals[0] : 0; 137 | y = vals.length > 1 ? vals[1] : 0; 138 | } else { 139 | x = 0; 140 | y = 0; 141 | } 142 | } 143 | 144 | public Point clone() { 145 | return new Point(x, y); 146 | } 147 | 148 | public double dot(Point p) { 149 | return x * p.x + y * p.y; 150 | } 151 | 152 | @Override 153 | public int hashCode() { 154 | final int prime = 31; 155 | int result = 1; 156 | long temp; 157 | temp = Double.doubleToLongBits(x); 158 | result = prime * result + (int) (temp ^ (temp >>> 32)); 159 | temp = Double.doubleToLongBits(y); 160 | result = prime * result + (int) (temp ^ (temp >>> 32)); 161 | return result; 162 | } 163 | 164 | @Override 165 | public boolean equals(Object obj) { 166 | if (this == obj) return true; 167 | if (!(obj instanceof Point)) return false; 168 | Point it = (Point) obj; 169 | return x == it.x && y == it.y; 170 | } 171 | 172 | public boolean inside(Rect r) { 173 | return r.contains(this); 174 | } 175 | 176 | @Override 177 | public String toString() { 178 | return "{" + x + ", " + y + "}"; 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/core/Point3.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | /** 4 | *template
// C++ code:
7 | * 8 | * 9 | *public:
10 | * 11 | *typedef _Tp value_type;
12 | * 13 | *// various constructors
14 | * 15 | *Point3_();
16 | * 17 | *Point3_(_Tp _x, _Tp _y, _Tp _z);
18 | * 19 | *Point3_(const Point3_& pt);
20 | * 21 | *explicit Point3_(const Point_<_Tp>& pt);
22 | * 23 | *Point3_(const CvPoint3D32f& pt);
24 | * 25 | *Point3_(const Vec<_Tp, 3>& v);
26 | * 27 | *Point3_& operator = (const Point3_& pt);
28 | * 29 | *//! conversion to another data type
30 | * 31 | *template
//! conversion to the old-style CvPoint...
34 | * 35 | *operator CvPoint3D32f() const;
36 | * 37 | *//! conversion to cv.Vec<>
38 | * 39 | *operator Vec<_Tp, 3>() const;
40 | * 41 | *//! dot product
42 | * 43 | *_Tp dot(const Point3_& pt) const;
44 | * 45 | *//! dot product computed in double-precision arithmetics
46 | * 47 | *double ddot(const Point3_& pt) const;
48 | * 49 | *//! cross product of the 2 3D points
50 | * 51 | *Point3_ cross(const Point3_& pt) const;
52 | * 53 | *_Tp x, y, z; //< the point coordinates
54 | * 55 | *};
56 | * 57 | *Template class for 3D points specified by its coordinates
58 | * 59 | *x, y and z.
60 | * An instance of the class is interchangeable with the C structure
61 | * CvPoint2D32f
. Similarly to Point_
, the coordinates
62 | * of 3D points can be converted to another type. The vector arithmetic and
63 | * comparison operations are also supported.
64 | * The following Point3_<>
aliases are available:
// C++ code:
67 | * 68 | *typedef Point3_
typedef Point3_
typedef Point3_
Template class specifying a continuous subsequence (slice) of a sequence.
5 | * 6 | *class CV_EXPORTS Range
// C++ code:
9 | * 10 | * 11 | *public:
12 | * 13 | *Range();
14 | * 15 | *Range(int _start, int _end);
16 | * 17 | *Range(const CvSlice& slice);
18 | * 19 | *int size() const;
20 | * 21 | *bool empty() const;
22 | * 23 | *static Range all();
24 | * 25 | *operator CvSlice() const;
26 | * 27 | *int start, end;
28 | * 29 | *};
30 | * 31 | *The class is used to specify a row or a column span in a matrix (
32 | * 33 | *"Mat") and for many other purposes. Range(a,b)
is basically the
34 | * same as a:b
in Matlab or a..b
in Python. As in
35 | * Python, start
is an inclusive left boundary of the range and
36 | * end
is an exclusive right boundary of the range. Such a
37 | * half-opened interval is usually denoted as [start,end).
38 | * The static method Range.all()
returns a special variable that
39 | * means "the whole sequence" or "the whole range", just like " :
"
40 | * in Matlab or " ...
" in Python. All the methods and functions in
41 | * OpenCV that take Range
support this special Range.all()
42 | * value. But, of course, in case of your own custom processing, you will
43 | * probably have to check and handle it explicitly:
// C++ code:
46 | * 47 | *void my_function(..., const Range& r,....)
48 | * 49 | * 50 | *if(r == Range.all()) {
51 | * 52 | *// process all the data
53 | * 54 | * 55 | *else {
56 | * 57 | *// process [r.start, r.end)
58 | * 59 | * 60 | * 61 | * 62 | * 63 | * @see org.opencv.core.Range 64 | */ 65 | public class Range { 66 | 67 | public int start, end; 68 | 69 | public Range(int s, int e) { 70 | this.start = s; 71 | this.end = e; 72 | } 73 | 74 | public Range() { 75 | this(0, 0); 76 | } 77 | 78 | public Range(double[] vals) { 79 | set(vals); 80 | } 81 | 82 | public void set(double[] vals) { 83 | if (vals != null) { 84 | start = vals.length > 0 ? (int) vals[0] : 0; 85 | end = vals.length > 1 ? (int) vals[1] : 0; 86 | } else { 87 | start = 0; 88 | end = 0; 89 | } 90 | 91 | } 92 | 93 | public int size() { 94 | return empty() ? 0 : end - start; 95 | } 96 | 97 | public boolean empty() { 98 | return end <= start; 99 | } 100 | 101 | public static Range all() { 102 | return new Range(Integer.MIN_VALUE, Integer.MAX_VALUE); 103 | } 104 | 105 | public Range intersection(Range r1) { 106 | Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end)); 107 | r.end = Math.max(r.end, r.start); 108 | return r; 109 | } 110 | 111 | public Range shift(int delta) { 112 | return new Range(start + delta, end + delta); 113 | } 114 | 115 | public Range clone() { 116 | return new Range(start, end); 117 | } 118 | 119 | @Override 120 | public int hashCode() { 121 | final int prime = 31; 122 | int result = 1; 123 | long temp; 124 | temp = Double.doubleToLongBits(start); 125 | result = prime * result + (int) (temp ^ (temp >>> 32)); 126 | temp = Double.doubleToLongBits(end); 127 | result = prime * result + (int) (temp ^ (temp >>> 32)); 128 | return result; 129 | } 130 | 131 | @Override 132 | public boolean equals(Object obj) { 133 | if (this == obj) return true; 134 | if (!(obj instanceof Range)) return false; 135 | Range it = (Range) obj; 136 | return start == it.start && end == it.end; 137 | } 138 | 139 | @Override 140 | public String toString() { 141 | return "[" + start + ", " + end + ")"; 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/core/RotatedRect.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | public class RotatedRect { 4 | 5 | public Point center; 6 | public Size size; 7 | public double angle; 8 | 9 | public RotatedRect() { 10 | this.center = new Point(); 11 | this.size = new Size(); 12 | this.angle = 0; 13 | } 14 | 15 | public RotatedRect(Point c, Size s, double a) { 16 | this.center = c.clone(); 17 | this.size = s.clone(); 18 | this.angle = a; 19 | } 20 | 21 | public RotatedRect(double[] vals) { 22 | this(); 23 | set(vals); 24 | } 25 | 26 | public void set(double[] vals) { 27 | if (vals != null) { 28 | center.x = vals.length > 0 ? (double) vals[0] : 0; 29 | center.y = vals.length > 1 ? (double) vals[1] : 0; 30 | size.width = vals.length > 2 ? (double) vals[2] : 0; 31 | size.height = vals.length > 3 ? (double) vals[3] : 0; 32 | angle = vals.length > 4 ? (double) vals[4] : 0; 33 | } else { 34 | center.x = 0; 35 | center.x = 0; 36 | size.width = 0; 37 | size.height = 0; 38 | angle = 0; 39 | } 40 | } 41 | 42 | public void points(Point pt[]) 43 | { 44 | double _angle = angle * Math.PI / 180.0; 45 | double b = (double) Math.cos(_angle) * 0.5f; 46 | double a = (double) Math.sin(_angle) * 0.5f; 47 | 48 | pt[0] = new Point( 49 | center.x - a * size.height - b * size.width, 50 | center.y + b * size.height - a * size.width); 51 | 52 | pt[1] = new Point( 53 | center.x + a * size.height - b * size.width, 54 | center.y - b * size.height - a * size.width); 55 | 56 | pt[2] = new Point( 57 | 2 * center.x - pt[0].x, 58 | 2 * center.y - pt[0].y); 59 | 60 | pt[3] = new Point( 61 | 2 * center.x - pt[1].x, 62 | 2 * center.y - pt[1].y); 63 | } 64 | 65 | public Rect boundingRect() 66 | { 67 | Point pt[] = new Point[4]; 68 | points(pt); 69 | Rect r = new Rect((int) Math.floor(Math.min(Math.min(Math.min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)), 70 | (int) Math.floor(Math.min(Math.min(Math.min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)), 71 | (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)), 72 | (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].y, pt[1].y), pt[2].y), pt[3].y))); 73 | r.width -= r.x - 1; 74 | r.height -= r.y - 1; 75 | return r; 76 | } 77 | 78 | public RotatedRect clone() { 79 | return new RotatedRect(center, size, angle); 80 | } 81 | 82 | @Override 83 | public int hashCode() { 84 | final int prime = 31; 85 | int result = 1; 86 | long temp; 87 | temp = Double.doubleToLongBits(center.x); 88 | result = prime * result + (int) (temp ^ (temp >>> 32)); 89 | temp = Double.doubleToLongBits(center.y); 90 | result = prime * result + (int) (temp ^ (temp >>> 32)); 91 | temp = Double.doubleToLongBits(size.width); 92 | result = prime * result + (int) (temp ^ (temp >>> 32)); 93 | temp = Double.doubleToLongBits(size.height); 94 | result = prime * result + (int) (temp ^ (temp >>> 32)); 95 | temp = Double.doubleToLongBits(angle); 96 | result = prime * result + (int) (temp ^ (temp >>> 32)); 97 | return result; 98 | } 99 | 100 | @Override 101 | public boolean equals(Object obj) { 102 | if (this == obj) return true; 103 | if (!(obj instanceof RotatedRect)) return false; 104 | RotatedRect it = (RotatedRect) obj; 105 | return center.equals(it.center) && size.equals(it.size) && angle == it.angle; 106 | } 107 | 108 | @Override 109 | public String toString() { 110 | return "{ " + center + " " + size + " * " + angle + " }"; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/core/Scalar.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | /** 4 | *Template class for a 4-element vector derived from Vec.
5 | * 6 | *template
// C++ code:
9 | * 10 | * 11 | *public:
12 | * 13 | *//! various constructors
14 | * 15 | *Scalar_();
16 | * 17 | *Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0);
18 | * 19 | *Scalar_(const CvScalar& s);
20 | * 21 | *Scalar_(_Tp v0);
22 | * 23 | *//! returns a scalar with all elements set to v0
24 | * 25 | *static Scalar_<_Tp> all(_Tp v0);
26 | * 27 | *//! conversion to the old-style CvScalar
28 | * 29 | *operator CvScalar() const;
30 | * 31 | *//! conversion to another data type
32 | * 33 | *template
//! per-element product
36 | * 37 | *Scalar_<_Tp> mul(const Scalar_<_Tp>& t, double scale=1) const;
38 | * 39 | *// returns (v0, -v1, -v2, -v3)
40 | * 41 | *Scalar_<_Tp> conj() const;
42 | * 43 | *// returns true iff v1 == v2 == v3 == 0
44 | * 45 | *bool isReal() const;
46 | * 47 | *};
48 | * 49 | *typedef Scalar_
Being derived from Vec<_Tp, 4>
, Scalar_
and
52 | * Scalar
can be used just as typical 4-element vectors. In
53 | * addition, they can be converted to/from CvScalar
. The type
54 | * Scalar
is widely used in OpenCV to pass pixel values.
55 | *
template
// C++ code:
7 | * 8 | * 9 | *public:
10 | * 11 | *typedef _Tp value_type;
12 | * 13 | *//! various constructors
14 | * 15 | *Size_();
16 | * 17 | *Size_(_Tp _width, _Tp _height);
18 | * 19 | *Size_(const Size_& sz);
20 | * 21 | *Size_(const CvSize& sz);
22 | * 23 | *Size_(const CvSize2D32f& sz);
24 | * 25 | *Size_(const Point_<_Tp>& pt);
26 | * 27 | *Size_& operator = (const Size_& sz);
28 | * 29 | *//! the area (width*height)
30 | * 31 | *_Tp area() const;
32 | * 33 | *//! conversion of another data type.
34 | * 35 | *template
//! conversion to the old-style OpenCV types
38 | * 39 | *operator CvSize() const;
40 | * 41 | *operator CvSize2D32f() const;
42 | * 43 | *_Tp width, height; // the width and the height
44 | * 45 | *};
46 | * 47 | *Template class for specifying the size of an image or rectangle. The class
48 | * includes two members called width
and height
. The
49 | * structure can be converted to and from the old OpenCV structures
CvSize
and CvSize2D32f
. The same set of arithmetic
52 | * and comparison operations as for Point_
is available.
53 | * OpenCV defines the following Size_<>
aliases:
// C++ code:
56 | * 57 | *typedef Size_
typedef Size2i Size;
60 | * 61 | *typedef Size_
class CV_EXPORTS TermCriteria
// C++ code:
7 | * 8 | * 9 | *public:
10 | * 11 | *enum
12 | * 13 | * 14 | *COUNT=1, //!< the maximum number of iterations or elements to compute
15 | * 16 | *MAX_ITER=COUNT, //!< ditto
17 | * 18 | *EPS=2 //!< the desired accuracy or change in parameters at which the 19 | * iterative algorithm stops
20 | * 21 | *};
22 | * 23 | *//! default constructor
24 | * 25 | *TermCriteria();
26 | * 27 | *//! full constructor
28 | * 29 | *TermCriteria(int type, int maxCount, double epsilon);
30 | * 31 | *//! conversion from CvTermCriteria
32 | * 33 | *TermCriteria(const CvTermCriteria& criteria);
34 | * 35 | *//! conversion to CvTermCriteria
36 | * 37 | *operator CvTermCriteria() const;
38 | * 39 | *int type; //!< the type of termination criteria: COUNT, EPS or COUNT + EPS
40 | * 41 | *int maxCount; // the maximum number of iterations/elements
42 | * 43 | *double epsilon; // the desired accuracy
44 | * 45 | *};
46 | * 47 | *The class defining termination criteria for iterative algorithms. You can 48 | * initialize it by default constructor and then override any parameters, or the 49 | * structure may be fully initialized using the advanced variant of the 50 | * constructor. 51 | *
52 | * 53 | * @see org.opencv.core.TermCriteria 54 | */ 55 | public class TermCriteria { 56 | 57 | /** 58 | * The maximum number of iterations or elements to compute 59 | */ 60 | public static final int COUNT = 1; 61 | /** 62 | * The maximum number of iterations or elements to compute 63 | */ 64 | public static final int MAX_ITER = COUNT; 65 | /** 66 | * The desired accuracy threshold or change in parameters at which the iterative algorithm is terminated. 67 | */ 68 | public static final int EPS = 2; 69 | 70 | public int type; 71 | public int maxCount; 72 | public double epsilon; 73 | 74 | /** 75 | * Termination criteria for iterative algorithms. 76 | * 77 | * @param type 78 | * the type of termination criteria: COUNT, EPS or COUNT + EPS. 79 | * @param maxCount 80 | * the maximum number of iterations/elements. 81 | * @param epsilon 82 | * the desired accuracy. 83 | */ 84 | public TermCriteria(int type, int maxCount, double epsilon) { 85 | this.type = type; 86 | this.maxCount = maxCount; 87 | this.epsilon = epsilon; 88 | } 89 | 90 | /** 91 | * Termination criteria for iterative algorithms. 92 | */ 93 | public TermCriteria() { 94 | this(0, 0, 0.0); 95 | } 96 | 97 | public TermCriteria(double[] vals) { 98 | set(vals); 99 | } 100 | 101 | public void set(double[] vals) { 102 | if (vals != null) { 103 | type = vals.length > 0 ? (int) vals[0] : 0; 104 | maxCount = vals.length > 1 ? (int) vals[1] : 0; 105 | epsilon = vals.length > 2 ? (double) vals[2] : 0; 106 | } else { 107 | type = 0; 108 | maxCount = 0; 109 | epsilon = 0; 110 | } 111 | } 112 | 113 | public TermCriteria clone() { 114 | return new TermCriteria(type, maxCount, epsilon); 115 | } 116 | 117 | @Override 118 | public int hashCode() { 119 | final int prime = 31; 120 | int result = 1; 121 | long temp; 122 | temp = Double.doubleToLongBits(type); 123 | result = prime * result + (int) (temp ^ (temp >>> 32)); 124 | temp = Double.doubleToLongBits(maxCount); 125 | result = prime * result + (int) (temp ^ (temp >>> 32)); 126 | temp = Double.doubleToLongBits(epsilon); 127 | result = prime * result + (int) (temp ^ (temp >>> 32)); 128 | return result; 129 | } 130 | 131 | @Override 132 | public boolean equals(Object obj) { 133 | if (this == obj) return true; 134 | if (!(obj instanceof TermCriteria)) return false; 135 | TermCriteria it = (TermCriteria) obj; 136 | return type == it.type && maxCount == it.maxCount && epsilon == it.epsilon; 137 | } 138 | 139 | @Override 140 | public String toString() { 141 | return "{ type: " + type + ", maxCount: " + maxCount + ", epsilon: " + epsilon + "}"; 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/features2d/DMatch.java: -------------------------------------------------------------------------------- 1 | package org.opencv.features2d; 2 | 3 | //C++: class DMatch 4 | 5 | /** 6 | * Structure for matching: query descriptor index, train descriptor index, train 7 | * image index and distance between descriptors. 8 | */ 9 | public class DMatch { 10 | 11 | /** 12 | * Query descriptor index. 13 | */ 14 | public int queryIdx; 15 | /** 16 | * Train descriptor index. 17 | */ 18 | public int trainIdx; 19 | /** 20 | * Train image index. 21 | */ 22 | public int imgIdx; 23 | 24 | public float distance; 25 | 26 | public DMatch() { 27 | this(-1, -1, Float.MAX_VALUE); 28 | } 29 | 30 | public DMatch(int _queryIdx, int _trainIdx, float _distance) { 31 | queryIdx = _queryIdx; 32 | trainIdx = _trainIdx; 33 | imgIdx = -1; 34 | distance = _distance; 35 | } 36 | 37 | public DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance) { 38 | queryIdx = _queryIdx; 39 | trainIdx = _trainIdx; 40 | imgIdx = _imgIdx; 41 | distance = _distance; 42 | } 43 | 44 | /** 45 | * Less is better. 46 | */ 47 | public boolean lessThan(DMatch it) { 48 | return distance < it.distance; 49 | } 50 | 51 | @Override 52 | public String toString() { 53 | return "DMatch [queryIdx=" + queryIdx + ", trainIdx=" + trainIdx 54 | + ", imgIdx=" + imgIdx + ", distance=" + distance + "]"; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/features2d/KeyPoint.java: -------------------------------------------------------------------------------- 1 | package org.opencv.features2d; 2 | 3 | import org.opencv.core.Point; 4 | 5 | /** 6 | *Data structure for salient point detectors.
7 | * 8 | *coordinates of the keypoint
9 | * 10 | *diameter of the meaningful keypoint neighborhood
// C++ code:
13 | * 14 | *computed orientation of the keypoint (-1 if not applicable). Its possible 15 | * values are in a range [0,360) degrees. It is measured relative to image 16 | * coordinate system (y-axis is directed downward), ie in clockwise.
17 | * 18 | *the response by which the most strong keypoints have been selected. Can be 19 | * used for further sorting or subsampling
20 | * 21 | *octave (pyramid layer) from which the keypoint has been extracted
22 | * 23 | *object id that can be used to clustered keypoints by an object they belong to
24 | * 25 | * @see org.opencv.features2d.KeyPoint 26 | */ 27 | public class KeyPoint { 28 | 29 | /** 30 | * Coordinates of the keypoint. 31 | */ 32 | public Point pt; 33 | /** 34 | * Diameter of the useful keypoint adjacent area. 35 | */ 36 | public float size; 37 | /** 38 | * Computed orientation of the keypoint (-1 if not applicable). 39 | */ 40 | public float angle; 41 | /** 42 | * The response, by which the strongest keypoints have been selected. Can 43 | * be used for further sorting or subsampling. 44 | */ 45 | public float response; 46 | /** 47 | * Octave (pyramid layer), from which the keypoint has been extracted. 48 | */ 49 | public int octave; 50 | /** 51 | * Object ID, that can be used to cluster keypoints by an object they 52 | * belong to. 53 | */ 54 | public int class_id; 55 | 56 | /** 57 | *The keypoint constructors
58 | * 59 | * @param x x-coordinate of the keypoint 60 | * @param y y-coordinate of the keypoint 61 | * @param _size keypoint diameter 62 | * @param _angle keypoint orientation 63 | * @param _response keypoint detector response on the keypoint (that is, 64 | * strength of the keypoint) 65 | * @param _octave pyramid octave in which the keypoint has been detected 66 | * @param _class_id object id 67 | * 68 | * @see org.opencv.features2d.KeyPoint.KeyPoint 69 | */ 70 | public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id) 71 | { 72 | pt = new Point(x, y); 73 | size = _size; 74 | angle = _angle; 75 | response = _response; 76 | octave = _octave; 77 | class_id = _class_id; 78 | } 79 | 80 | /** 81 | *The keypoint constructors
82 | * 83 | * @see org.opencv.features2d.KeyPoint.KeyPoint 84 | */ 85 | public KeyPoint() 86 | { 87 | this(0, 0, 0, -1, 0, 0, -1); 88 | } 89 | 90 | /** 91 | *The keypoint constructors
92 | * 93 | * @param x x-coordinate of the keypoint 94 | * @param y y-coordinate of the keypoint 95 | * @param _size keypoint diameter 96 | * @param _angle keypoint orientation 97 | * @param _response keypoint detector response on the keypoint (that is, 98 | * strength of the keypoint) 99 | * @param _octave pyramid octave in which the keypoint has been detected 100 | * 101 | * @see org.opencv.features2d.KeyPoint.KeyPoint 102 | */ 103 | public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave) 104 | { 105 | this(x, y, _size, _angle, _response, _octave, -1); 106 | } 107 | 108 | /** 109 | *The keypoint constructors
110 | * 111 | * @param x x-coordinate of the keypoint 112 | * @param y y-coordinate of the keypoint 113 | * @param _size keypoint diameter 114 | * @param _angle keypoint orientation 115 | * @param _response keypoint detector response on the keypoint (that is, 116 | * strength of the keypoint) 117 | * 118 | * @see org.opencv.features2d.KeyPoint.KeyPoint 119 | */ 120 | public KeyPoint(float x, float y, float _size, float _angle, float _response) 121 | { 122 | this(x, y, _size, _angle, _response, 0, -1); 123 | } 124 | 125 | /** 126 | *The keypoint constructors
127 | * 128 | * @param x x-coordinate of the keypoint 129 | * @param y y-coordinate of the keypoint 130 | * @param _size keypoint diameter 131 | * @param _angle keypoint orientation 132 | * 133 | * @see org.opencv.features2d.KeyPoint.KeyPoint 134 | */ 135 | public KeyPoint(float x, float y, float _size, float _angle) 136 | { 137 | this(x, y, _size, _angle, 0, 0, -1); 138 | } 139 | 140 | /** 141 | *The keypoint constructors
142 | * 143 | * @param x x-coordinate of the keypoint 144 | * @param y y-coordinate of the keypoint 145 | * @param _size keypoint diameter 146 | * 147 | * @see org.opencv.features2d.KeyPoint.KeyPoint 148 | */ 149 | public KeyPoint(float x, float y, float _size) 150 | { 151 | this(x, y, _size, -1, 0, 0, -1); 152 | } 153 | 154 | @Override 155 | public String toString() { 156 | return "KeyPoint [pt=" + pt + ", size=" + size + ", angle=" + angle 157 | + ", response=" + response + ", octave=" + octave 158 | + ", class_id=" + class_id + "]"; 159 | } 160 | 161 | } 162 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/gpu/DeviceInfo.java: -------------------------------------------------------------------------------- 1 | package org.opencv.gpu; 2 | 3 | import java.lang.String; 4 | 5 | // C++: class DeviceInfo 6 | public class DeviceInfo { 7 | 8 | protected final long nativeObj; 9 | protected DeviceInfo(long addr) { nativeObj = addr; } 10 | 11 | 12 | // 13 | // C++: DeviceInfo::DeviceInfo() 14 | // 15 | 16 | public DeviceInfo() 17 | { 18 | 19 | nativeObj = DeviceInfo_0(); 20 | 21 | return; 22 | } 23 | 24 | 25 | // 26 | // C++: DeviceInfo::DeviceInfo(int device_id) 27 | // 28 | 29 | public DeviceInfo(int device_id) 30 | { 31 | 32 | nativeObj = DeviceInfo_1(device_id); 33 | 34 | return; 35 | } 36 | 37 | 38 | // 39 | // C++: int DeviceInfo::deviceID() 40 | // 41 | 42 | public int deviceID() 43 | { 44 | 45 | int retVal = deviceID_0(nativeObj); 46 | 47 | return retVal; 48 | } 49 | 50 | 51 | // 52 | // C++: size_t DeviceInfo::freeMemory() 53 | // 54 | 55 | public long freeMemory() 56 | { 57 | 58 | long retVal = freeMemory_0(nativeObj); 59 | 60 | return retVal; 61 | } 62 | 63 | 64 | // 65 | // C++: bool DeviceInfo::isCompatible() 66 | // 67 | 68 | public boolean isCompatible() 69 | { 70 | 71 | boolean retVal = isCompatible_0(nativeObj); 72 | 73 | return retVal; 74 | } 75 | 76 | 77 | // 78 | // C++: int DeviceInfo::majorVersion() 79 | // 80 | 81 | public int majorVersion() 82 | { 83 | 84 | int retVal = majorVersion_0(nativeObj); 85 | 86 | return retVal; 87 | } 88 | 89 | 90 | // 91 | // C++: int DeviceInfo::minorVersion() 92 | // 93 | 94 | public int minorVersion() 95 | { 96 | 97 | int retVal = minorVersion_0(nativeObj); 98 | 99 | return retVal; 100 | } 101 | 102 | 103 | // 104 | // C++: int DeviceInfo::multiProcessorCount() 105 | // 106 | 107 | public int multiProcessorCount() 108 | { 109 | 110 | int retVal = multiProcessorCount_0(nativeObj); 111 | 112 | return retVal; 113 | } 114 | 115 | 116 | // 117 | // C++: string DeviceInfo::name() 118 | // 119 | 120 | public String name() 121 | { 122 | 123 | String retVal = name_0(nativeObj); 124 | 125 | return retVal; 126 | } 127 | 128 | 129 | // 130 | // C++: void DeviceInfo::queryMemory(size_t& totalMemory, size_t& freeMemory) 131 | // 132 | 133 | public void queryMemory(long totalMemory, long freeMemory) 134 | { 135 | double[] totalMemory_out = new double[1]; 136 | double[] freeMemory_out = new double[1]; 137 | queryMemory_0(nativeObj, totalMemory_out, freeMemory_out); 138 | totalMemory = (long)totalMemory_out[0]; 139 | freeMemory = (long)freeMemory_out[0]; 140 | } 141 | 142 | 143 | // 144 | // C++: size_t DeviceInfo::sharedMemPerBlock() 145 | // 146 | 147 | public long sharedMemPerBlock() 148 | { 149 | 150 | long retVal = sharedMemPerBlock_0(nativeObj); 151 | 152 | return retVal; 153 | } 154 | 155 | 156 | // 157 | // C++: bool DeviceInfo::supports(int feature_set) 158 | // 159 | 160 | public boolean supports(int feature_set) 161 | { 162 | 163 | boolean retVal = supports_0(nativeObj, feature_set); 164 | 165 | return retVal; 166 | } 167 | 168 | 169 | // 170 | // C++: size_t DeviceInfo::totalMemory() 171 | // 172 | 173 | public long totalMemory() 174 | { 175 | 176 | long retVal = totalMemory_0(nativeObj); 177 | 178 | return retVal; 179 | } 180 | 181 | 182 | @Override 183 | protected void finalize() throws Throwable { 184 | delete(nativeObj); 185 | } 186 | 187 | 188 | 189 | // C++: DeviceInfo::DeviceInfo() 190 | private static native long DeviceInfo_0(); 191 | 192 | // C++: DeviceInfo::DeviceInfo(int device_id) 193 | private static native long DeviceInfo_1(int device_id); 194 | 195 | // C++: int DeviceInfo::deviceID() 196 | private static native int deviceID_0(long nativeObj); 197 | 198 | // C++: size_t DeviceInfo::freeMemory() 199 | private static native long freeMemory_0(long nativeObj); 200 | 201 | // C++: bool DeviceInfo::isCompatible() 202 | private static native boolean isCompatible_0(long nativeObj); 203 | 204 | // C++: int DeviceInfo::majorVersion() 205 | private static native int majorVersion_0(long nativeObj); 206 | 207 | // C++: int DeviceInfo::minorVersion() 208 | private static native int minorVersion_0(long nativeObj); 209 | 210 | // C++: int DeviceInfo::multiProcessorCount() 211 | private static native int multiProcessorCount_0(long nativeObj); 212 | 213 | // C++: string DeviceInfo::name() 214 | private static native String name_0(long nativeObj); 215 | 216 | // C++: void DeviceInfo::queryMemory(size_t& totalMemory, size_t& freeMemory) 217 | private static native void queryMemory_0(long nativeObj, double[] totalMemory_out, double[] freeMemory_out); 218 | 219 | // C++: size_t DeviceInfo::sharedMemPerBlock() 220 | private static native long sharedMemPerBlock_0(long nativeObj); 221 | 222 | // C++: bool DeviceInfo::supports(int feature_set) 223 | private static native boolean supports_0(long nativeObj, int feature_set); 224 | 225 | // C++: size_t DeviceInfo::totalMemory() 226 | private static native long totalMemory_0(long nativeObj); 227 | 228 | // native support for java finalize() 229 | private static native void delete(long nativeObj); 230 | 231 | } 232 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/gpu/Gpu.java: -------------------------------------------------------------------------------- 1 | package org.opencv.gpu; 2 | 3 | public class Gpu { 4 | 5 | public static final int 6 | FEATURE_SET_COMPUTE_10 = 10, 7 | FEATURE_SET_COMPUTE_11 = 11, 8 | FEATURE_SET_COMPUTE_12 = 12, 9 | FEATURE_SET_COMPUTE_13 = 13, 10 | FEATURE_SET_COMPUTE_20 = 20, 11 | FEATURE_SET_COMPUTE_21 = 21, 12 | FEATURE_SET_COMPUTE_30 = 30, 13 | FEATURE_SET_COMPUTE_35 = 35, 14 | GLOBAL_ATOMICS = FEATURE_SET_COMPUTE_11, 15 | SHARED_ATOMICS = FEATURE_SET_COMPUTE_12, 16 | NATIVE_DOUBLE = FEATURE_SET_COMPUTE_13, 17 | WARP_SHUFFLE_FUNCTIONS = FEATURE_SET_COMPUTE_30, 18 | DYNAMIC_PARALLELISM = FEATURE_SET_COMPUTE_35; 19 | 20 | 21 | // 22 | // C++: bool deviceSupports(int feature_set) 23 | // 24 | 25 | public static boolean deviceSupports(int feature_set) 26 | { 27 | boolean retVal = deviceSupports_0(feature_set); 28 | return retVal; 29 | } 30 | 31 | 32 | // 33 | // C++: int getCudaEnabledDeviceCount() 34 | // 35 | 36 | public static int getCudaEnabledDeviceCount() 37 | { 38 | int retVal = getCudaEnabledDeviceCount_0(); 39 | return retVal; 40 | } 41 | 42 | 43 | // 44 | // C++: int getDevice() 45 | // 46 | 47 | public static int getDevice() 48 | { 49 | int retVal = getDevice_0(); 50 | return retVal; 51 | } 52 | 53 | 54 | // 55 | // C++: void printCudaDeviceInfo(int device) 56 | // 57 | 58 | public static void printCudaDeviceInfo(int device) 59 | { 60 | printCudaDeviceInfo_0(device); 61 | return; 62 | } 63 | 64 | 65 | // 66 | // C++: void printShortCudaDeviceInfo(int device) 67 | // 68 | 69 | public static void printShortCudaDeviceInfo(int device) 70 | { 71 | printShortCudaDeviceInfo_0(device); 72 | return; 73 | } 74 | 75 | 76 | // 77 | // C++: void resetDevice() 78 | // 79 | 80 | public static void resetDevice() 81 | { 82 | resetDevice_0(); 83 | return; 84 | } 85 | 86 | 87 | // 88 | // C++: void setDevice(int device) 89 | // 90 | 91 | public static void setDevice(int device) 92 | { 93 | setDevice_0(device); 94 | return; 95 | } 96 | 97 | 98 | 99 | 100 | // C++: bool deviceSupports(int feature_set) 101 | private static native boolean deviceSupports_0(int feature_set); 102 | 103 | // C++: int getCudaEnabledDeviceCount() 104 | private static native int getCudaEnabledDeviceCount_0(); 105 | 106 | // C++: int getDevice() 107 | private static native int getDevice_0(); 108 | 109 | // C++: void printCudaDeviceInfo(int device) 110 | private static native void printCudaDeviceInfo_0(int device); 111 | 112 | // C++: void printShortCudaDeviceInfo(int device) 113 | private static native void printShortCudaDeviceInfo_0(int device); 114 | 115 | // C++: void resetDevice() 116 | private static native void resetDevice_0(); 117 | 118 | // C++: void setDevice(int device) 119 | private static native void setDevice_0(int device); 120 | 121 | } 122 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/gpu/TargetArchs.java: -------------------------------------------------------------------------------- 1 | package org.opencv.gpu; 2 | 3 | // C++: class TargetArchs 4 | public class TargetArchs { 5 | 6 | protected final long nativeObj; 7 | protected TargetArchs(long addr) { nativeObj = addr; } 8 | 9 | 10 | // 11 | // C++: static bool TargetArchs::builtWith(int feature_set) 12 | // 13 | 14 | public static boolean builtWith(int feature_set) 15 | { 16 | boolean retVal = builtWith_0(feature_set); 17 | return retVal; 18 | } 19 | 20 | 21 | // 22 | // C++: static bool TargetArchs::has(int major, int minor) 23 | // 24 | 25 | public static boolean has(int major, int minor) 26 | { 27 | boolean retVal = has_0(major, minor); 28 | return retVal; 29 | } 30 | 31 | 32 | // 33 | // C++: static bool TargetArchs::hasBin(int major, int minor) 34 | // 35 | 36 | public static boolean hasBin(int major, int minor) 37 | { 38 | boolean retVal = hasBin_0(major, minor); 39 | return retVal; 40 | } 41 | 42 | 43 | // 44 | // C++: static bool TargetArchs::hasEqualOrGreater(int major, int minor) 45 | // 46 | 47 | public static boolean hasEqualOrGreater(int major, int minor) 48 | { 49 | boolean retVal = hasEqualOrGreater_0(major, minor); 50 | return retVal; 51 | } 52 | 53 | 54 | // 55 | // C++: static bool TargetArchs::hasEqualOrGreaterBin(int major, int minor) 56 | // 57 | 58 | public static boolean hasEqualOrGreaterBin(int major, int minor) 59 | { 60 | boolean retVal = hasEqualOrGreaterBin_0(major, minor); 61 | return retVal; 62 | } 63 | 64 | 65 | // 66 | // C++: static bool TargetArchs::hasEqualOrGreaterPtx(int major, int minor) 67 | // 68 | 69 | public static boolean hasEqualOrGreaterPtx(int major, int minor) 70 | { 71 | boolean retVal = hasEqualOrGreaterPtx_0(major, minor); 72 | return retVal; 73 | } 74 | 75 | 76 | // 77 | // C++: static bool TargetArchs::hasEqualOrLessPtx(int major, int minor) 78 | // 79 | 80 | public static boolean hasEqualOrLessPtx(int major, int minor) 81 | { 82 | boolean retVal = hasEqualOrLessPtx_0(major, minor); 83 | return retVal; 84 | } 85 | 86 | 87 | // 88 | // C++: static bool TargetArchs::hasPtx(int major, int minor) 89 | // 90 | 91 | public static boolean hasPtx(int major, int minor) 92 | { 93 | boolean retVal = hasPtx_0(major, minor); 94 | return retVal; 95 | } 96 | 97 | 98 | @Override 99 | protected void finalize() throws Throwable { 100 | delete(nativeObj); 101 | } 102 | 103 | 104 | 105 | // C++: static bool TargetArchs::builtWith(int feature_set) 106 | private static native boolean builtWith_0(int feature_set); 107 | 108 | // C++: static bool TargetArchs::has(int major, int minor) 109 | private static native boolean has_0(int major, int minor); 110 | 111 | // C++: static bool TargetArchs::hasBin(int major, int minor) 112 | private static native boolean hasBin_0(int major, int minor); 113 | 114 | // C++: static bool TargetArchs::hasEqualOrGreater(int major, int minor) 115 | private static native boolean hasEqualOrGreater_0(int major, int minor); 116 | 117 | // C++: static bool TargetArchs::hasEqualOrGreaterBin(int major, int minor) 118 | private static native boolean hasEqualOrGreaterBin_0(int major, int minor); 119 | 120 | // C++: static bool TargetArchs::hasEqualOrGreaterPtx(int major, int minor) 121 | private static native boolean hasEqualOrGreaterPtx_0(int major, int minor); 122 | 123 | // C++: static bool TargetArchs::hasEqualOrLessPtx(int major, int minor) 124 | private static native boolean hasEqualOrLessPtx_0(int major, int minor); 125 | 126 | // C++: static bool TargetArchs::hasPtx(int major, int minor) 127 | private static native boolean hasPtx_0(int major, int minor); 128 | 129 | // native support for java finalize() 130 | private static native void delete(long nativeObj); 131 | 132 | } 133 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/imgproc/CLAHE.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.imgproc; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | import org.opencv.core.Size; 10 | 11 | // C++: class CLAHE 12 | public class CLAHE extends Algorithm { 13 | 14 | protected CLAHE(long addr) { super(addr); } 15 | 16 | 17 | // 18 | // C++: void CLAHE::apply(Mat src, Mat& dst) 19 | // 20 | 21 | public void apply(Mat src, Mat dst) 22 | { 23 | 24 | apply_0(nativeObj, src.nativeObj, dst.nativeObj); 25 | 26 | return; 27 | } 28 | 29 | 30 | // 31 | // C++: void CLAHE::setClipLimit(double clipLimit) 32 | // 33 | 34 | public void setClipLimit(double clipLimit) 35 | { 36 | 37 | setClipLimit_0(nativeObj, clipLimit); 38 | 39 | return; 40 | } 41 | 42 | 43 | // 44 | // C++: void CLAHE::setTilesGridSize(Size tileGridSize) 45 | // 46 | 47 | public void setTilesGridSize(Size tileGridSize) 48 | { 49 | 50 | setTilesGridSize_0(nativeObj, tileGridSize.width, tileGridSize.height); 51 | 52 | return; 53 | } 54 | 55 | 56 | @Override 57 | protected void finalize() throws Throwable { 58 | delete(nativeObj); 59 | } 60 | 61 | 62 | 63 | // C++: void CLAHE::apply(Mat src, Mat& dst) 64 | private static native void apply_0(long nativeObj, long src_nativeObj, long dst_nativeObj); 65 | 66 | // C++: void CLAHE::setClipLimit(double clipLimit) 67 | private static native void setClipLimit_0(long nativeObj, double clipLimit); 68 | 69 | // C++: void CLAHE::setTilesGridSize(Size tileGridSize) 70 | private static native void setTilesGridSize_0(long nativeObj, double tileGridSize_width, double tileGridSize_height); 71 | 72 | // native support for java finalize() 73 | private static native void delete(long nativeObj); 74 | 75 | } 76 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/ml/CvBoostParams.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | 8 | 9 | // C++: class CvBoostParams 10 | /** 11 | *Boosting training parameters.
12 | * 13 | *There is one structure member that you can set directly:
14 | * 15 | *Splitting criteria used to choose optimal splits during a weak tree 16 | * construction. Possible values are:
17 | * 18 | *// C++ code:
25 | *The structure is derived from "CvDTreeParams" but not all of the decision 35 | * tree parameters are supported. In particular, cross-validation is not 36 | * supported. 37 | *
38 | * 39 | *All parameters are public. You can initialize them by a constructor and then 40 | * override some of them directly if you want.
41 | * 42 | * @see org.opencv.ml.CvBoostParams : public CvDTreeParams 43 | */ 44 | public class CvBoostParams extends CvDTreeParams { 45 | 46 | protected CvBoostParams(long addr) { super(addr); } 47 | 48 | 49 | // 50 | // C++: CvBoostParams::CvBoostParams() 51 | // 52 | 53 | /** 54 | *The constructors.
55 | * 56 | *See "CvDTreeParams.CvDTreeParams" for description of other parameters.
57 | * 58 | *Default parameters are:
59 | * 60 | *// C++ code:
63 | * 64 | *CvBoostParams.CvBoostParams()
65 | * 66 | * 67 | *boost_type = CvBoost.REAL;
68 | * 69 | *weak_count = 100;
70 | * 71 | *weight_trim_rate = 0.95;
72 | * 73 | *cv_folds = 0;
74 | * 75 | *max_depth = 1;
76 | * 77 | * 78 | * @see org.opencv.ml.CvBoostParams.CvBoostParams 79 | */ 80 | public CvBoostParams() 81 | { 82 | 83 | super( CvBoostParams_0() ); 84 | 85 | return; 86 | } 87 | 88 | 89 | // 90 | // C++: int CvBoostParams::boost_type 91 | // 92 | 93 | public int get_boost_type() 94 | { 95 | 96 | int retVal = get_boost_type_0(nativeObj); 97 | 98 | return retVal; 99 | } 100 | 101 | 102 | // 103 | // C++: void CvBoostParams::boost_type 104 | // 105 | 106 | public void set_boost_type(int boost_type) 107 | { 108 | 109 | set_boost_type_0(nativeObj, boost_type); 110 | 111 | return; 112 | } 113 | 114 | 115 | // 116 | // C++: int CvBoostParams::weak_count 117 | // 118 | 119 | public int get_weak_count() 120 | { 121 | 122 | int retVal = get_weak_count_0(nativeObj); 123 | 124 | return retVal; 125 | } 126 | 127 | 128 | // 129 | // C++: void CvBoostParams::weak_count 130 | // 131 | 132 | public void set_weak_count(int weak_count) 133 | { 134 | 135 | set_weak_count_0(nativeObj, weak_count); 136 | 137 | return; 138 | } 139 | 140 | 141 | // 142 | // C++: int CvBoostParams::split_criteria 143 | // 144 | 145 | public int get_split_criteria() 146 | { 147 | 148 | int retVal = get_split_criteria_0(nativeObj); 149 | 150 | return retVal; 151 | } 152 | 153 | 154 | // 155 | // C++: void CvBoostParams::split_criteria 156 | // 157 | 158 | public void set_split_criteria(int split_criteria) 159 | { 160 | 161 | set_split_criteria_0(nativeObj, split_criteria); 162 | 163 | return; 164 | } 165 | 166 | 167 | // 168 | // C++: double CvBoostParams::weight_trim_rate 169 | // 170 | 171 | public double get_weight_trim_rate() 172 | { 173 | 174 | double retVal = get_weight_trim_rate_0(nativeObj); 175 | 176 | return retVal; 177 | } 178 | 179 | 180 | // 181 | // C++: void CvBoostParams::weight_trim_rate 182 | // 183 | 184 | public void set_weight_trim_rate(double weight_trim_rate) 185 | { 186 | 187 | set_weight_trim_rate_0(nativeObj, weight_trim_rate); 188 | 189 | return; 190 | } 191 | 192 | 193 | @Override 194 | protected void finalize() throws Throwable { 195 | delete(nativeObj); 196 | } 197 | 198 | 199 | 200 | // C++: CvBoostParams::CvBoostParams() 201 | private static native long CvBoostParams_0(); 202 | 203 | // C++: int CvBoostParams::boost_type 204 | private static native int get_boost_type_0(long nativeObj); 205 | 206 | // C++: void CvBoostParams::boost_type 207 | private static native void set_boost_type_0(long nativeObj, int boost_type); 208 | 209 | // C++: int CvBoostParams::weak_count 210 | private static native int get_weak_count_0(long nativeObj); 211 | 212 | // C++: void CvBoostParams::weak_count 213 | private static native void set_weak_count_0(long nativeObj, int weak_count); 214 | 215 | // C++: int CvBoostParams::split_criteria 216 | private static native int get_split_criteria_0(long nativeObj); 217 | 218 | // C++: void CvBoostParams::split_criteria 219 | private static native void set_split_criteria_0(long nativeObj, int split_criteria); 220 | 221 | // C++: double CvBoostParams::weight_trim_rate 222 | private static native double get_weight_trim_rate_0(long nativeObj); 223 | 224 | // C++: void CvBoostParams::weight_trim_rate 225 | private static native void set_weight_trim_rate_0(long nativeObj, double weight_trim_rate); 226 | 227 | // native support for java finalize() 228 | private static native void delete(long nativeObj); 229 | 230 | } 231 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/ml/CvERTrees.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | import org.opencv.core.Mat; 8 | 9 | // C++: class CvERTrees 10 | /** 11 | *The class implements the Extremely randomized trees algorithm.
12 | * CvERTrees
is inherited from "CvRTrees" and has the same
13 | * interface, so see description of "CvRTrees" class to get details. To set the
14 | * training parameters of Extremely randomized trees the same class "CvRTParams"
15 | * is used.
GBT training parameters.
12 | * 13 | *The structure contains parameters for each single decision tree in the 14 | * ensemble, as well as the whole model characteristics. The structure is 15 | * derived from "CvDTreeParams" but not all of the decision tree parameters are 16 | * supported: cross-validation, pruning, and class priorities are not used.
17 | * 18 | * @see org.opencv.ml.CvGBTreesParams : public CvDTreeParams 19 | */ 20 | public class CvGBTreesParams extends CvDTreeParams { 21 | 22 | protected CvGBTreesParams(long addr) { super(addr); } 23 | 24 | 25 | // 26 | // C++: CvGBTreesParams::CvGBTreesParams() 27 | // 28 | 29 | /** 30 | *By default the following constructor is used: CvGBTreesParams(CvGBTrees.SQUARED_LOSS,
31 | * 200, 0.8f, 0.01f, 3, false)
// C++ code:
34 | * 35 | *: CvDTreeParams(3, 10, 0, false, 10, 0, false, false, 0)
36 | * 37 | * @see org.opencv.ml.CvGBTreesParams.CvGBTreesParams 38 | */ 39 | public CvGBTreesParams() 40 | { 41 | 42 | super( CvGBTreesParams_0() ); 43 | 44 | return; 45 | } 46 | 47 | 48 | // 49 | // C++: int CvGBTreesParams::weak_count 50 | // 51 | 52 | public int get_weak_count() 53 | { 54 | 55 | int retVal = get_weak_count_0(nativeObj); 56 | 57 | return retVal; 58 | } 59 | 60 | 61 | // 62 | // C++: void CvGBTreesParams::weak_count 63 | // 64 | 65 | public void set_weak_count(int weak_count) 66 | { 67 | 68 | set_weak_count_0(nativeObj, weak_count); 69 | 70 | return; 71 | } 72 | 73 | 74 | // 75 | // C++: int CvGBTreesParams::loss_function_type 76 | // 77 | 78 | public int get_loss_function_type() 79 | { 80 | 81 | int retVal = get_loss_function_type_0(nativeObj); 82 | 83 | return retVal; 84 | } 85 | 86 | 87 | // 88 | // C++: void CvGBTreesParams::loss_function_type 89 | // 90 | 91 | public void set_loss_function_type(int loss_function_type) 92 | { 93 | 94 | set_loss_function_type_0(nativeObj, loss_function_type); 95 | 96 | return; 97 | } 98 | 99 | 100 | // 101 | // C++: float CvGBTreesParams::subsample_portion 102 | // 103 | 104 | public float get_subsample_portion() 105 | { 106 | 107 | float retVal = get_subsample_portion_0(nativeObj); 108 | 109 | return retVal; 110 | } 111 | 112 | 113 | // 114 | // C++: void CvGBTreesParams::subsample_portion 115 | // 116 | 117 | public void set_subsample_portion(float subsample_portion) 118 | { 119 | 120 | set_subsample_portion_0(nativeObj, subsample_portion); 121 | 122 | return; 123 | } 124 | 125 | 126 | // 127 | // C++: float CvGBTreesParams::shrinkage 128 | // 129 | 130 | public float get_shrinkage() 131 | { 132 | 133 | float retVal = get_shrinkage_0(nativeObj); 134 | 135 | return retVal; 136 | } 137 | 138 | 139 | // 140 | // C++: void CvGBTreesParams::shrinkage 141 | // 142 | 143 | public void set_shrinkage(float shrinkage) 144 | { 145 | 146 | set_shrinkage_0(nativeObj, shrinkage); 147 | 148 | return; 149 | } 150 | 151 | 152 | @Override 153 | protected void finalize() throws Throwable { 154 | delete(nativeObj); 155 | } 156 | 157 | 158 | 159 | // C++: CvGBTreesParams::CvGBTreesParams() 160 | private static native long CvGBTreesParams_0(); 161 | 162 | // C++: int CvGBTreesParams::weak_count 163 | private static native int get_weak_count_0(long nativeObj); 164 | 165 | // C++: void CvGBTreesParams::weak_count 166 | private static native void set_weak_count_0(long nativeObj, int weak_count); 167 | 168 | // C++: int CvGBTreesParams::loss_function_type 169 | private static native int get_loss_function_type_0(long nativeObj); 170 | 171 | // C++: void CvGBTreesParams::loss_function_type 172 | private static native void set_loss_function_type_0(long nativeObj, int loss_function_type); 173 | 174 | // C++: float CvGBTreesParams::subsample_portion 175 | private static native float get_subsample_portion_0(long nativeObj); 176 | 177 | // C++: void CvGBTreesParams::subsample_portion 178 | private static native void set_subsample_portion_0(long nativeObj, float subsample_portion); 179 | 180 | // C++: float CvGBTreesParams::shrinkage 181 | private static native float get_shrinkage_0(long nativeObj); 182 | 183 | // C++: void CvGBTreesParams::shrinkage 184 | private static native void set_shrinkage_0(long nativeObj, float shrinkage); 185 | 186 | // native support for java finalize() 187 | private static native void delete(long nativeObj); 188 | 189 | } 190 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/ml/CvParamGrid.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | 8 | 9 | // C++: class CvParamGrid 10 | /** 11 | *The structure represents the logarithmic grid range of statmodel parameters. 12 | * It is used for optimizing statmodel accuracy by varying model parameters, the 13 | * accuracy estimate being computed by cross-validation.
14 | * 15 | *Minimum value of the statmodel parameter.
16 | * 17 | *Maximum value of the statmodel parameter.
18 | *
// C++ code:
21 | * 22 | *Logarithmic step for iterating the statmodel parameter.
23 | * 24 | *The grid determines the following iteration sequence of the statmodel 25 | * parameter values:
26 | * 27 | *(min_val, min_val*step, min_val*(step)^2, dots, min_val*(step)^n),
28 | * 29 | *where n is the maximal index satisfying
30 | * 31 | *min_val * step ^n < max_val
32 | * 33 | *The grid is logarithmic, so step
must always be greater then 1.
The constructors.
58 | * 59 | *The full constructor initializes corresponding members. The default 60 | * constructor creates a dummy grid:
61 | * 62 | *// C++ code:
65 | * 66 | *CvParamGrid.CvParamGrid()
67 | * 68 | * 69 | *min_val = max_val = step = 0;
70 | * 71 | * 72 | * @see org.opencv.ml.CvParamGrid.CvParamGrid 73 | */ 74 | public CvParamGrid() 75 | { 76 | 77 | nativeObj = CvParamGrid_0(); 78 | 79 | return; 80 | } 81 | 82 | 83 | // 84 | // C++: double CvParamGrid::min_val 85 | // 86 | 87 | public double get_min_val() 88 | { 89 | 90 | double retVal = get_min_val_0(nativeObj); 91 | 92 | return retVal; 93 | } 94 | 95 | 96 | // 97 | // C++: void CvParamGrid::min_val 98 | // 99 | 100 | public void set_min_val(double min_val) 101 | { 102 | 103 | set_min_val_0(nativeObj, min_val); 104 | 105 | return; 106 | } 107 | 108 | 109 | // 110 | // C++: double CvParamGrid::max_val 111 | // 112 | 113 | public double get_max_val() 114 | { 115 | 116 | double retVal = get_max_val_0(nativeObj); 117 | 118 | return retVal; 119 | } 120 | 121 | 122 | // 123 | // C++: void CvParamGrid::max_val 124 | // 125 | 126 | public void set_max_val(double max_val) 127 | { 128 | 129 | set_max_val_0(nativeObj, max_val); 130 | 131 | return; 132 | } 133 | 134 | 135 | // 136 | // C++: double CvParamGrid::step 137 | // 138 | 139 | public double get_step() 140 | { 141 | 142 | double retVal = get_step_0(nativeObj); 143 | 144 | return retVal; 145 | } 146 | 147 | 148 | // 149 | // C++: void CvParamGrid::step 150 | // 151 | 152 | public void set_step(double step) 153 | { 154 | 155 | set_step_0(nativeObj, step); 156 | 157 | return; 158 | } 159 | 160 | 161 | @Override 162 | protected void finalize() throws Throwable { 163 | delete(nativeObj); 164 | } 165 | 166 | 167 | 168 | // C++: CvParamGrid::CvParamGrid() 169 | private static native long CvParamGrid_0(); 170 | 171 | // C++: double CvParamGrid::min_val 172 | private static native double get_min_val_0(long nativeObj); 173 | 174 | // C++: void CvParamGrid::min_val 175 | private static native void set_min_val_0(long nativeObj, double min_val); 176 | 177 | // C++: double CvParamGrid::max_val 178 | private static native double get_max_val_0(long nativeObj); 179 | 180 | // C++: void CvParamGrid::max_val 181 | private static native void set_max_val_0(long nativeObj, double max_val); 182 | 183 | // C++: double CvParamGrid::step 184 | private static native double get_step_0(long nativeObj); 185 | 186 | // C++: void CvParamGrid::step 187 | private static native void set_step_0(long nativeObj, double step); 188 | 189 | // native support for java finalize() 190 | private static native void delete(long nativeObj); 191 | 192 | } 193 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/ml/CvRTParams.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | import org.opencv.core.TermCriteria; 8 | 9 | // C++: class CvRTParams 10 | /** 11 | *Training parameters of random trees.
12 | * 13 | *The set of training parameters for the forest is a superset of the training 14 | * parameters for a single tree. However, random trees do not need all the 15 | * functionality/features of decision trees. Most noticeably, the trees are not 16 | * pruned, so the cross-validation parameters are not used.
17 | * 18 | * @see org.opencv.ml.CvRTParams : public CvDTreeParams 19 | */ 20 | public class CvRTParams extends CvDTreeParams { 21 | 22 | protected CvRTParams(long addr) { super(addr); } 23 | 24 | 25 | // 26 | // C++: CvRTParams::CvRTParams() 27 | // 28 | 29 | public CvRTParams() 30 | { 31 | 32 | super( CvRTParams_0() ); 33 | 34 | return; 35 | } 36 | 37 | 38 | // 39 | // C++: bool CvRTParams::calc_var_importance 40 | // 41 | 42 | public boolean get_calc_var_importance() 43 | { 44 | 45 | boolean retVal = get_calc_var_importance_0(nativeObj); 46 | 47 | return retVal; 48 | } 49 | 50 | 51 | // 52 | // C++: void CvRTParams::calc_var_importance 53 | // 54 | 55 | public void set_calc_var_importance(boolean calc_var_importance) 56 | { 57 | 58 | set_calc_var_importance_0(nativeObj, calc_var_importance); 59 | 60 | return; 61 | } 62 | 63 | 64 | // 65 | // C++: int CvRTParams::nactive_vars 66 | // 67 | 68 | public int get_nactive_vars() 69 | { 70 | 71 | int retVal = get_nactive_vars_0(nativeObj); 72 | 73 | return retVal; 74 | } 75 | 76 | 77 | // 78 | // C++: void CvRTParams::nactive_vars 79 | // 80 | 81 | public void set_nactive_vars(int nactive_vars) 82 | { 83 | 84 | set_nactive_vars_0(nativeObj, nactive_vars); 85 | 86 | return; 87 | } 88 | 89 | 90 | // 91 | // C++: TermCriteria CvRTParams::term_crit 92 | // 93 | 94 | public TermCriteria get_term_crit() 95 | { 96 | 97 | TermCriteria retVal = new TermCriteria(get_term_crit_0(nativeObj)); 98 | 99 | return retVal; 100 | } 101 | 102 | 103 | // 104 | // C++: void CvRTParams::term_crit 105 | // 106 | 107 | public void set_term_crit(TermCriteria term_crit) 108 | { 109 | 110 | set_term_crit_0(nativeObj, term_crit.type, term_crit.maxCount, term_crit.epsilon); 111 | 112 | return; 113 | } 114 | 115 | 116 | @Override 117 | protected void finalize() throws Throwable { 118 | delete(nativeObj); 119 | } 120 | 121 | 122 | 123 | // C++: CvRTParams::CvRTParams() 124 | private static native long CvRTParams_0(); 125 | 126 | // C++: bool CvRTParams::calc_var_importance 127 | private static native boolean get_calc_var_importance_0(long nativeObj); 128 | 129 | // C++: void CvRTParams::calc_var_importance 130 | private static native void set_calc_var_importance_0(long nativeObj, boolean calc_var_importance); 131 | 132 | // C++: int CvRTParams::nactive_vars 133 | private static native int get_nactive_vars_0(long nativeObj); 134 | 135 | // C++: void CvRTParams::nactive_vars 136 | private static native void set_nactive_vars_0(long nativeObj, int nactive_vars); 137 | 138 | // C++: TermCriteria CvRTParams::term_crit 139 | private static native double[] get_term_crit_0(long nativeObj); 140 | 141 | // C++: void CvRTParams::term_crit 142 | private static native void set_term_crit_0(long nativeObj, int term_crit_type, int term_crit_maxCount, double term_crit_epsilon); 143 | 144 | // native support for java finalize() 145 | private static native void delete(long nativeObj); 146 | 147 | } 148 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/ml/CvStatModel.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | import java.lang.String; 8 | 9 | // C++: class CvStatModel 10 | /** 11 | *Base class for statistical models in ML.
12 | * 13 | *class CvStatModel
// C++ code:
16 | * 17 | * 18 | *public:
19 | * 20 | */ * CvStatModel(); * /
21 | * 22 | */ * CvStatModel(const Mat& train_data...); * /
23 | * 24 | *virtual ~CvStatModel();
25 | * 26 | *virtual void clear()=0;
27 | * 28 | */ * virtual bool train(const Mat& train_data, [int tflag,]..., const
29 | * 30 | *Mat& responses,...,
31 | * 32 | *[const Mat& var_idx,]..., [const Mat& sample_idx,]...
33 | * 34 | *[const Mat& var_type,]..., [const Mat& missing_mask,]
35 | * 36 | */ * virtual float predict(const Mat& sample...) const=0; * /
42 | * 43 | *virtual void save(const char* filename, const char* name=0)=0;
44 | * 45 | *virtual void load(const char* filename, const char* name=0)=0;
46 | * 47 | *virtual void write(CvFileStorage* storage, const char* name)=0;
48 | * 49 | *virtual void read(CvFileStorage* storage, CvFileNode* node)=0;
50 | * 51 | *};
52 | * 53 | *In this declaration, some methods are commented off. These are methods for 54 | * which there is no unified API (with the exception of the default 55 | * constructor). However, there are many similarities in the syntax and 56 | * semantics that are briefly described below in this section, as if they are 57 | * part of the base class. 58 | *
59 | * 60 | * @see org.opencv.ml.CvStatModel 61 | */ 62 | public class CvStatModel { 63 | 64 | protected final long nativeObj; 65 | protected CvStatModel(long addr) { nativeObj = addr; } 66 | 67 | 68 | // 69 | // C++: void CvStatModel::load(c_string filename, c_string name = 0) 70 | // 71 | 72 | /** 73 | *Loads the model from a file.
74 | * 75 | *The method load
loads the complete model state with the
76 | * specified name (or default model-dependent name) from the specified XML or
77 | * YAML file. The previous model state is cleared by "CvStatModel.clear".
Loads the model from a file.
94 | * 95 | *The method load
loads the complete model state with the
96 | * specified name (or default model-dependent name) from the specified XML or
97 | * YAML file. The previous model state is cleared by "CvStatModel.clear".
Saves the model to a file.
118 | * 119 | *The method save
saves the complete model state to the specified
120 | * XML or YAML file with the specified name or default name (which depends on a
121 | * particular class). *Data persistence* functionality from CxCore
122 | * is used.
Saves the model to a file.
139 | * 140 | *The method save
saves the complete model state to the specified
141 | * XML or YAML file with the specified name or default name (which depends on a
142 | * particular class). *Data persistence* functionality from CxCore
143 | * is used.
Groups the object candidate rectangles.
40 | * 41 | *The function is a wrapper for the generic function "partition". It clusters
42 | * all the input rectangles using the rectangle equivalence criteria that
43 | * combines rectangles with similar sizes and similar locations. The similarity
44 | * is defined by eps
. When eps=0
, no clustering is
45 | * done at all. If eps-> +inf, all the rectangles are put in one
46 | * cluster. Then, the small clusters containing less than or equal to
47 | * groupThreshold
rectangles are rejected. In each other cluster,
48 | * the average rectangle is computed and put into the output rectangle list.
Groups the object candidate rectangles.
71 | * 72 | *The function is a wrapper for the generic function "partition". It clusters
73 | * all the input rectangles using the rectangle equivalence criteria that
74 | * combines rectangles with similar sizes and similar locations. The similarity
75 | * is defined by eps
. When eps=0
, no clustering is
76 | * done at all. If eps-> +inf, all the rectangles are put in one
77 | * cluster. Then, the small clusters containing less than or equal to
78 | * groupThreshold
rectangles are rejected. In each other cluster,
79 | * the average rectangle is computed and put into the output rectangle list.
Base class for background/foreground segmentation.
13 | * 14 | *class BackgroundSubtractor : public Algorithm
// C++ code:
17 | * 18 | * 19 | *public:
20 | * 21 | *virtual ~BackgroundSubtractor();
22 | * 23 | *virtual void operator()(InputArray image, OutputArray fgmask, double 24 | * learningRate=0);
25 | * 26 | *virtual void getBackgroundImage(OutputArray backgroundImage) const;
27 | * 28 | *};
29 | * 30 | *The class is only used to define the common interface for the whole family of 31 | * background/foreground segmentation algorithms. 32 | *
33 | * 34 | * @see org.opencv.video.BackgroundSubtractor : public Algorithm 35 | */ 36 | public class BackgroundSubtractor extends Algorithm { 37 | 38 | protected BackgroundSubtractor(long addr) { super(addr); } 39 | 40 | 41 | // 42 | // C++: void BackgroundSubtractor::operator ()(Mat image, Mat& fgmask, double learningRate = 0) 43 | // 44 | 45 | /** 46 | *Computes a foreground mask.
47 | * 48 | * @param image Next video frame. 49 | * @param fgmask The output foreground mask as an 8-bit binary image. 50 | * @param learningRate a learningRate 51 | * 52 | * @see org.opencv.video.BackgroundSubtractor.operator() 53 | */ 54 | public void apply(Mat image, Mat fgmask, double learningRate) 55 | { 56 | 57 | apply_0(nativeObj, image.nativeObj, fgmask.nativeObj, learningRate); 58 | 59 | return; 60 | } 61 | 62 | /** 63 | *Computes a foreground mask.
64 | * 65 | * @param image Next video frame. 66 | * @param fgmask The output foreground mask as an 8-bit binary image. 67 | * 68 | * @see org.opencv.video.BackgroundSubtractor.operator() 69 | */ 70 | public void apply(Mat image, Mat fgmask) 71 | { 72 | 73 | apply_1(nativeObj, image.nativeObj, fgmask.nativeObj); 74 | 75 | return; 76 | } 77 | 78 | 79 | @Override 80 | protected void finalize() throws Throwable { 81 | delete(nativeObj); 82 | } 83 | 84 | 85 | 86 | // C++: void BackgroundSubtractor::operator ()(Mat image, Mat& fgmask, double learningRate = 0) 87 | private static native void apply_0(long nativeObj, long image_nativeObj, long fgmask_nativeObj, double learningRate); 88 | private static native void apply_1(long nativeObj, long image_nativeObj, long fgmask_nativeObj); 89 | 90 | // native support for java finalize() 91 | private static native void delete(long nativeObj); 92 | 93 | } 94 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/video/BackgroundSubtractorMOG.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.video; 6 | 7 | 8 | 9 | // C++: class BackgroundSubtractorMOG 10 | /** 11 | *Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
12 | * 13 | *The class implements the algorithm described in P. KadewTraKuPong and R. 14 | * Bowden, *An improved adaptive background mixture model for real-time tracking 15 | * with shadow detection*, Proc. 2nd European Workshop on Advanced Video-Based 16 | * Surveillance Systems, 2001: http://personal.ee.surrey.ac.uk/Personal/R.Bowden/publications/avbs01/avbs01.pdf
17 | * 18 | * @see org.opencv.video.BackgroundSubtractorMOG : public BackgroundSubtractor 19 | */ 20 | public class BackgroundSubtractorMOG extends BackgroundSubtractor { 21 | 22 | protected BackgroundSubtractorMOG(long addr) { super(addr); } 23 | 24 | 25 | // 26 | // C++: BackgroundSubtractorMOG::BackgroundSubtractorMOG() 27 | // 28 | 29 | /** 30 | *The constructors.
31 | * 32 | *Default constructor sets all parameters to default values.
33 | * 34 | * @see org.opencv.video.BackgroundSubtractorMOG.BackgroundSubtractorMOG 35 | */ 36 | public BackgroundSubtractorMOG() 37 | { 38 | 39 | super( BackgroundSubtractorMOG_0() ); 40 | 41 | return; 42 | } 43 | 44 | 45 | // 46 | // C++: BackgroundSubtractorMOG::BackgroundSubtractorMOG(int history, int nmixtures, double backgroundRatio, double noiseSigma = 0) 47 | // 48 | 49 | /** 50 | *The constructors.
51 | * 52 | *Default constructor sets all parameters to default values.
53 | * 54 | * @param history Length of the history. 55 | * @param nmixtures Number of Gaussian mixtures. 56 | * @param backgroundRatio Background ratio. 57 | * @param noiseSigma Noise strength. 58 | * 59 | * @see org.opencv.video.BackgroundSubtractorMOG.BackgroundSubtractorMOG 60 | */ 61 | public BackgroundSubtractorMOG(int history, int nmixtures, double backgroundRatio, double noiseSigma) 62 | { 63 | 64 | super( BackgroundSubtractorMOG_1(history, nmixtures, backgroundRatio, noiseSigma) ); 65 | 66 | return; 67 | } 68 | 69 | /** 70 | *The constructors.
71 | * 72 | *Default constructor sets all parameters to default values.
73 | * 74 | * @param history Length of the history. 75 | * @param nmixtures Number of Gaussian mixtures. 76 | * @param backgroundRatio Background ratio. 77 | * 78 | * @see org.opencv.video.BackgroundSubtractorMOG.BackgroundSubtractorMOG 79 | */ 80 | public BackgroundSubtractorMOG(int history, int nmixtures, double backgroundRatio) 81 | { 82 | 83 | super( BackgroundSubtractorMOG_2(history, nmixtures, backgroundRatio) ); 84 | 85 | return; 86 | } 87 | 88 | 89 | @Override 90 | protected void finalize() throws Throwable { 91 | delete(nativeObj); 92 | } 93 | 94 | 95 | 96 | // C++: BackgroundSubtractorMOG::BackgroundSubtractorMOG() 97 | private static native long BackgroundSubtractorMOG_0(); 98 | 99 | // C++: BackgroundSubtractorMOG::BackgroundSubtractorMOG(int history, int nmixtures, double backgroundRatio, double noiseSigma = 0) 100 | private static native long BackgroundSubtractorMOG_1(int history, int nmixtures, double backgroundRatio, double noiseSigma); 101 | private static native long BackgroundSubtractorMOG_2(int history, int nmixtures, double backgroundRatio); 102 | 103 | // native support for java finalize() 104 | private static native void delete(long nativeObj); 105 | 106 | } 107 | -------------------------------------------------------------------------------- /opencv/src/main/java/org/opencv/video/KalmanFilter.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.video; 6 | 7 | import org.opencv.core.Mat; 8 | 9 | // C++: class KalmanFilter 10 | /** 11 | *Kalman filter class.
12 | * 13 | *The class implements a standard Kalman filter http://en.wikipedia.org/wiki/Kalman_filter,
14 | * [Welch95]. However, you can modify transitionMatrix
,
15 | * controlMatrix
, and measurementMatrix
to get an
16 | * extended Kalman filter functionality. See the OpenCV sample kalman.cpp
.
Note:
19 | *The constructors.
38 | * 39 | *The full constructor.
40 | * 41 | *Note: In C API when CvKalman* kalmanFilter
structure is not
42 | * needed anymore, it should be released with cvReleaseKalman(&kalmanFilter)
The constructors.
61 | * 62 | *The full constructor.
63 | * 64 | *Note: In C API when CvKalman* kalmanFilter
structure is not
65 | * needed anymore, it should be released with cvReleaseKalman(&kalmanFilter)
CV_32F
71 | * or CV_64F
.
72 | *
73 | * @see org.opencv.video.KalmanFilter.KalmanFilter
74 | */
75 | public KalmanFilter(int dynamParams, int measureParams, int controlParams, int type)
76 | {
77 |
78 | nativeObj = KalmanFilter_1(dynamParams, measureParams, controlParams, type);
79 |
80 | return;
81 | }
82 |
83 | /**
84 | * The constructors.
85 | * 86 | *The full constructor.
87 | * 88 | *Note: In C API when CvKalman* kalmanFilter
structure is not
89 | * needed anymore, it should be released with cvReleaseKalman(&kalmanFilter)
Updates the predicted state from the measurement.
111 | * 112 | * @param measurement The measured system parameters 113 | * 114 | * @see org.opencv.video.KalmanFilter.correct 115 | */ 116 | public Mat correct(Mat measurement) 117 | { 118 | 119 | Mat retVal = new Mat(correct_0(nativeObj, measurement.nativeObj)); 120 | 121 | return retVal; 122 | } 123 | 124 | 125 | // 126 | // C++: Mat KalmanFilter::predict(Mat control = Mat()) 127 | // 128 | 129 | /** 130 | *Computes a predicted state.
131 | * 132 | * @param control The optional input control 133 | * 134 | * @see org.opencv.video.KalmanFilter.predict 135 | */ 136 | public Mat predict(Mat control) 137 | { 138 | 139 | Mat retVal = new Mat(predict_0(nativeObj, control.nativeObj)); 140 | 141 | return retVal; 142 | } 143 | 144 | /** 145 | *Computes a predicted state.
146 | * 147 | * @see org.opencv.video.KalmanFilter.predict 148 | */ 149 | public Mat predict() 150 | { 151 | 152 | Mat retVal = new Mat(predict_1(nativeObj)); 153 | 154 | return retVal; 155 | } 156 | 157 | 158 | @Override 159 | protected void finalize() throws Throwable { 160 | delete(nativeObj); 161 | } 162 | 163 | 164 | 165 | // C++: KalmanFilter::KalmanFilter() 166 | private static native long KalmanFilter_0(); 167 | 168 | // C++: KalmanFilter::KalmanFilter(int dynamParams, int measureParams, int controlParams = 0, int type = CV_32F) 169 | private static native long KalmanFilter_1(int dynamParams, int measureParams, int controlParams, int type); 170 | private static native long KalmanFilter_2(int dynamParams, int measureParams); 171 | 172 | // C++: Mat KalmanFilter::correct(Mat measurement) 173 | private static native long correct_0(long nativeObj, long measurement_nativeObj); 174 | 175 | // C++: Mat KalmanFilter::predict(Mat control = Mat()) 176 | private static native long predict_0(long nativeObj, long control_nativeObj); 177 | private static native long predict_1(long nativeObj); 178 | 179 | // native support for java finalize() 180 | private static native void delete(long nativeObj); 181 | 182 | } 183 | -------------------------------------------------------------------------------- /opencv/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 |