Jump to content
  • entries
    334
  • comments
    900
  • views
    258,304

Panoramic photos & horizon detection


EricBall

773 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.

3 Comments


Recommended Comments

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?

Link to comment

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.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...