Kevin Meier
Kevin Meier

Reputation: 2572

Find edges of images

I have software that generates several images like the following four images:

image 01

image 02

image 03

image 04

Does an algorithm exist that detects the (horizontal & vertical) edges and creates a binary output like this?

enter image description here

If possible I'd like to implement this with numpy and scipy. I already tried to implement an algorithm, but I failed because I didn't find a place to start. I also tried to use a neural network to do this, but this seems to be overpowered and does not work perfectly.

Upvotes: 0

Views: 506

Answers (1)

Eskapp
Eskapp

Reputation: 3635

The simplest thing to try is to:

  • Convert your images to binary images (by a simple threshold)
  • Apply the Hough transform (OpenCV, Matlab have it already implemented)
  • In the Hough transform results, detect the peaks for angles 0 degree, + and - 90 degrees. (Vertical and horizontal lines)

In OpenCV and Matlab, you have extra options for the Hough transform which allow you to fill the gaps between two disconnected segments belonging to a same straight line. You may need a few extra operations for post-processing your results but the main steps should be these ones.

Upvotes: 1

Related Questions