Algorithmia

Introduction to Horizon Line Estimation

Introduction to Detecting the Horizon Line in PhotosSingle image horizon line estimation is one of the most fundamental geometric problems in computer vision. Knowledge of the horizon line – the level of the viewer’s eye – enables a wide variety of applications, like detecting pedestrians or vehicles, and adjusting the perspective of photographs.

In machine learning, a convolutional neural network (CNN) is a type of artificial neural network that looks for regions within the image for patterns, which is inspired by the organization of the animal visual cortex.

What is Horizon Detection

Horizon Line ExamplesDeep Horizon is an implementation of the horizon line estimation algorithm. It is one of the latest algorithms added to the deep learning repository on Algorithmia.

The algorithm utilizes the power of convolutional neural networks to determine the horizon line in given images.

The algorithm best performs with photos that have multiple reference points, like buildings, streets, mountains, or other various objects.

One good example of using this algorithm could be for improving photo composition. By giving better information about the horizontal angle the photo was shot at, the algorithm can give users the information necessary to stabilize the photo digitally.

Stabilizing the photo digitally is especially useful for people who don’t have, or don’t want to obtain expensive hardware stabilizers.

Why You Need Horizon Detection

If you’re a developer who creates Photoshop plugins or your app or website works with photography, then you may find this algorithm useful. You can use this algorithm to tell you where the horizon is and can later use this information to crop your photo to the correct angle, and digitally stabilize the photo.

Best part is this can all be automated to run over hundred of photos in a matter of a few minutes.

Additionally, if you’re a deep learning researcher. this algorithm would help you by narrow your problem space.

Source Image

Sample Input

import Algorithmia

client = Algorithmia.client("YOUR_API_KEY_GOES_HERE")

input = {
  "image": "https://upload.wikimedia.org/wikipedia/commons/thumb/9/90/HFX_Airport_4.jpg/1280px-HFX_Airport_4.jpg"
}
result = client.algo("ukyvision/deephorizon").pipe(input).result

print result

Sample Output

{
  "left": [-640, 294.98985200147615],
  "right": [640, 292.69899981705186]
}

Horizon Line Location

Conclusion

Deep Horizon is an algorithm that utilizes the power of deep learning to extract the horizon coordinates of any given photo to empower your service/app.

It uses a special type of neural network to identify regions in an image to help you better detect horizons.

The magic and heavy lifting is handled behind the Algorithmia API, so you can just focus on developing your app, and not worry about servers or infrastructure.

Let us know what you think! @Algorithmia

Algorithm Engineer at Algorithmia, helps make complicated things simpler. Believes that Machine Intelligence will have a huge impact on our lives in the days to come, and hopes to have a defining role in shaping this new future.

More Posts

Follow Me:
TwitterLinkedIn