0

I have an edge map of a scene and would like to extract the edge which best separates the sky and terrain. This seems to be well framed as a graph traversal problem. However, popular search algorithms such as A* are reliant upon the use of a starting and ending point (other than the first and last column respectively). Are there any algorithms for graph search which do not require these parameters? I would also like to maximize some global features of the extracted edge such as smoothness. Note: speed is a significant issue, this needs to be done in real time.

eagle34
  • 1,424
  • 1
  • 15
  • 19

1 Answers1

1

Computer vision researchers have attacked this type of problem with minimum cuts. Wikipedia has a whole article about graph cuts in computer vision. I'll sketch here the algorithm proposed by Greig, Porteous, and Seheult, who were the first to make this connection.

Suppose that we have a function from pixel colors to log likelihoods of how likely that pixel is to be sky versus terrain. Prepare a graph with a source vertex, a sink vertex, and a vertex for each pixel. Connect the source to each pixel with capacity equal to the log likelihood of that pixel being sky. Connect each pixel to the sink with capacity equal to the log likelihood of that pixel being terrain. For each pair of adjacent pixels, connect them with capacity equal to the log likelihood of them having different classifications. Compute a minimum cut. All of the vertices on the source side of the cut are classified as sky, and all of the vertices on the sink side of the cut are classified as terrain.

Alternatively, if the terrain is known to be at the bottom of the image and the sky is known to be at the top, connect the source instead to each of the top pixels and connect the bottom pixels to the sink, with infinite capacity. Then we can dispense with the log likelihoods for classifying pixels based on color, leaving the edge capacities to vary with the similarity of adjacent pixel colors.

David Eisenstat
  • 64,237
  • 7
  • 60
  • 120
  • Ok, I am a little confused on how graph cuts can be used after applying an edge operator like Sobel or Canny. Could you elaborate? Ideally the solution would not rely on assumptions about pixel intensity, as it should work in a variety of environments. – eagle34 Sep 17 '14 at 20:27
  • @eagle234 The edge capacities should be set with a 2x1 edge operator (i.e., how different are these pixels?). You might want to blur the image first and give horizontal edges higher capacity than vertical. – David Eisenstat Sep 17 '14 at 21:23