I would like to create a LabView VI that receives an input image and the RGB-color codes of the powerlines depicted in the image. The output should (eventually) consist of id'd polygonial connections and their coordinates.

Right now i've finished creating a VI that converts the source image to a binary image with the respective line color types extracted into a binary image (see below).

I've been trying to apply some of edge/line finding VIs supplied by LabView Vision, but the results have not been very convincing.

I have considered implementing some sort of vectorization algorithm like 'Straight Line Extraction Using Iterative Total Least Squares Methods' or even some sort of line-walking-and-mapping algorithm, but before I do so I'd like to know if there already is some kind of fitting algorithm out there.

Attached you can find examples for the source and binary images.

Thanks in advance for your input!

Source image (in this case a snipped of poland) binary image of extracted green lines binary image of extracted red lines


1 Answer 1


The go-to algorithm for extracting edges is to transform the image the an appropriate Hough space. Luckily, the Hough transformation for extracting straight lines is one of the best documented.

It looks like these folks may have a Hough transformation implementation for LabVIEW you could use. If not, it's a pretty well documented algorithm and you could try to roll your own or try to integrate an implementation from another language, eg: MatLab, OpenCV.

With the appropriate Hough transformation, you would be able to extract line segments from your image (converting to a binary image is a great start). These line segments may not connect perfectly, depending on how straight your line is and how clear your image is, and you may need to process the vectors a bit more to get the results you desire.

  • $\begingroup$ PS: you may be able to clean up your binary images a bit further using binary morphology techniques. $\endgroup$ Jan 6, 2013 at 16:55
  • $\begingroup$ Hello John and thank you for your extensive answer. $\endgroup$ Jan 6, 2013 at 19:08
  • $\begingroup$ I've uploaded an example to show the current result, but the lines found are only very rough approximations to the desired result. Am I misinterpreting the usage of this transformation? Is it more like an iterative approach (find first, extract single line from source and save, repeat?) $\endgroup$ Jan 6, 2013 at 19:13
  • 1
    $\begingroup$ The Hough transformation can take some fiddling to get right for your use case. The two problems here, it seems, are that it is connecting disparate lines just because they line up and that you are only getting the most significant of these. As you simplified your problem by preprocessing the image, you can lower your threshold a lot to bring in more lines. Also, perhaps a sliding window based approach would give better detail. We shouldn't have a long conversation here though, if the Hough transform brings up questions you'll find lots of folks willing to answer specifics on here. Cheers. $\endgroup$ Jan 6, 2013 at 19:29
  • 1
    $\begingroup$ Here is nice resource with 'guidelines for use': homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm (sorry if the link rots) $\endgroup$ Jan 6, 2013 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.