Shading, Shadows, Lights, and shape from Shading, Shadows, Lights, and shape from shading. n ث†...

download Shading, Shadows, Lights, and shape from Shading, Shadows, Lights, and shape from shading. n ث† خ¸ خ´A

of 49

  • date post

    30-Apr-2020
  • Category

    Documents

  • view

    0
  • download

    0

Embed Size (px)

Transcript of Shading, Shadows, Lights, and shape from Shading, Shadows, Lights, and shape from shading. n ث†...

  • CSCI 5561: Computer Vision, Prof. Paul Schrater, Spring 2005

    Shading, Shadows, Lights, and shape from shading

  • n̂ θ

    δA

    δI

    αz f

    Surface Radiance and Image Irradiance

    α

    22 )cos/( cos

    )cos/( cos

    α αδ

    α θδ

    f I

    z A

    = 2

    cos cos

     

      

     =

    f z

    I A

    θ α

    δ δ

    Same solid angle

    Pinhole Camera Model

  • n̂δA

    δI

    αz f

    d

    Surface Radiance and Image Irradiance

    α

    α π

    α απ 3

    2

    2

    2

    cos 4)cos/(

    cos 4

     

      

    ==Ω z d

    z d

    Solid angle subtended by the lens, as seen by the patch δA

    θα π

    δθδδ coscos 4

    cos 3 2

     

      

    =Ω= z dALALP

    Power from patch δA through the lens

    Ω

    α π

    θα π

    δ δ

    δ δ 4

    2 3

    2

    cos 4

    coscos 4 

     

      

     =

      

    == f dL

    z d

    I AL

    I PE

    Thus, we conclude

  • n̂δA

    δI

    αz f

    d

    Surface Radiance and Image Irradiance

    α Ω

    α π

    θα π

    δ δ

    δ δ 4

    2 3

    2

    cos 4

    coscos 4 

     

      

     =

      

    == f dL

    z d

    I AL

    I PE

    E ∝Le Image intensity isproportional to ExidentRadiance

  • Radiance emitted by point sources • small, distant sphere

    radius ε and uniform radiance E, which is far away and subtends a solid angle of about

    Ω = π ε d 

      

      2

    Le = ρd x( ) Li x,ω( )cosθidω Ω

    ∫ = ρd x( ) Lidω cosθi

    Ω

    ≈ ρd x( ) ε r(x) 

     

     

    2

    E cosθi

    = k ρd x( )cosθi

    r x( )2

  • Standard nearby point source model • N is the surface normal

    • rho is diffuse albedo

    • S is source vector - a vector from x to the source, whose length is the intensity term – works because a dot-product

    is basically a cosine

    ρd x( ) N x( ) •S x( )

    r x( )2 

     

     

  • Standard distant point source model • Issue: nearby point source

    gets bigger if one gets closer – the sun doesn’t for any

    reasonable binding of closer

    • Assume that all points in the model are close to each other with respect to the distance to the source. Then the source vector doesn’t vary much, and the distance doesn’t vary much either, and we can roll the constants together to get:

    ρd x( ) N x( )• Sd x( )( )

  • Line sources

    radiosity due to line source varies with inverse distance, if the source is long enough.

    For a finite line source centered on the plane, there is spatial variation across the surface

  • Area sources • Examples: diffuser boxes,

    white walls.

    • The radiosity at a point due to an area source is obtained by adding up the contribution over the section of view hemisphere subtended by the source – change variables and add up

    over the source

  • Area Source Shadows

  • Shading models • Local shading model

    – Surface has radiosity due only to sources visible at each point

    – Advantages: • often easy to manipulate,

    expressions easy

    • supports quite simple theories of how shape information can be extracted from shading

    • Global shading model – surface radiosity is due to

    radiance reflected from other surfaces as well as from surfaces

    – Advantages: • usually very accurate

    – Disadvantage: • extremely difficult to infer

    anything from shading values

  • Photometric stereo

    • Assume: – a local shading model

    – a set of point sources that are infinitely distant

    – a set of pictures of an object, obtained in exactly the same camera/object configuration but using different sources

    – A Lambertian object (or the specular component has been identified and removed)

  • Projection model for surface recovery - usually called a Monge patch

    z = f (x, y)

    r n = ∂z /∂x ∂z /∂y

    1

      

      

    ˆ n = r n / r n €

    ˆ n

  • Image model • For each point source, we

    know the source vector (by assumption). We assume we know the scaling constant of the linear camera. Fold the normal and the reflectance into one vector g, and the scaling constant and source vector into another Vj

    • Out of shadow:

    • In shadow:

    I j(x,y) = 0

    I j (x, y) = kB(x, y)

    = kρ(x, y) N(x, y) •S j( ) = g(x, y)•Vj

  • CSCI 5561: Computer Vision, Prof. Paul Schrater, Spring 2005

    Surface normals

  • CSCI 5561: Computer Vision, Prof. Paul Schrater, Spring 2005

    l1 = − 2 0 0

      

      

    l2 = 2 0 0

      

      

    Surface Normal Light directions Defined relative to local surface patch

  • Basic Equation

    Values Of images at Pixel (x,y)

    Matrix stack Of light sources For each of the n images

    Unknown

    Problem- Nonlinear due to shadowing

    n x 3n x 1

    I1(x,y) I2(x,y)

    L

    In (x,y)

       

       

    = max

    V1T

    V1T

    L

    VnT

       

       

    g(x,y), r 0

       

       

    . .

    etc

    I1(x,y)

    I2(x,y)

    In (x,y)

    .

  • Dealing with shadows

    I1 2(x, y) I2 2(x, y) ..

    In 2(x, y)

       

       

    =

    I1(x, y) 0 .. 0 0 I2(x, y) .. .. .. .. .. 0 0 .. 0 In(x, y)

       

       

    V1 T

    V2 T

    .. Vn

    T

       

       

    g(x, y)

    Known Known Known Unknown

    r b = Ar x General form:

    n x 3n x 1

    For each x,y point

  • Recovering normal and reflectance • Given sufficient sources, we can solve the previous

    equation (most likely need a least squares solution) for g(x, y) = ρ(x,y) N(x, y) • Recall that N(x, y) is the unit normal • This means that ρ(x,y) is the magnitude of g(x, y) • This yields a check

    – If the magnitude of g(x, y) is greater than 1, there’s a problem

    • And N(x, y) = g(x, y) / ρ(x,y)

  • Example figures

  • Recovered reflectance

  • Recovered normal field

  • Recovering a surface from normals - 1 • Recall the surface is written

    as

    • This means the normal has the form:

    • If we write the known vector g as

    • Then we obtain values for the partial derivatives of the surface:

    (x, y, f (x, y))

    g(x, y) = g1(x, y) g2 (x, y) g3(x, y)

     

     

    fx (x, y) = g1(x, y) g3(x, y)( )

    fy(x, y) = g2(x, y) g3(x, y)( )

    N(x, y) = 1 fx 2 + fy

    2 +1 

     

     

    − fx − fy 1

     

     

  • Recovering a surface from normals - 2 • Recall that mixed second partials

    are equal --- this gives us a check. We must have:

    (or they should be similar, at least)

    • We can now recover the surface height at any point by integration along some path, e.g.

    ∂ g1(x, y) g3(x, y)( ) ∂y

    =

    ∂ g2(x, y) g3(x, y)( ) ∂x

    f (x, y) = fx (s, y)ds 0

    x

    ∫ +

    fy (x, t)dt 0

    y

    ∫ + c

  • Surface recovered by integration

  • Shape from Shading with ambiguity

    What to do if light source unknown?

    Only one image?

    Ans: Use prior knowledge in the form of constraints (e.g. regularization methods, Bayesian methods), take advantage of t