001 002// 003// This file is auto-generated. Please don't modify it! 004// 005package org.opencv.imgproc; 006 007import java.util.ArrayList; 008import java.util.List; 009import org.opencv.core.Mat; 010import org.opencv.core.MatOfFloat4; 011import org.opencv.core.MatOfFloat6; 012import org.opencv.core.MatOfInt; 013import org.opencv.core.MatOfPoint2f; 014import org.opencv.core.Point; 015import org.opencv.core.Rect; 016import org.opencv.utils.Converters; 017 018// C++: class Subdiv2D 019//javadoc: Subdiv2D 020public class Subdiv2D { 021 022 protected final long nativeObj; 023 protected Subdiv2D(long addr) { nativeObj = addr; } 024 025 026 public static final int 027 PTLOC_ERROR = -2, 028 PTLOC_OUTSIDE_RECT = -1, 029 PTLOC_INSIDE = 0, 030 PTLOC_VERTEX = 1, 031 PTLOC_ON_EDGE = 2, 032 NEXT_AROUND_ORG = 0x00, 033 NEXT_AROUND_DST = 0x22, 034 PREV_AROUND_ORG = 0x11, 035 PREV_AROUND_DST = 0x33, 036 NEXT_AROUND_LEFT = 0x13, 037 NEXT_AROUND_RIGHT = 0x31, 038 PREV_AROUND_LEFT = 0x20, 039 PREV_AROUND_RIGHT = 0x02; 040 041 042 // 043 // C++: Subdiv2D(Rect rect) 044 // 045 046 //javadoc: Subdiv2D::Subdiv2D(rect) 047 public Subdiv2D(Rect rect) 048 { 049 050 nativeObj = Subdiv2D_0(rect.x, rect.y, rect.width, rect.height); 051 052 return; 053 } 054 055 056 // 057 // C++: Subdiv2D() 058 // 059 060 //javadoc: Subdiv2D::Subdiv2D() 061 public Subdiv2D() 062 { 063 064 nativeObj = Subdiv2D_1(); 065 066 return; 067 } 068 069 070 // 071 // C++: Point2f getVertex(int vertex, int* firstEdge = 0) 072 // 073 074 //javadoc: Subdiv2D::getVertex(vertex, firstEdge) 075 public Point getVertex(int vertex, int[] firstEdge) 076 { 077 double[] firstEdge_out = new double[1]; 078 Point retVal = new Point(getVertex_0(nativeObj, vertex, firstEdge_out)); 079 if(firstEdge!=null) firstEdge[0] = (int)firstEdge_out[0]; 080 return retVal; 081 } 082 083 //javadoc: Subdiv2D::getVertex(vertex) 084 public Point getVertex(int vertex) 085 { 086 087 Point retVal = new Point(getVertex_1(nativeObj, vertex)); 088 089 return retVal; 090 } 091 092 093 // 094 // C++: int edgeDst(int edge, Point2f* dstpt = 0) 095 // 096 097 //javadoc: Subdiv2D::edgeDst(edge, dstpt) 098 public int edgeDst(int edge, Point dstpt) 099 { 100 double[] dstpt_out = new double[2]; 101 int retVal = edgeDst_0(nativeObj, edge, dstpt_out); 102 if(dstpt!=null){ dstpt.x = dstpt_out[0]; dstpt.y = dstpt_out[1]; } 103 return retVal; 104 } 105 106 //javadoc: Subdiv2D::edgeDst(edge) 107 public int edgeDst(int edge) 108 { 109 110 int retVal = edgeDst_1(nativeObj, edge); 111 112 return retVal; 113 } 114 115 116 // 117 // C++: int edgeOrg(int edge, Point2f* orgpt = 0) 118 // 119 120 //javadoc: Subdiv2D::edgeOrg(edge, orgpt) 121 public int edgeOrg(int edge, Point orgpt) 122 { 123 double[] orgpt_out = new double[2]; 124 int retVal = edgeOrg_0(nativeObj, edge, orgpt_out); 125 if(orgpt!=null){ orgpt.x = orgpt_out[0]; orgpt.y = orgpt_out[1]; } 126 return retVal; 127 } 128 129 //javadoc: Subdiv2D::edgeOrg(edge) 130 public int edgeOrg(int edge) 131 { 132 133 int retVal = edgeOrg_1(nativeObj, edge); 134 135 return retVal; 136 } 137 138 139 // 140 // C++: int findNearest(Point2f pt, Point2f* nearestPt = 0) 141 // 142 143 //javadoc: Subdiv2D::findNearest(pt, nearestPt) 144 public int findNearest(Point pt, Point nearestPt) 145 { 146 double[] nearestPt_out = new double[2]; 147 int retVal = findNearest_0(nativeObj, pt.x, pt.y, nearestPt_out); 148 if(nearestPt!=null){ nearestPt.x = nearestPt_out[0]; nearestPt.y = nearestPt_out[1]; } 149 return retVal; 150 } 151 152 //javadoc: Subdiv2D::findNearest(pt) 153 public int findNearest(Point pt) 154 { 155 156 int retVal = findNearest_1(nativeObj, pt.x, pt.y); 157 158 return retVal; 159 } 160 161 162 // 163 // C++: int getEdge(int edge, int nextEdgeType) 164 // 165 166 //javadoc: Subdiv2D::getEdge(edge, nextEdgeType) 167 public int getEdge(int edge, int nextEdgeType) 168 { 169 170 int retVal = getEdge_0(nativeObj, edge, nextEdgeType); 171 172 return retVal; 173 } 174 175 176 // 177 // C++: int insert(Point2f pt) 178 // 179 180 //javadoc: Subdiv2D::insert(pt) 181 public int insert(Point pt) 182 { 183 184 int retVal = insert_0(nativeObj, pt.x, pt.y); 185 186 return retVal; 187 } 188 189 190 // 191 // C++: int locate(Point2f pt, int& edge, int& vertex) 192 // 193 194 //javadoc: Subdiv2D::locate(pt, edge, vertex) 195 public int locate(Point pt, int[] edge, int[] vertex) 196 { 197 double[] edge_out = new double[1]; 198 double[] vertex_out = new double[1]; 199 int retVal = locate_0(nativeObj, pt.x, pt.y, edge_out, vertex_out); 200 if(edge!=null) edge[0] = (int)edge_out[0]; 201 if(vertex!=null) vertex[0] = (int)vertex_out[0]; 202 return retVal; 203 } 204 205 206 // 207 // C++: int nextEdge(int edge) 208 // 209 210 //javadoc: Subdiv2D::nextEdge(edge) 211 public int nextEdge(int edge) 212 { 213 214 int retVal = nextEdge_0(nativeObj, edge); 215 216 return retVal; 217 } 218 219 220 // 221 // C++: int rotateEdge(int edge, int rotate) 222 // 223 224 //javadoc: Subdiv2D::rotateEdge(edge, rotate) 225 public int rotateEdge(int edge, int rotate) 226 { 227 228 int retVal = rotateEdge_0(nativeObj, edge, rotate); 229 230 return retVal; 231 } 232 233 234 // 235 // C++: int symEdge(int edge) 236 // 237 238 //javadoc: Subdiv2D::symEdge(edge) 239 public int symEdge(int edge) 240 { 241 242 int retVal = symEdge_0(nativeObj, edge); 243 244 return retVal; 245 } 246 247 248 // 249 // C++: void getEdgeList(vector_Vec4f& edgeList) 250 // 251 252 //javadoc: Subdiv2D::getEdgeList(edgeList) 253 public void getEdgeList(MatOfFloat4 edgeList) 254 { 255 Mat edgeList_mat = edgeList; 256 getEdgeList_0(nativeObj, edgeList_mat.nativeObj); 257 258 return; 259 } 260 261 262 // 263 // C++: void getTriangleList(vector_Vec6f& triangleList) 264 // 265 266 //javadoc: Subdiv2D::getTriangleList(triangleList) 267 public void getTriangleList(MatOfFloat6 triangleList) 268 { 269 Mat triangleList_mat = triangleList; 270 getTriangleList_0(nativeObj, triangleList_mat.nativeObj); 271 272 return; 273 } 274 275 276 // 277 // C++: void getVoronoiFacetList(vector_int idx, vector_vector_Point2f& facetList, vector_Point2f& facetCenters) 278 // 279 280 //javadoc: Subdiv2D::getVoronoiFacetList(idx, facetList, facetCenters) 281 public void getVoronoiFacetList(MatOfInt idx, List<MatOfPoint2f> facetList, MatOfPoint2f facetCenters) 282 { 283 Mat idx_mat = idx; 284 Mat facetList_mat = new Mat(); 285 Mat facetCenters_mat = facetCenters; 286 getVoronoiFacetList_0(nativeObj, idx_mat.nativeObj, facetList_mat.nativeObj, facetCenters_mat.nativeObj); 287 Converters.Mat_to_vector_vector_Point2f(facetList_mat, facetList); 288 facetList_mat.release(); 289 return; 290 } 291 292 293 // 294 // C++: void initDelaunay(Rect rect) 295 // 296 297 //javadoc: Subdiv2D::initDelaunay(rect) 298 public void initDelaunay(Rect rect) 299 { 300 301 initDelaunay_0(nativeObj, rect.x, rect.y, rect.width, rect.height); 302 303 return; 304 } 305 306 307 // 308 // C++: void insert(vector_Point2f ptvec) 309 // 310 311 //javadoc: Subdiv2D::insert(ptvec) 312 public void insert(MatOfPoint2f ptvec) 313 { 314 Mat ptvec_mat = ptvec; 315 insert_1(nativeObj, ptvec_mat.nativeObj); 316 317 return; 318 } 319 320 321 @Override 322 protected void finalize() throws Throwable { 323 delete(nativeObj); 324 } 325 326 327 328 // C++: Subdiv2D(Rect rect) 329 private static native long Subdiv2D_0(int rect_x, int rect_y, int rect_width, int rect_height); 330 331 // C++: Subdiv2D() 332 private static native long Subdiv2D_1(); 333 334 // C++: Point2f getVertex(int vertex, int* firstEdge = 0) 335 private static native double[] getVertex_0(long nativeObj, int vertex, double[] firstEdge_out); 336 private static native double[] getVertex_1(long nativeObj, int vertex); 337 338 // C++: int edgeDst(int edge, Point2f* dstpt = 0) 339 private static native int edgeDst_0(long nativeObj, int edge, double[] dstpt_out); 340 private static native int edgeDst_1(long nativeObj, int edge); 341 342 // C++: int edgeOrg(int edge, Point2f* orgpt = 0) 343 private static native int edgeOrg_0(long nativeObj, int edge, double[] orgpt_out); 344 private static native int edgeOrg_1(long nativeObj, int edge); 345 346 // C++: int findNearest(Point2f pt, Point2f* nearestPt = 0) 347 private static native int findNearest_0(long nativeObj, double pt_x, double pt_y, double[] nearestPt_out); 348 private static native int findNearest_1(long nativeObj, double pt_x, double pt_y); 349 350 // C++: int getEdge(int edge, int nextEdgeType) 351 private static native int getEdge_0(long nativeObj, int edge, int nextEdgeType); 352 353 // C++: int insert(Point2f pt) 354 private static native int insert_0(long nativeObj, double pt_x, double pt_y); 355 356 // C++: int locate(Point2f pt, int& edge, int& vertex) 357 private static native int locate_0(long nativeObj, double pt_x, double pt_y, double[] edge_out, double[] vertex_out); 358 359 // C++: int nextEdge(int edge) 360 private static native int nextEdge_0(long nativeObj, int edge); 361 362 // C++: int rotateEdge(int edge, int rotate) 363 private static native int rotateEdge_0(long nativeObj, int edge, int rotate); 364 365 // C++: int symEdge(int edge) 366 private static native int symEdge_0(long nativeObj, int edge); 367 368 // C++: void getEdgeList(vector_Vec4f& edgeList) 369 private static native void getEdgeList_0(long nativeObj, long edgeList_mat_nativeObj); 370 371 // C++: void getTriangleList(vector_Vec6f& triangleList) 372 private static native void getTriangleList_0(long nativeObj, long triangleList_mat_nativeObj); 373 374 // C++: void getVoronoiFacetList(vector_int idx, vector_vector_Point2f& facetList, vector_Point2f& facetCenters) 375 private static native void getVoronoiFacetList_0(long nativeObj, long idx_mat_nativeObj, long facetList_mat_nativeObj, long facetCenters_mat_nativeObj); 376 377 // C++: void initDelaunay(Rect rect) 378 private static native void initDelaunay_0(long nativeObj, int rect_x, int rect_y, int rect_width, int rect_height); 379 380 // C++: void insert(vector_Point2f ptvec) 381 private static native void insert_1(long nativeObj, long ptvec_mat_nativeObj); 382 383 // native support for java finalize() 384 private static native void delete(long nativeObj); 385 386}