Anaglyph Generator - Alessandro Francesconi

Transcript

Anaglyph Generator - Alessandro Francesconi
Anaglyph
Generator
Computer Science Department
University of Bologna, Italy
Francesconi Alessandro, Limone Gian Piero
December 2011
2
Presentazione.nb
1 ofItaly
15 - Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University ofSlide
Bologna,
What is AG?
The Anaglyph Generator (AG) program allows to generate a
3D anaglyph image from a classic 2D one.
Presentazione.nb
3
2 ofItaly
15 - Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University ofSlide
Bologna,
What is an Anaglyph?
An anaglyph is an image made up of two color layers, tipically
red and cyan, that, observed by the use of a particular type of
glasses, shows depth properties of the image giving the idea
of 3D.
The picture contains two differently filtered colored images,
one for each eye.
When viewed through the color coded "anaglyph glasses",
they reveal an integrated stereoscopic image.
The visual cortex of the brain fuses this into perception of a
3D scene or composition.
4
Presentazione.nb
3 ofItaly
15 - Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University ofSlide
Bologna,
Depth Information
A 3D image allows to the observer to better identify objects
composing the scene and their position in it providing depth
information.
To have these information in Computer Graphic, one of the
possibilities is to join the original image with the related depth
map, a gray scale image: objects placed closer to the
observer are depicted in white color, while, as the objects
move away to the background, they are darker depicted.
Presentazione.nb
5
6
Presentazione.nb
4 ofItaly
15 - Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University ofSlide
Bologna,
How to Create an Anaglyph (1/3)
To create an anaglyph it is necessary have got:
a) the original 2D image ® provides the original image to convert;
b) the related depth map ® gives depth information;
c) the shift_value ® suggests how many pixels the image
should be shifted.
The program consists of 3 phases:
1) Depth Map Study ® consider the depth map as a set of
depth levels; at depths greater match levels which pixels tend
to 0 value (black pixels) while to closer levels match pixels
with 1 tending values (white pixels). To simulate the nearness
or distance of the scene's objects from the observer each
pixel of the original image must be translated on the X-axis
by an offset value depends on shift_value; for each depth map's
(x,y) pixel, very dark values will corresponds a tranlation to a
side of the original image, brighter will corresponds translation to the other side, while, pixels whose values are around
0.5 will undergo minor changes.
2) Red and Cyan Images Construction ® applying to the
original image right and left side shift we will get 2 matrices
that, respectively, are then multiplied by 2 other matrices, first
one rappresenting red color, second one cyan.
3) Merge ® merging these 2 copies the final anaglyph is provided.
Presentazione.nb
5 ofItaly
15 - Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University ofSlide
Bologna,
How to Create an Anaglyph (2/3)
7
8
Presentazione.nb
6 ofItaly
15 - Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University ofSlide
Bologna,
How to Create an Anaglyph (3/3)
Presentazione.nb
9
7 ofItaly
15 - Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University ofSlide
Bologna,
Depth Map Retrieval (1/3)
The Algorithm used by AG to infer a depth map from the original image only is based on the “A Novel 2D-to-3D Conversion System Using Edge Information” (C.Cheng, C.Li, L.Chen) article.
To obtain the depth map:
1) Image Segmentation ® inside the original image are identified N color regions, based on the percentage of colors within
it;
2) for each pixel of every region is assigned an integer identifier number, from 1 to N;
3) to each region is applied the following formula:
10
Presentazione.nb
8 ofItaly
15 - Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University ofSlide
Bologna,
Depth Map Retrieval (2/3)
Depth Map gradients orientation:
a) left
Þ Wrl= 0, Wud= -1;
b) left-down Þ Wrl= 0.5, Wud= -0.5;
c) down
Þ Wrl= 1, Wud= 0 (Default Choice);
d) right-down Þ Wrl= -0.5, Wud= -0.5;
e) right
Þ Wrl= 0, Wud= 1.
Presentazione.nb
9 ofItaly
15 - Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University ofSlide
Bologna,
Depth Map Retrieval (3/3)
Þ
Blocks= 3 (Default value)
11
12
Presentazione.nb
Slide
10 ofItaly
15- Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University of
Bologna,
Let's see AG in
action ...
Presentazione.nb
13
Slide
11 ofItaly
15- Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University of
Bologna,
OBSERVATIONS
A)“ImageCapture" function does not work on Unix;
B) Image processor programs as Photoshop and Gimp allow
to manage the scaling operation by 3 functions, WRAP,
SMEAR and BLACK; AG provides it but without loosing
image informations in the interessed image area;
C) The AG program turns out to be a bit slow:
® Intel Pentium Dual CPU T3200 @ 2.00 GHz ;
® Depth Map Generation | 640x480 image | Blocks= 3 | 20.37 sec ;
® Anaglyph Generation | 640x480 image | 35.15 sec .
The end result has been obtained without the use of FOR
loops in the computation of matrices but using "Table" construct and replacing the use of "ImageValue" with
"ImageData" (during pixel information extraction);
D) The algorithm to create automatically the depth map does not work efficiently on all images...
14
Presentazione.nb
Slide
12 ofItaly
15- Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University of
Bologna,
Conclusions and Further Works
We note it is difficult obtain a depth map from a single image
and withot additional information; the algorithm used by AG is
good enough to do that but extremely optimizable.
1) optimization of depth map retrieval algorithm;
2) implementation of new depth map retrieval algorithms;
3) optimization of computation timing;
4) implementation of additional anaglyph color schemes.
Presentazione.nb
15
Slide
13 ofItaly
15- Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University of
Bologna,
References
®“A Novel 2D-to-3D Conversion System Using Edge Information”, Chao-Chung Cheng, Chung-Te Li, Liang-Gee Chen,
IEEE;
® http://3dtv.at/Knowhow/AnaglyphComparison_en.aspx ;
® GIMP® "Displace" function's source code, http://www.gimp.org/ ;
Possible future working readings:
®“Depth Estimation using Monocular and Stereo Cues”, A. Saxena, J. Schulte and A. Y. Ng, Stanford University CA;
®“Depth-Map Generation by Image Classification”, S. Battiato, S. Curti, M. La Cascia, M. Tortora, E. Scordato, STMicroelectronics- AST Catania LAB, University of Palermo.
16
Presentazione.nb
Slide
14 ofItaly
15- Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University of
Bologna,
Presentazione.nb
Slide
15 ofItaly
15- Francesconi Alessandro, Limone Gian Piero
Anaglyph Generator - University of
Bologna,
Any Question?
17