Anaglyph estimation from mono images
Anaglypher Python script for making anaglyph-3D maps from mono images.
Overview
Our study tries to estimate a depth map from a mono image. It is a difficult task and there are different ways to approach it. My approach uses outdoor images. The vanishing point is the place where two or more parallel lines (real or imaginary) converge towards infinity in an image. For example, the lines that generate the edges of a road and its projection towards infinity. The place where these lines intersect in a literal or imaginary way, is what we know as the vanishing point.

Data
This aproach needs outdoor images containing vanishing point.

Model
First convert image to grayscale and apply canny transform.

Then apply Hough transform to obtain the main lines in the image.

Transforming the parametric space (θ,ρ) to (x,y) and plot the lines.

Then we get the cut points between lines and select vanishing point as the cut point that have most cut points closer.

With the vanishing point coordinates, we build a Depth Map.

Finally, we construct with the depth map the parallax matrix and apply channel offset.

example.py
Full code available here
Direct Download




License
© 2018 Pedro Rodenas. MIT License
Originally published at pedrofrodenas.github.io on September 17, 2018.