Could use help editing this C OpenCV code so it will run ....uses CvGraph

asked 2013-11-08 19:58:35 -0500

joeish80829 gravatar image

I could use help getting the code here to run http://blog.csdn.net/honpey/article/details/8795228 directly underneath the three typdef structs and the and the graph picture... Im trying to run it to learn about CvGraph struct and related functions. when i run it i get error:

error: ‘Edges_addr’ was not declared in this scope cvGraphAddEdge(graph,edge_start[i],edge_end[i],&Edges[i],&Edges_addr[i]);

I dont want to edit it myself because i wouldnt know how to edit but still preserve the authors intention ....so i could use help just declaring edges_addr correctly and understanding what the new operator is doing on this line(line 22)

CvGraphEdge *Edges = new CvGraphEdge[EdgeNum];

I know CvGraphEdge is a struct so is it essentially doing this :

 (CvGraphEdge)malloc(sizeof(CvGraphEdge*EdgeNum)) ?

any help on this is greatly valued=)

Cheers!

ps need to use C for a project is why =)

edit retag flag offensive close merge delete

Comments

CvGraphEdge * Edges = (CvGraphEdge*)malloc(sizeof(CvGraphEdge)*EdgeNum);

(2 errs in 1 line.)

and you've seen, that it's using set and queue ? good luck porting that back to c.

berak gravatar imageberak ( 2013-11-09 03:42:18 -0500 )edit

@berak what do you mean by good luck porting that into c ...isnt what you provided the correct translation of the new operator line in c...thx btw 4 that =) ....also can you help me with the Edges_addr part of my ?

joeish80829 gravatar imagejoeish80829 ( 2013-11-09 09:54:34 -0500 )edit

i mean you can't run it with a c compiler

can't help you with the rest. that code is simply not complete.

and the next time, you see comments in chinese, or french, or croatian - run!!

berak gravatar imageberak ( 2013-11-09 10:25:38 -0500 )edit

@berak thx for the info that helped me get started... any way you can post a piece of your old code that uses Cvgraph...maybe something thats easy to grasp for a CvGraph noob:)

joeish80829 gravatar imagejoeish80829 ( 2013-11-10 01:52:27 -0500 )edit