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 getLeadingEdgeList(vector_int& leadingEdgeList) 264 // 265 266 //javadoc: Subdiv2D::getLeadingEdgeList(leadingEdgeList) 267 public void getLeadingEdgeList(MatOfInt leadingEdgeList) 268 { 269 Mat leadingEdgeList_mat = leadingEdgeList; 270 getLeadingEdgeList_0(nativeObj, leadingEdgeList_mat.nativeObj); 271 272 return; 273 } 274 275 276 // 277 // C++: void getTriangleList(vector_Vec6f& triangleList) 278 // 279 280 //javadoc: Subdiv2D::getTriangleList(triangleList) 281 public void getTriangleList(MatOfFloat6 triangleList) 282 { 283 Mat triangleList_mat = triangleList; 284 getTriangleList_0(nativeObj, triangleList_mat.nativeObj); 285 286 return; 287 } 288 289 290 // 291 // C++: void getVoronoiFacetList(vector_int idx, vector_vector_Point2f& facetList, vector_Point2f& facetCenters) 292 // 293 294 //javadoc: Subdiv2D::getVoronoiFacetList(idx, facetList, facetCenters) 295 public void getVoronoiFacetList(MatOfInt idx, List<MatOfPoint2f> facetList, MatOfPoint2f facetCenters) 296 { 297 Mat idx_mat = idx; 298 Mat facetList_mat = new Mat(); 299 Mat facetCenters_mat = facetCenters; 300 getVoronoiFacetList_0(nativeObj, idx_mat.nativeObj, facetList_mat.nativeObj, facetCenters_mat.nativeObj); 301 Converters.Mat_to_vector_vector_Point2f(facetList_mat, facetList); 302 facetList_mat.release(); 303 return; 304 } 305 306 307 // 308 // C++: void initDelaunay(Rect rect) 309 // 310 311 //javadoc: Subdiv2D::initDelaunay(rect) 312 public void initDelaunay(Rect rect) 313 { 314 315 initDelaunay_0(nativeObj, rect.x, rect.y, rect.width, rect.height); 316 317 return; 318 } 319 320 321 // 322 // C++: void insert(vector_Point2f ptvec) 323 // 324 325 //javadoc: Subdiv2D::insert(ptvec) 326 public void insert(MatOfPoint2f ptvec) 327 { 328 Mat ptvec_mat = ptvec; 329 insert_1(nativeObj, ptvec_mat.nativeObj); 330 331 return; 332 } 333 334 335 @Override 336 protected void finalize() throws Throwable { 337 delete(nativeObj); 338 } 339 340 341 342 // C++: Subdiv2D(Rect rect) 343 private static native long Subdiv2D_0(int rect_x, int rect_y, int rect_width, int rect_height); 344 345 // C++: Subdiv2D() 346 private static native long Subdiv2D_1(); 347 348 // C++: Point2f getVertex(int vertex, int* firstEdge = 0) 349 private static native double[] getVertex_0(long nativeObj, int vertex, double[] firstEdge_out); 350 private static native double[] getVertex_1(long nativeObj, int vertex); 351 352 // C++: int edgeDst(int edge, Point2f* dstpt = 0) 353 private static native int edgeDst_0(long nativeObj, int edge, double[] dstpt_out); 354 private static native int edgeDst_1(long nativeObj, int edge); 355 356 // C++: int edgeOrg(int edge, Point2f* orgpt = 0) 357 private static native int edgeOrg_0(long nativeObj, int edge, double[] orgpt_out); 358 private static native int edgeOrg_1(long nativeObj, int edge); 359 360 // C++: int findNearest(Point2f pt, Point2f* nearestPt = 0) 361 private static native int findNearest_0(long nativeObj, double pt_x, double pt_y, double[] nearestPt_out); 362 private static native int findNearest_1(long nativeObj, double pt_x, double pt_y); 363 364 // C++: int getEdge(int edge, int nextEdgeType) 365 private static native int getEdge_0(long nativeObj, int edge, int nextEdgeType); 366 367 // C++: int insert(Point2f pt) 368 private static native int insert_0(long nativeObj, double pt_x, double pt_y); 369 370 // C++: int locate(Point2f pt, int& edge, int& vertex) 371 private static native int locate_0(long nativeObj, double pt_x, double pt_y, double[] edge_out, double[] vertex_out); 372 373 // C++: int nextEdge(int edge) 374 private static native int nextEdge_0(long nativeObj, int edge); 375 376 // C++: int rotateEdge(int edge, int rotate) 377 private static native int rotateEdge_0(long nativeObj, int edge, int rotate); 378 379 // C++: int symEdge(int edge) 380 private static native int symEdge_0(long nativeObj, int edge); 381 382 // C++: void getEdgeList(vector_Vec4f& edgeList) 383 private static native void getEdgeList_0(long nativeObj, long edgeList_mat_nativeObj); 384 385 // C++: void getLeadingEdgeList(vector_int& leadingEdgeList) 386 private static native void getLeadingEdgeList_0(long nativeObj, long leadingEdgeList_mat_nativeObj); 387 388 // C++: void getTriangleList(vector_Vec6f& triangleList) 389 private static native void getTriangleList_0(long nativeObj, long triangleList_mat_nativeObj); 390 391 // C++: void getVoronoiFacetList(vector_int idx, vector_vector_Point2f& facetList, vector_Point2f& facetCenters) 392 private static native void getVoronoiFacetList_0(long nativeObj, long idx_mat_nativeObj, long facetList_mat_nativeObj, long facetCenters_mat_nativeObj); 393 394 // C++: void initDelaunay(Rect rect) 395 private static native void initDelaunay_0(long nativeObj, int rect_x, int rect_y, int rect_width, int rect_height); 396 397 // C++: void insert(vector_Point2f ptvec) 398 private static native void insert_1(long nativeObj, long ptvec_mat_nativeObj); 399 400 // native support for java finalize() 401 private static native void delete(long nativeObj); 402 403}