Professional Documents
Culture Documents
High Frequency Shape Estimation From Shading in Color Images
High Frequency Shape Estimation From Shading in Color Images
and
the direction of the light sourceS
and the
source direction S
as follow:
) cos( ) (
i
S N S N = -
(2)
From equation (2) we can get as the following formula:
2 2 2 2 2 2
) (
) cos(
z y x z y x
z
y
x
z
y
x
i
s s s n n n
s
s
s
n
n
n
S N
S N
+ + + +
|
|
|
.
|
\
|
|
|
|
.
|
\
|
-
=
(3)
where the (
z y x
n n n , , ) and (
z y x
s s s , , ) denoted
the direction of surface normal and illumination source
light direction respectively.
By substituting from equation (3) into equation (1) we can
write the Lambertian brightness as the following formula:
2 2 2 2 2 2
z y x z y x
z z y y x X
l
s s s n n n
s n s n s n
A I
+ + + +
+ +
= (4)
For a given light source distribution and a given surface
material, the reflectance for all surface orientations p and
q can be cataloged or computed to yield the reflectance
map R(p, q). Since the precise value for the image
irradiance depends on a variety of factors such as the
strength of the light source, the light-gathering ability of
the optical system, and many other factors that do not
affect reflectance qualitatively, the reflectance map is
normalized so that its maximum value is 1.
Combining this normalization with the assumption that
scene radiance equals image irradiance yields the image
irradiance equation (brightness equation) [7]. Which says
that the irradiance (brightness) at point (x, y) in the image
plane is equal to the reflectance map value for the.
Surface orientation p and q of the corresponding point on
the scene surface. For a Lambertian reflector and point
light source, the reflectance map R(p, q) is given by the
following equation:
)) , ( ), , ( ( ) , ( ) , ( y x q y x p R q p R y x I = =
(5)
Where I(x,y) the input image irradiance, are the surface
orientation component with respect to x and y axis. Z(x,y)
be the range image corresponding to the true 3D shape
and the surface height of the 3D object above the (x,y)
plane [7].
For the Lambertian surface, we write:
) ( ) , (
i
COS q p R =
(6)
From equations (3),(5) and (6) we can write the
brightness equation as the following:
1
) , ( ) , (
2 2 2 2 2
+ + + +
+ +
= =
q p s s s
s qs ps
q p R y x I
z y x
z y x
(7)
Note: the normal of the once-differentiable surface, z, at
point (x,y,z(x,y)) can be written as:
) 1 ), , ( ), , ( ( ) , , ( y x q y x p n n n
z y x
= (8)
The brightness equation (7) is define as the brightness
distribution of the shading image of that surface and the
brightness values are define by the properties of the
surface such as orientation, reflectively, illumination and
reflectance map R(p,q).
4. Problem Description
To solve the shape from shading problem, it is important
to study how the images are formed. A simple model of
image formation is the Lambertian model, in which the
gray level at a pixel in the image depends on the light
source direction and the surface normal. In SfS, given a
gray level image, the aim is to recover the light source
and the surface shape at each pixel in the image.
However, real images do not always follow the
Lambertian model [6]. Even if we assume Lambertian
reflectance and known light source direction, and if the
brightness can be described as a function of surface shape
and light source direction, the problem is still not simple.
This is because if the surface shape is described in terms
of the surface normal, we have a linear equation with
three unknowns, and if the surface shape is described in
terms of the surface gradient, we have a non-linear
equation with two unknowns. Therefore, finding a unique
solution to SfS is difficult; it requires additional
constraints [22]. Image intensity at a pixel as a function
of the surface orientation of the corresponding scene point
is captured in a reflectance map. Thus, for fixed
illumination and imaging conditions, and for a surface
with known reflectance properties, changes in surface
orientation translate into corresponding changes in image
intensity. The inverse problem of recovering surface
shape from changes in image intensity is known as the
shape from shading problem. We now summarize the
procedure for solving this problem using the constraint of
International Journal of EmergingTrends & Technology in Computer Science(IJETTCS)
Web Site: www.ijettcs.org Email: editor@ijettcs.org
Volume 3, Issue 3, May June 2014 ISSN 2278-6856
Volume 3, Issue 3 May June 2014 Page 110
integrability [4]. From the previous section, the
relationship between image irradiance E(x,y) and the
orientation (p,q) of the corresponding point on the surface
is given by equation (7).
The goal is to recover surface shape by calculating the
orientation (p, q) on the surface for each point (x, y) in
the image. Note that we have only one equation, but there
are two unknowns, p and q. Thus, this problem cannot be
solved unless additional constraints are imposed. A
commonly imposed constraint is that integrability
constraint. Equation (7) is a first order nonlinear partial
differential equation in x and y. It has been observed that
shape from shading can be expressed as a problem of
solving a first-order nonlinear partial differential equation
in x and y. In deriving iterative solutions to equation (7)
by the calculus of variations, it appears to be much more
straightforward to solve for surface orientation than to
solve directly for Z, the question of consistency between
p(x,y) and q(x,y) arises and leads us to search for an
integrable solution [4]. The integrability constraint satisfy
the valid surface that is Zxy =Zyx.
A nonintegerable solution will give rise to an infinite
number for solutions for the problem of shape from
shading. An iterative solution for equation.(7), seek p(x,y)
and q(x,y) values that minimize the total square
brightness error F(p,q) over region in xy plane. The
square brightness error F(p,q) define the difference
between the original irradiance image I(x,y) and the
computed gray scale image resulted from substituting p(x,
y) and q(x,y) in the reflectance map R(p, q) at point (x,y).
See equation (9):
dxdy y x R y x I q p F
}}
O
=
2
)) , ( ) , ( ( ) , ( (9)
In this paper, our method estimating the high surface and
satisfies the constraint of integrability condition without
resorting to additional Fourier Transform (FT) [5], stages
is provided. The problem of finding integrable solution in
the SfS problem can be simplified if the unknown surface
height is represented in a form that satisfies the constraint
of integrability. The unknown surface height Z(x,y) can be
expanded on a complete set of basis function ) , ( y x
ij
u
as the following:
= =
u =
n
i
ij
n
i
y x y x Z
0 0
) , ( ) , ( (10)
The surface orientation p(x, y) and q(x, y) can be written
as:
= =
c
u c
=
n
i
ij
n
i
x
y x
y x p
0 0
) , (
) , ( (11)
= =
c
u c
=
n
i
ij
n
i
y
y x
y x q
0 0
) , (
) , ( (12)
The suggested method depends on estimating the values
of p(x,y) and q(x,y) that minimize the cost function U(x,y)
which based on square brightness error F(p,q) and lack of
smoothness [19], such that:-
dxdy q q p p
q p R y x I y x U
y x y x
)) (
)) , ( ) , ( ((( ) , (
2 2 2 2
2
+ + + +
+ =
}}
O
(13)
where the first term represented the square of the
difference between the image brightness and the resultant
brightness using the reflectance map R(p(x, y),q(x, y)), the
second term represents the smoothness, where p
x
(x, y),
q
x
(x, y), p
y
(x, y), and q
y
(x ,y) represents the derivatives of
the surface.
The expression
) (
2 2 2 2
y x y x
q q p p + + +
is instead best
regarded as a regularizing term that is primarily intended
as a means of finding a particularly smooth shape that is
close to a solution of the original problem. Different
surfaces will give rise to different values for the integral
the expressions
) (
2 2 2 2
y x y x
q q p p + + +
, is a scalar
that assigns a relative weighting to the terms. The
distortion due to regularization depends on the
parameter . A large value of appropriate when the
image data is very noisy, leads to large errors, since the
emphasis will be on producing as smooth a surface as
possible, while permitting considerable error in
brightness. Conversely, a small value for cause's
brightness errors to be weighted more. In this case, a
more undulating surface is acceptable since the
contribution of the regularizing term to the overall
functional is relatively small.
4.1 Algorithm for the constraint of Integrality.
Shape from shading is a technique for estimating surface
shape from a camera image using variations in the
observed brightness across that surface. The solution to
the shape-from-shading problem requires long-range
error to be reduced through strictly local interactions.
This situation arises mainly from the local nature of the
representation used for gradient and height fields and
causes very large number of iterations in the iterative
scheme [7]. Multi grid methods are often used in
computer vision to speed up computationally intensive
tasks such as shape-from-shading [1]. In these methods,
an integrable solution computed for a reduced image is
used to guide the algorithm toward the complete solution
on a larger image. The unknown surface height map
Z(x,y) can be expanded on a complete set of basis
function. We suppose that the function take the form:
= =
+ = u
n
i
j i j i
n
i
ij
y x
j i
Y X y x
0 0
) ) sin( ) sin(
! !
1
( ) , ( (14)
and the surface of height map Z(x, y) can be written as:-
= =
+ =
n
i
j i j i
n
i
y x
j i
Y X y x Z
0 0
) ) sin( ) sin(
! !
1
( ) , (
(15)
From equations (11),(12) and (15) we can find the
surface orientation gradient, p(x, y) and q(x, y) as the
following form:
International Journal of EmergingTrends & Technology in Computer Science(IJETTCS)
Web Site: www.ijettcs.org Email: editor@ijettcs.org
Volume 3, Issue 3, May June 2014 ISSN 2278-6856
Volume 3, Issue 3 May June 2014 Page 111
=
+ =
n
i
j i i
j i
n
i
j
y
i
x x
Y iX y x p
0
) 1 (
1
0
)
!
) sin(
)! 1 (
) cos(
( ) , (
(16)
=
+ =
n
i
j j i
j i
n
i
j
y y
i
x
Y jX y x q
0
) 1 (
1
0
)
)! 1 (
) cos(
!
) sin(
( ) , (
(17)
where the surface of second derivatives
y y x x
q p q p , , ,
,satisfy the integrability condition Zxy=Zyx or
) , ( ) , ( y x q y x p
x y
=
then the constraint of intergrability
condition take the form:
=
=
+ =
n
i
ij
j i
n
i
y x N Y ijX y x W
0
1 1
0
)) , ( ( ) , ( (18)
where )
)! 1 (
) cos(
)! 1 (
) cos(
) , (
) 1 ( ) 1 (
=
j
y y
i
x x
y x N
j j i i
ij
The Euler equations for minimized the problem of
equation (13) can be simplified to read [6]:
0 )) , ( ) , ( (
2
= V + p R y x R y x I
p
(19)
0 )) , ( ) , ( (
2
= V + q R y x R y x I
q
(20)
where Rp and Rq are the partial derivatives of R(p,q) with
respect to p and q and,
2
2
2
2
2
y x c
c
+
c
c
= V
is the Laplacian operator.
At this point we introduce a discrete approximation of the
Laplacian. The Laplacian of a function at a given point is
approximately equal to a constant times the difference
between a local average of the function and its value at
the point. We use the simple finite difference
approximation as the form [19]:
] 4 ) [(
1
, 1 , 1 1 , 1 , 2
2
j i j i j i j i j i ij
p p p p p p + + + ~ V
+ +
(21)
] 4 ) [(
1
, 1 , 1 1 , 1 ,
2
2
j i j i j i j i j i ij
q q q q q q + + + ~ V
+ +
(22)
then
) (
4
2
2
j i j i ij
p p p ~ V
(23)
) (
4
2
2
j i j i ij
q q q ~ V
(24)
Where denotes the spacing between picture cells and
smoothness of the local average is given by:
] [
4
1
, 1 , 1 1 , 1 , j i j i j i j i j i
p p p p p
+ +
+ + + = (25)
] [
4
1
, 1 , 1 1 , 1 , j i j i j i j i j i
q q q q q
+ +
+ + + = (26)
By using the finite difference approximations from
equations, (23) and (24) in the Euler equations (19) and
(20), we obtain:
) , ( )) , ( ) , ( (
4
2
ij ij p ij ij ij ij ij
q p R q p R y x I p p + =
(27)
) , ( )) , ( ) , ( (
4
2
ij ij q ij ij ij ij ij
q p R q p R y x I q q + =
(28)
An iterative scheme can now be developed in which these
particular terms are considered to be new values to be
computed by inserting the current values into the
remainder of the expression, we finally arrive at the
scheme:
) , ( )) , ( ) , ( (
4
2
1 k
ij
k
ij p
k
ij
k
ij ij
k
ij
k
ij
q p R q p R y x I p p + =
+
(29)
) , ( )) , ( ) , ( (
4
2
1 k
ij
k
ij p
k
ij
k
ij ij
k
ij
k
ij
q p R q p R y x I q q + =
+
(30)
where, k denotes the iteration number.
The purposed High Map Function (HMF) method
procedure satisfies the constraint of integerability
condition and provides shading and 3D shape estimation
with low computational complexity compared to
conventional Fourier Transform Profilometry (FTP) based
methods [5] and the Perspective projection method (Pers
proj) [16].
The algorithm of the purposed method can be
summarized as following:
1: Input color image with known light source direction,
albedo and parameter .
2: Convert color image into gray scale image.
3: Start with initial random values for p
ij
and q
ij
.
4: Estimate the smoothness of , using equations 25, 26.
5: Compute the surface orientation pij and qij at a given
iteration (k=0, 1, 2,.,n) by equations 29,30.
6: Compute the cost function U(x,y) from equation 13.
7: Repeat the previous step 4, to step 6. Until the cost
function U(x,y) is stop decreasing or become sufficiently
small.
8: Estimate the 3D from equation 15.
9: End.
5. RESULTS AND DISCUSSIONS
The goal of SfS is to estimate 3D shape from a single
color image, under the assumption that albedo is uniform,
lighting originates from a single point from a known
direction, and the surface reflectance function is both
uniform and known. If we define x z p c c = / and
y z q c c = / , then I(x, y) = R(p, q), where I(x, y) is the
input image, and z is a range image corresponding to the
true 3D shape. A depth map z only exists if p and q are
integrable so that x q y p c c = c c / / .
To evaluate the performance of the new shape from
shading algorithm, we tested our proposed method on
different real world color images, with different sizes and
different intensity brightness distribution. The parameter
albedo and are constant and always positive value
[10], and without know boundary conditions. We are
going to discuss and implementation the shape form
shading technique by using our proposed method. Our
methods depend on estimating the value of surface
International Journal of EmergingTrends & Technology in Computer Science(IJETTCS)
Web Site: www.ijettcs.org Email: editor@ijettcs.org
Volume 3, Issue 3, May June 2014 ISSN 2278-6856
Volume 3, Issue 3 May June 2014 Page 112
orientation p(x,y) and q(x,y) which satisfy the constraint
of integrability condition Zxy=Zyx, and minimization the
cost function U(x,y), equation 13. After that we estimated
the height map of the surface in three dimensions (3D)
using equation 15.
We have illustrated our experiments on a set of real world
color images are taken by single camera at different
positions and sizes. Figure 3a1, show that the first
original lady color image, the second and third are two
hand color images with different shape and sizes, see
figures (4a2, 5a3). The forth image is vegetables color
image shown in figure (6a4), and fives image is small-
basket color image in figure (7a5). In our method before
estimation the shape from shading. We must be
converting the color images into gray level images that
are shown in figures (3b1, 4b2,5b3,6b5,7b5). The height
map has been extracted for each shading images using the
proposed method, the surface of high map can be
computed by using the equation 14. The results of our
proposed methods are illustrated by figures (3c1, 4c2,
5c3, 6c4, 7c5).
The performance of our High Map Function (HMF)
method has been tested with two methods, Fourier
Transform Profilometry (FTP) method [5] and
Perspective projection method (Pers proj) [16]. Fourier
transform profilometry method depends on the complex
function that is difficult to computed, comparing with my
proposed method which depends on simple function that
is easy to compute. The Fourier domain by definition is a
global transform such that a change in any pixel values
will affect the whole transform. On the other hand, the
proposed method is local mapping, such that any
variation in specific pixels will only affect the same set of
pixels and the rest will remain unchanged. Perspective
projection method uses multi-images with multi
reflectance map equations, which are difficult to
computed compering with our proposed method which
uses one equation of reflectance map. Table.1 shows the
performance evaluation between the purposed (HMP)
method and other methods, Fourier Transform
Profilometry (FTP), Perspective projection (Pers proj)
respectively, when computing the cost function with
square brightness error.
Table1. Performance evaluation between Our method and
FTP, Pers proj Methods
Object image
Percent error of cost function
Image
size in
pixels
Our HMP
method
FTP
method
Pers proj
method
lady image
256 256
0.122011 0.188735 0.403929
Hand1 image 208 211
0.089232 0.112171 0.412727
Hand2 image
205 210
0.010815 0.0236366 0.346738
Vegeta-
image
210 210
0.040760 0.0876898 0.294066
Basket image
128 128
0.285168 0.347612 0.661455
To comparing between our proposed method and other
methods (Fourier transform profilometry and Perspective
projection). We use cost function U(x,y) from equation
(13) at a given number of input images. Figure 2, show
that the proposed method has satisfy the values of p(x,y)
and q(x,y) that minimize the cost function U(x,y) which
based on square brightness error F(p,q), with comparing
than the values of Fourier transform profilometry and
Perspective projection methods.
Figure. 2, Square brightness error between Our method
and FTP, Pers proj Methods
a1) Original lady color image b1) lady gray image
c1) lady image in 3D shape
Figure 3, Results reconstruction of lady image
a2 ) Orignal hand1 image b2) hand1gray image
International Journal of EmergingTrends & Technology in Computer Science(IJETTCS)
Web Site: www.ijettcs.org Email: editor@ijettcs.org
Volume 3, Issue 3, May June 2014 ISSN 2278-6856
Volume 3, Issue 3 May June 2014 Page 113
c2) hand1 image in 3D shape
Figure 4, Results reconstruction of hand
1
image
a3) Original hand2 image b3) Gray hand2image
c3) hand2 image in 3D shape
Figure 5, Results reconstruction of hand
2
image
a4) Original vegetables image b4) vegetables gray image
c4) vegetables image in 3D shape
Figure 6, Results reconstruction of vegetables image
a5) Original basket image b5) basket gray image
c5) basket image in 3D shape
Figure 7, Results reconstruction of basket image
6. CONCLUSION AND THE FUTURE
DIRECTIONS
In this paper we have presented novel methods for
recovering the 3D representation of the object from single
image making use of shading information. The
contributions are twofold. Frist the color images are
present a problem for shape from shading methods
because it affects the apparent of shading. Second we
have posed the problem of recovering the height map
surface of the object. Our method is taste on real images
to estimate the 3D reconstruction from single 2D gray
scale image illuminated by a single source of
illumination. The proposed method depends on to suggest
the height map surface satisfy the constraint of
integrability condition and minimum value of cost
function. Shape reconstruction from shading image is an
important problem in computer vision. In the future the
present paper can be extended to estimate the 3D shape
from shading of non-lambertain surface. The constrain of
single source of illumination can be extended to study SfS
problem in the case of uniform source of illumination.
Also the constraint of integrability condition can be
extended into other constrain such that brightness
constraint.
References
[1] A. Ecker and A. D. Jepson. Polynomial shape from
shading. In CVPR, pages 145152, June 2010.
[2] A. A.H. Ahmed and A.A. Farag. A new formulation
for shape from shading for non-Lambertian surfaces.
In Proc. IEEE Conference on Computer Vision and
Pattern Recognition (CVPR), pages 18171824,
2006.
[3] Bao, S.Y, Savarese, S," Semantic structure from
International Journal of EmergingTrends & Technology in Computer Science(IJETTCS)
Web Site: www.ijettcs.org Email: editor@ijettcs.org
Volume 3, Issue 3, May June 2014 ISSN 2278-6856
Volume 3, Issue 3 May June 2014 Page 114
motion" Computer Vision and Pattern Recognition
(CVPR), IEEE Conference, pp, 2025 2032, 2013.
[4] B. Potetz. Efficient belief propagation for vision
using linear constraint nodes. In CVPR. 2007.
[5] Chunsheng Yu, Lushen Wu, Qingjin Peng "3D
Shape Acquisition Using an FTP-based Method in
Product Modeling" Proceedings of the Canadian
Design Engineering Network (CDEN), 2nd
International Conference, Kaninaskis, Alberta, July
18-20, 2005.
[6] E. Prados, F. Camilli, and O. Faugeras. A viscosity
method for Shape from Shading without boudary
data. Technical report, INRIA, To appear in 2004.
[7] E. Prados and O. Faugeras. A mathematical and
algorithmic study of the lambertian SFS problem for
orthographic and pinhole cameras. Technical Report
RR-5005, INRIA, November 2003.
[8] Fassold, H., Danzl, R., Schindler, K., Bischof, H.,
2004. Reconstruction of archaeological finds using
shape from stereo and shape from shading. In: Ninth
Computer Vision Winter Workshop, Piran, Slovenia,
pp. 2130.
[9] G. Oxholm and K. Nishino. Shape and reflectance
from natural illumination. In ECCV (1), pages 528
541, 2012
[10] J A Coakley "Reflectance and Albedo, Surface"
Oregon State University, 2003 Elsevier Science,
USA.
[11] J. T. Barron and J. Malik. High-frequency shape and
albedo from shading using natural image statistics. In
CVPR, 2011.
[12] J. T. Barron and J. Malik. Color constancy, intrinsic
images and shape estimation. In ECCV(4), pages 57-
70, 2012.
[13] J.-D. Durou, M. Falcone, and M. Sagona. Numerical
methods for shape-from-shading: A new survey with
benchmarks. Computer Vision and Image
Understanding, 109(1): 2243, 2008.
[14] Kimmel, R., Sethian, J ., 2001. Optimal algorithm for
shape from shading and path planning. Journal of
Mathematical Imaging and Vision 14 (3), 237244.
[15] L.-F. Yu, S.-K. Yeung, Y.-W. Tai, D. Terzopoulos,
and T. F. Chan. Outdoor photometric stereo. In
ICCP, 2013.
[16] Lei Yang, Ning Zhang, "Recovering Three-
Dimensional Surfaces with Multi-images Shape-
From-Shading Method" AsiaSim, Communications
in Computer and Information Science, pp 108-116,
2012
[17] M. Breu, E. Cristiani, J.-D. Durou, M. Falcone, and
O. Vogel. Perspective shape from shading:
Ambiguity analysis and numerical approximations.
SIAM J ournal on Imaging Sciences, 5(1):311342,
2012.
[18] M. K. Johnson and E. H. Adelson. Shape estimation
in naturalillumination. In CVPR, pages 25532560,
2011.
[19] P. Horn and M.J. Brooks, Height and gradient from
shading Int. J. Computer Vision 5(1), 3775 (1990).
[20] Q. Zheng and R. Chellappa. Estimation of illuminant
direction, albedo, and shape from shading. Trans. on
Pattern Analysis and Machine Intelligence, 13
(7):680702, 1999.
[21] R. O'Hara, D. Barnes " A new shape from shading
technique with application to Mars Express HRSC
images" ISPRS Journal of Photogrammetry and
Remote Sensing 67 (2012) 2734
[22] Samaras, D., Metaxas, D., 2003. Incorporating
illumination constraints in deformable models for
shape from shading and light direction estimation.
IEEE Transactions on Pattern Analysis and Machine
Intelligence 25 (2), 247264.
[23] S.Galliani, Y.-C. Ju, M. Breu, and A. Bruhn.
Generalised perspective shape from shading in
spherical coordinates. In Proc. Scale Space and
Variational Methods in Computer Vision (SSVM),
pages 222233, 2013.
[24] Yuen, S.Y., Tsui, Y.Y., Chow, C.K., 2007. A fast
marching formulation of perspective from shading
under frontal illumination. Pattern Recognition
Letters 28 ( 7), 806824.
[25] Zhu, Q., Shi, J., 2006. Shape from shading:
recognizing the mountains through a global view. In:
Proceedings of the 2006 IEEE Computer Society
Conference on Computer Vision and Pattern
Recognition, New York, NY, USA, pp. 18391846
AUTHORs
Gamal. F. Elhady received the B.S, M.S and
Ph.D degree in Computer Science at Faculty
of Science, in 1998 and 2006, Mansoura
University, Egypt. During 1998 and 2006, he
works a Demonstrator and Lecturer Assistance in Faculty
of science computer science Dept. He is member of
IAENG in USA (#108463).
His research interest includes software programing,
software testing, distributed system, data mining,
database, Artificial intelligent, image processing and
bioinformatics.