1
$\begingroup$

I need for an algorithm which do steps, displayed on image below. Are solutions for doing this exist? (Preferably on C# or JavaScript).

Skyline alignment algorithm steps

$\endgroup$
1
  • $\begingroup$ Remember that this is a signal processing site, not a programming site, so try and avoid simply asking for source-code. $\endgroup$ Aug 2, 2013 at 20:00

2 Answers 2

2
$\begingroup$

You could try detecting line segments in the image for example using hough transform, or maybe lswms, edlines or lsd.

After detecting the lines, you can compute their length and angle and find the longest almost horizontal line. If you are lucky, this line will be the horizon and you can rotate the whole image in the opposite direction to get the aligned image.

This might work but it will depend on how good the horizon is visible and how well it is detected.

Maybe you could find a number of potential horizon lines and have the user select the best one.

On second thought, if you involve users into this, just let them draw the horizon and then rotate the image. That's not really what you were asking for, but it will probably work better than what I suggested above. :)

$\endgroup$
0
$\begingroup$

I'm not expert in image processing, but if I had to try something I would

1) convert the image to grayscale
2) do some denoising (maybe with a median filter) and thresholding
3) use principal component analysis to find the orientation

$\endgroup$
1
  • 1
    $\begingroup$ There is no reason to think that the horizon is going to dominate the principle components. $\endgroup$ Aug 1, 2013 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.