Hi there

I am having some trouble getting gevd_edgel_regions to work for me and I was hoping someone on this list may have some insight into what is going one. If it is of any use, I am using VXL 1.10.0 with Visual Studio 2005 (not that this should matter I hope).

In a nutshell, I want to segment a region from an image and produce a polyline representation of its outline. The polyline needs to have as few vertices as possible to represent the underlying region completely, so I want to remove all the redundant points. This includes zig-zag artefacts.

My input image is a single plane byte image that has been thresholded and cast to boolean - it only contains one region that I want to segment. I can run other segmentation algorithms in VXL on it without any issues. I want to use gevd_edgel_regions so that I can smooth the line afterwards using sdet_contour::EqualizeSpacing(...) to get rid of the jagged edges (zig zags) on straight lines. Any suggestions as what else to use could be better than trying to make this work too!

My code is as follows:

//-----------------------------------------------------

// Recast the image to an image of bytes (not sure what input type it expects, have tried byte and bool)
vil_image_view<vxl_byte> imgByte;
vil_convert_cast(*myImagePtr, imgByte);
vil1_memory_image_of<vxl_byte> img1 = vil1_from_vil_image_view(imgByte);

// Setup finder
gevd_edgel_regions finder;
vcl_vector<vtol_edge_2d_sptr> sgrp;
vcl_vector<vtol_intensity_face_sptr> faces;

// Outline edges
finder.compute_edgel_regions(&img1, sgrp, faces);

// Smooth output chains
sdet_contour::EqualizeSpacing(sgrp);

// Get first chain
vtol_edge_2d_sptr e = chains[0];
vdgl_digital_curve_sptr dc = e->curve()->cast_to_vdgl_digital_curve();
const int len = dc->get_interpolator()->get_edgel_chain()->size();

// Get output polyline
for (int qq=0; qq < len; ++qq)
{
vdgl_edgel e = dc->get_interpolator()->get_edgel_chain()->edgel(qq);

// Output vertices to external classes
// ...
}

//-----------------------------------------------------

When I run this bit of code, the method compute_edgel_regions returns immediately and doesn't do anything. I am using the release builds, so maybe I should swap to the debug libraries, but I am not getting any output, even when I ask for it. No edges or faces are output, so I'm guessing an input is wrong.

What I would like to know is how to use this class properly, because something I am doing is not right. Any pointers would be great.

Another way around that I have tried, is to pass in a list of edges, but I'm struggling with setting the topology up correctly, I am not that familiar with vtol and vsol. I imagine this is easy to do if you know how!

Thanks
Mark