Jump to content







Photo

Panoramic photos & horizon detection

Posted by EricBall, 16 November 2010 · 99 views

One side effect of buying a new camera (Panasonic FZ40 to replace a Canon S3) is I've rekindled my interest in panoramic photos. Using Hugin (free software) a series of overlapping photos can be assembled into one giant image. Doing this requires identifying "control points" which either link to photos together (i.e. this white dot on photo 1 is the same as this white dot on photo 2) or identify horizontal, vertical or straight lines. With enough control points, the software can determine the direction the camera was pointing, correct pitch and roll, and even adjust for less than perfect camera lenses or handheld photos.

Some of the photos I want to assemble look out at the ocean horizon. So I want to be able to add control points which identify the horizon as a straight and horizontal line across multiple photos. Thus I want to make those control points as accurate as possible. Right now I'm doing some research into edge/horizon detection, and playing around with some of my own ideas. What I want to be able to do is to build a utility which will load a JPEG and identify the horizon Y coordinates across the entire photo to sub-pixel accuracy.




What does it say when this blog entry is on the first page of a Google search for "horizon detection" ... done later in the day?
  • Report
The bots are running wild.
  • Report
Okay, I've done some work on it an have tested out my algorithm on one image.

Each column is processed separately (i.e. assume sky is at top, water below) and image is pre-processed to greyscale (luma only). A "target window" is also defined to help avoid false positives.

1. Use a 16 tap FIR edge filter (f[0..7]=1, f[8..15]=-1) to identify (via max value) the 16 pixels containing the horizon.
2. Use a 15 tap FIR low pass AC filter to isolate the zero crossing between two pixels.
3. Use linear interpolation between the filter output for those two pixels to determine the sub-pixel value for the horizon.

Hmm... I wonder if there would be any value in passing the LPF over the resulting values to smooth them out.
  • Report

May 2012

S M T W T F S
  12345
6789101112
13141516171819
202122 23 242526
2728293031  

Recent Comments

Search My Blog