indexing - Delaunay triangle OpenCV -



indexing - Delaunay triangle OpenCV -

i wondering if @ possible retrieve indices of neighboring vertices in cvsubdiv2d* subdivision using opencv.

cvsubdiv2dpoint* pt = cvsubdiv2dedgeorg( cvsubdiv2dedge border ); index= pt->id;

so if have list of coordinates, can find out illustration point 15 list connected via border points 300, 210, 400 , 76 list.

i know getting coordinates no problem, i'm not interested in that. want sure i'm not wasting time trying retrieve indices way , otherwise seek find other solution.

the way managed solve problem modifying cvpoint2d32f struct definition within types_c.h source file in order store index of point along coordinates after inserting subdivision.

here step-by-step procedure of did:

open types_c.h source file (which in case located in ~/opencv-2.4.3/modules/core/include/opencv2/core/types_c.h). add together field cvpoint2d32f struct used store index of points insert subdivision. example:

typedef struct cvpoint2d32f { float x; float y; int index; } cvpoint2d32f;

build source file 1 time again , install it.

before inserting point subdivision, create sure store index of point, in next piece of code:

int i; (i = 0; < size; i++) { fp = cvpoint2d32f(x[i], y[i]); fp.index = i; cvsubdivdelaunay2dinsert(subdiv, fp); }

when stepping through edges within subdivision can access index referring index field defined. example, in case, did follows:

cvsubdiv2dpoint* ptsub = cvsubdiv2dedgeorg(delaunay_edge); cvpoint2d32f pt32f = ptsub->pt; whatyouwant = pt32f.index;

hope helps. :)

opencv indexing triangulation delaunay

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -