Process list of points to obtain contours.

Feb 27 2015 1:55 PM
Hello!


I hope you can help me out on this one! My objective is to recognise contours from a large number of data points. I have a List<string> containing points coordinates in the following fashion:
List<string> input
#Set 0
#Start
X0 Y0 Z0,
X1 Y1 Z1,
  ...
Xm Ym Zm,
#End
#Set 1
#Start
X0 Y0 Z0,
X1 Y1 Z1,
  ...
Xn Yn Zn,
#End
#Start
X0 Y0 Z0,
X1 Y1 Z1,
  ...
Xk Yk Zk,
#End
#Set 2
#Start
  …
#End
  ...
Each Set runs from the tags #Start to #End. The tag #EdgeSet will not affect the algorithm at all so it can be skipped by the code.
I have found a very nice code for image recognition (it can be downloaded  here , also attached)  that inputs a picture and return the contours.  "Part 3" in the same link explain briefly what classes are in there.
What I would like to do is to modify this code in order to be able to input my INPUT List (instead of the  picture) from another program and return two lists in the same format as the input:
  1. List<string> outAllSets : result of taking the points of each set individually.
  1. List<string> outSelectedSets: result of taking the points of all the sets at the same time.
NB1: The outAllSets list will contain the same number of contours as the input list.
NB2: The outSelectedSets list will contain less contours than the input list because the input list will contain already similar contours that will be merged into one. 
NB3: This is a 2D problem, so the input list will always have one column equal to zero (the same one for all the sets) but we do not know which one. 


How could this be implemented?

An example input list is as follows:


#EdgeSet 0   
#Start   
0  0  0,    
20  0  0,    
20  20  0,   
0  20  0,    
0  0  0,    
#End   
#Start   
0  0  0,    
18  0  0,    
18  18  0,    
0  18  0,    
0  0  0,    
#End   
#EdgeSet 1   
#Start   
0  0  0,    
20  0  0,    
20  40  0,    
0  20  0,    
0  0  0,    
#End   
#EdgeSet 2   
#Start   
20  0  0,    
20  20  0,    
0  20  0,   
0  0  0,    
20  0  0,    
#End   
#Start   
0  0  0,    
18  0  0,    
18  18  0,    
0  0  0,    
#End     



Many thanks for your help!

Attachment: contouranalysis.zip