Automatic Horizon Detection/Correction?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".

Automatic Horizon Detection/Correction?

Postby gco » 2009-04-20T23:37:13+00:00

I've searched quite a bit yet haven't been able to find any software that appears to be able to do automatic horizon correction. However, I did find this:

Horizon detection in still images or video sequences contributes to applications like image understanding, automatic correction of image tilt and image quality enhancement. In this paper, we propose an algorithm for detecting the horizon line in digital images, which employs an edge-based and a new color-based horizon detection technique. The color-based detector calculates an estimate of the horizon line by analyzing the color transition in the clear sky areas of the image. The edge-based detector computes the horizon line by finding the most prominent line or edge in the image, based on Canny edge detection and Hough transformation. The proposed algorithm combines the two detectors into a hybrid detection system, thereby taking advantage of their complimentary strengths. We have applied the algorithm on a manually annotated set of images and evaluated the accuracy of the position and angle of the detected horizon line. The experiments indicate the usefulness of the proposed color-based detector (40% lower error vs. the edge-based detector) and the benefit of the adopted approach for combining the two individual detectors (57% and 17% lower error vs. the edge-based and the color-based detectors, respectively).

http://cat.inist.fr/?aModele=afficheN&cpsidt=20620634

Think that's possible with ImageMagick? I have thousands of images that I'd like to automate the straightening of.
gco
 

Re: Automatic Horizon Detection/Correction?

Postby fmw42 » 2009-04-21T11:02:30+00:00

can you provide the exact algorithm? can you post a sample image of your problem?
User avatar
fmw42
 
Posts: 14512
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: Automatic Horizon Detection/Correction?

Postby gco » 2009-04-21T13:18:48+00:00

fmw42 wrote:can you provide the exact algorithm?

Nope. That's why I'm asking. :roll:

fmw42 wrote:can you post a sample image of your problem?

I'm sure you could easily find and use any photo in which the horizon isn't perfectly horizontal...........................................
gco
 

Re: Automatic Horizon Detection/Correction?

Postby fmw42 » 2009-04-21T13:34:21+00:00

IM has no such technique to my knowledge and without knowing exactly how it works, I doubt anyone will want to spend much time on it, but I could be wrong. It would appear to be a rather difficult concept and very image dependent, especially depending upon how separable in color, texture and content the sky is from the ground and with many possible obscurations such as trees and buildings. Ideas and suggestions are certainly welcome from others.
User avatar
fmw42
 
Posts: 14512
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: Automatic Horizon Detection/Correction?

Postby anthony » 2009-04-22T00:23:37+00:00

The Hough edge detection (or even circle detection) has yet to be implemented in IM.

Basically untill someone decides they would like to incorporate it it will not happen.

Note that circle /ellipse detection is often a core algorithm for face recognition as well.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
http://www.imagemagick.org/Usage/
User avatar
anthony
 
Posts: 8719
Joined: 2004-05-31T19:27:03+00:00
Location: Brisbane, Australia

Re: Automatic Horizon Detection/Correction?

Postby fmw42 » 2009-04-22T12:30:54+00:00

A Hough transform generally detects straight lines (or specific shapes such as circles). More specifically, once you have generated a straight line edge segment, it computes the orthogonal distance from the origin to the line and direction of the line.

However, any real horizon as seen in an image will not generally be straight as it will follow the terrain or be obscured by buildings and trees, etc. Thus a clear definition of what is meant by "horizon" is required. In fact, the true horizon will follow the curve of the earth, however, a picture, depending upon the height taken, might not even see to that horizon. The picture horizon may be even closer. A perspective horizon from a flat plane is also a very different thing.

Furthermore, it is not clear what one's goal is if any proper horizon can be detected? What is meant by "straightening"? Is that correcting for perspective tilt or just rotating the image? The former is very hard, since the location of the horizon line depends not only on perspective tilt, but height from which the image was taken. The latter may be a more reasonable goal.
User avatar
fmw42
 
Posts: 14512
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA


Return to Users

Who is online

Users browsing this forum: Yahoo [Bot] and 33 guests