# Patent

## Title
Blended rendering of focused plenoptic camera data

## Abstract

Methods, apparatus, and computer-readable storage media for rendering focused plenoptic camera data. A rendering with blending technique is described that blends values from positions in multiple microimages and assigns the blended value to a given point in the output image. A rendering technique that combines depth-based rendering and rendering with blending is also described. Depth-based rendering estimates depth at each microimage and then applies that depth to determine a position in the input flat from which to read a value to be assigned to a given point in the output image. The techniques may be implemented according to parallel processing technology that renders multiple points of the output image in parallel. In at least some embodiments, the parallel processing technology is graphical processing unit (GPU) technology.

## Background
PRIORITY INFORMATION
This application claims benefit of priority of U.S. Provisional Application Ser. No. 61/310,203 entitled “Focused Plenoptic Camera and Rendering” filed Mar. 3, 2010, the content of which is incorporated by reference herein in its entirety.


BACKGROUND
Description of the Related Art
In contrast to conventional cameras, light-field, or radiance capturing, cameras sample the four-dimensional (4-D) optical phase space or light-field, and in doing so capture information about the directional distribution of the light rays. This information captured by light-field cameras may be referred to as the light-field, the plenoptic function, or radiance. In computational photography, a light-field is a 4-D record of all light rays in 3-D. Radiance describes both spatial and angular information, and is defined as density of energy per unit of area per unit of stereo angle (in radians). A light-field camera captures radiance; therefore, light-field images originally taken out-of-focus may be refocused, noise may be reduced, viewpoints may be changed, and other light-field effects may be achieved.
Plenoptic cameras, constructed with internal microlens arrays, capture both spatial and angular information, i.e., the full four-dimensional (4D) radiance, of a scene. By capturing the full 4D radiance, plenoptic cameras may produce effects beyond the capabilities of traditional cameras. Image properties such as focus and depth of field may be adjusted after an image had been captured. However, images rendered from data captured using conventional plenoptic cameras are of relatively low resolution. The design of conventional plenoptic cameras assumes that each microlens image is completely defocused with respect to the image created by the main camera lens. As a result, only a single pixel in the final image is rendered from each microlens image, resulting in low resolution. For example, images rendered from data captured with an example conventional plenoptic camera have a final resolution of only 300×300 pixels.
SUMMARY
Various embodiments of methods, apparatus, and computer-readable storage media for rendering focused plenoptic camera data are described. Focused plenoptic camera technology, in combination with full resolution light-field rendering techniques as described herein, can produce final images at significantly higher resolution than can be rendered from light-field images captured with conventional plenoptic camera technology. Rendering techniques are described that include a rendering with blending technique, and a combined depth-based rendering and rendering with blending technique.
In embodiments of the rendering with blending rendering technique, a flat including a plurality of microimages of separate portions of an image of a scene is obtained. To render an output image of the scene from the plurality of separate microimages, each point in the output image is rendered by blending values from multiple microimages. In at least some embodiments, to render a given point in the output image, a target microimage in the flat is determined for this point. A position in the target microimage from which a value is to be sampled is calculated. For each microimage in a neighborhood including the target image (e.g., a 3×3 neighborhood), a value from the calculated position in the respective microimage is calculated, and the value is added to a value accumulator. In at least some embodiments, the value may be weighted according to the position of the respective microimage in the neighborhood before adding the value to the accumulator. In at least some embodiments, the weight used may also be added to a separate weight accumulator. The value in the value accumulator may be normalized, and the normalized value may be assigned to the point in the output image. In at least some embodiment, normalizing may be performed by dividing the accumulated value by the accumulated weight value. Other methods for normalizing, for example averaging, may be used in some embodiments.
In embodiments of a combined depth based rendering and rendering with blending technique, a flat including a plurality of microimages of separate portions of an image of a scene is obtained. For each of the plurality of microimages, a depth of a respective portion of the image of the scene is estimated. An output image of the scene is rendered from the plurality of separate microimages according to the estimated depths. Each point in the output image is rendered by blending values from multiple microimages in a neighborhood including the target microimage; the estimated depth for the target microimage applies to all of the microimages because the sampling position in the microimages is calculated according to the estimated depth for the target microimage.
In at least some embodiments, the rendering techniques described herein may be performed according to parallel processing technology that renders multiple points of the output image in parallel. In at least some embodiments, the parallel processing technology is graphical processing unit (GPU) technology.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 graphically illustrates the focused plenoptic camera, according to at least some embodiments.
FIG. 2 illustrates sampling of the radiance r(q, p) by the microlens array of the focused plenoptic camera, represented in the two-dimensional (q, p) plane.
FIG. 3 illustrates a sampling pattern of one microlens in the focused plenoptic camera, according to at least some embodiments.
FIG. 4 graphically illustrates basic image rendering geometry with the focused plenoptic camera, according to at least some embodiments.
FIG. 5 graphically illustrates basic image capture and rendering geometry with the focused plenoptic camera, according to at least some embodiments.
FIG. 6 graphically illustrates a basic full resolution rendering algorithm, according to at least some embodiments.
FIG. 7 graphically illustrates basic rendering directly from a plenoptic image (flat), with no blending, according to some embodiments.
FIG. 8 shows a small crop from input radiance data (i.e. a flat) captured with a focused plenoptic camera that is used for illustrating examples of rendering.
FIG. 9 shows an example image rendered from the radiance data illustrated in FIG. 8 using the basic full resolution rendering algorithm.
FIGS. 10 and 11 graphically illustrate artifacts that occur when the choice of M is respectively too small or too large for rendering a part of a scene.
FIG. 12 shows an example image rendered using a depth-based rendering algorithm, according to at least some embodiments.
FIG. 13 graphically illustrates an example of estimated depth used for the rendered image shown in FIG. 12.
FIG. 14 graphically illustrates an embodiment of a depth estimation algorithm that may be used in at least some embodiments.
FIG. 15A is a high-level flowchart of a method for depth based rendering, according to at least some embodiments.
FIG. 15B is a flowchart of a method for rendering a point in an output image, according to at least some embodiments of the depth-based rendering technique.
FIG. 16A shows a small crop from a raw image (flat) captured with a focused plenoptic camera.
FIG. 16B shows an image rendered from the flat of FIG. 16A using the basic full resolution rendering algorithm.
FIG. 16C shows an image rendered using a rendering with blending technique.
FIG. 17A shows an image rendered using the rendering with blending algorithm with a small pitch (e.g., 7 pixels).
FIG. 17B shows an image rendered using the rendering with blending algorithm with a larger pitch (e.g., 10 pixels).
FIG. 18 is a high-level flowchart of a method for rendering with blending, according to at least some embodiments.
FIG. 18B is a flowchart of a method for rendering a given point in an output image, according to at least some embodiments of the rendering with blending technique.
FIG. 19 is a flowchart of a method for combined depth based rendering and rendering with blending, according to at least some embodiments.
FIG. 20 shows an example user interface, according to some embodiments, for processing a flat captured with a focused plenoptic camera to render a full-resolution output image.
FIG. 21 illustrates a rendering module rendering a full-resolution image from a flat captured, for example, by a focused plenoptic camera, according to some embodiments.
FIG. 22 illustrates an example computer system that may be used in embodiments.



While the invention is described herein by way of example for several embodiments and illustrative drawings, those skilled in the art will recognize that the invention is not limited to the embodiments or drawings described. It should be understood, that the drawings and detailed description thereto are not intended to limit the invention to the particular form disclosed, but on the contrary, the intention is to cover all modifications, equivalents and alternatives falling within the spirit and scope of the present invention. The headings used herein are for organizational purposes only and are not meant to be used to limit the scope of the description. As used throughout this application, the word “may” is used in a permissive sense (i.e., meaning having the potential to), rather than the mandatory sense (i.e., meaning must). Similarly, the words “include”, “including”, and “includes” mean including, but not limited to.
DETAILED DESCRIPTION OF EMBODIMENTS
In the following detailed description, numerous specific details are set forth to provide a thorough understanding of claimed subject matter. However, it will be understood by those skilled in the art that claimed subject matter may be practiced without these specific details. In other instances, methods, apparatuses or systems that would be known by one of ordinary skill have not been described in detail so as not to obscure claimed subject matter.
Some portions of the detailed description which follow are presented in terms of algorithms or symbolic representations of operations on binary digital signals stored within a memory of a specific apparatus or special purpose computing device or platform. In the context of this particular specification, the term specific apparatus or the like includes a general purpose computer once it is programmed to perform particular functions pursuant to instructions from program software. Algorithmic descriptions or symbolic representations are examples of techniques used by those of ordinary skill in the signal processing or related arts to convey the substance of their work to others skilled in the art. An algorithm is here, and is generally, considered to be a self-consistent sequence of operations or similar signal processing leading to a desired result. In this context, operations or processing involve physical manipulation of physical quantities. Typically, although not necessarily, such quantities may take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared or otherwise manipulated. It has proven convenient at times, principally for reasons of common usage, to refer to such signals as bits, data, values, elements, symbols, characters, terms, numbers, numerals or the like. It should be understood, however, that all of these or similar terms are to be associated with appropriate physical quantities and are merely convenient labels. Unless specifically stated otherwise, as apparent from the following discussion, it is appreciated that throughout this specification discussions utilizing terms such as “processing,” “computing,” “calculating,” “determining” or the like refer to actions or processes of a specific apparatus, such as a special purpose computer or a similar special purpose electronic computing device. In the context of this specification, therefore, a special purpose computer or a similar special purpose electronic computing device is capable of manipulating or transforming signals, typically represented as physical electronic or magnetic quantities within memories, registers, or other information storage devices, transmission devices, or display devices of the special purpose computer or similar special purpose electronic computing device.
Various embodiments of methods, apparatus, and computer-readable storage media for rendering focused plenoptic camera data are described. Images rendered from data captured using conventional plenoptic cameras are of relatively low resolution. Focused plenoptic camera technology, in combination with full resolution light-field rendering techniques as described herein, can produce final images at significantly higher resolution. The focused plenoptic camera uses the microlens array as an imaging system focused on the image plane of the main camera lens. The flexible spatio-angular tradeoff that becomes available with focused plenoptic camera technology enables rendering of final images with significantly higher resolution than images rendered from data captured with conventional plenoptic cameras.
Various embodiments of full-resolution rendering techniques for producing high-quality, high-resolution images from data captured with the focused plenoptic camera are described. These techniques include a basic full-resolution rendering technique, a depth-based rendering technique, a rendering with blending technique, and a combined depth-based, rendering with blending technique. Implementations of these rendering techniques that are executable on parallel processing technology such as a graphics processing units (GPUs) are described; by subdividing the rendering process and executing parts of the process in parallel, these implementations are able to render full screen refocused images in real-time or near real-time.
Focused plenoptic camera technology and basic rendering techniques for focused plenoptic camera data are described in U.S. patent application Ser. No. 12/474,112, entitled “Methods and Apparatus for Full-Resolution Light-Field Capture and Rendering” filed May 28, 2009, the content of which is incorporated by reference herein in its entirety.
The focused plenoptic camera is structurally different from conventional plenoptic cameras with respect to at least microlens placement and microlens focus and, following from the structural differences, assumptions made about the sampling of the 4D radiance. The conventional plenoptic camera focuses the main lens on the microlenses and focuses the microlenses at infinity. In contrast, the focused plenoptic camera focuses the main camera lens in front of the microlenses and focuses the microlenses on the image formed inside the camera. Each microlens of the focused plenoptic camera forms a relay system with the main camera lens. This configuration produces a flexible trade-off in the sampling of spatial and angular dimensions and allows positional information in the radiance to be sampled more effectively than with the conventional plenoptic camera. As a result, the focused plenoptic camera can produce images of much higher resolution than can traditional plenoptic cameras.
Radiance Theory and Modeling
The radiance at a given plane perpendicular to the optical axis may be denoted by r(q, p), where q and p represent position and direction in ray space, respectively. Compactly, a coordinate in ray space is represented by x=(q, p)T. Rays are transformed by the application of optical elements. An arbitrary ray transfer matrix, A, transforms each ray according to:

x′=Ax.  (1)

Refraction by a lens and travel of rays in free space are respectively described by the matrix transforms L and T:




  
    
      
        
          L
          =
          
            [
            
              
                
                  1
                
                
                  0
                
              
              
                
                  
                    -
                    
                      1
                      f
                    
                  
                
                
                  1
                
              
            
            ]
          
        
        ,
        
          

        
        ⁢
        
          T
          =
          
            
              [
              
                
                  
                    1
                  
                  
                    t
                  
                
                
                  
                    0
                  
                  
                    1
                  
                
              
              ]
            
            .
          
        
      
    
    
      
        (
        2
        )
      
    
  




Optical transforms of rays induce corresponding transforms of functions (such as radiance) defined on ray space. Let A be an optical transform of equation (1), and consider the induced transformation of r(x) to r′(x). Since all optical transfer matrices satisfy determinant (det) A=1, and assuming conservation of energy, this is the radiance conservation property of all optical systems, i.e., it must be the case that:

r′(x′)=r(x).

Taken with x′=Ax, it must be the case that:

r′(Ax)=r(x).

Considering a ray y=Ax, the following is obtained:

r′(y)=r(A−1y).

Since y is an arbitrary ray, the radiance transformation formula:

r′(x)=r(A−1x)  (3)

is obtained. The intensity of an image at a given spatial point, denoted I(q) is the integral of the radiance over all of the rays incident at that point, i.e.,

I(q)=∫pr(q,p)dp.  (4)

The Conventional Plenoptic Camera

The conventional plenoptic camera is based on an array of microlenses at the image plane of the main camera lens, with the sensor placed one focal length behind the microlenses. The camera samples the radiance in front of the microlenses with a kernel. Each microlens image is a vertical stack of samples in the (q, p) plane, capturing strictly the angular distribution of the radiance at the image plane. In the conventional plenoptic camera, the main camera lens is focused one focal length in front of the microlenses. Consider one microlens. It can be shown that each pixel under it measures the energy coming to a plane one focal length in front of that microlens as rays at a specific for that pixel angle. To show this, the matrix A and A−1 are computed for rays incident to a plane one focal length in front of a given microlens.




  
    
      
        
          
            
              
                A
                =
                
                ⁢
                
                  
                    
                      [
                      
                        
                          
                            1
                          
                          
                            f
                          
                        
                        
                          
                            0
                          
                          
                            1
                          
                        
                      
                      ]
                    
                    ⁡
                    
                      [
                      
                        
                          
                            1
                          
                          
                            0
                          
                        
                        
                          
                            
                              -
                              
                                1
                                f
                              
                            
                          
                          
                            1
                          
                        
                      
                      ]
                    
                  
                  ⁡
                  
                    [
                    
                      
                        
                          1
                        
                        
                          f
                        
                      
                      
                        
                          0
                        
                        
                          1
                        
                      
                    
                    ]
                  
                
              
            
          
          
            
              
                
                  =
                  
                  ⁢
                  
                    [
                    
                      
                        
                          0
                        
                        
                          f
                        
                      
                      
                        
                          
                            -
                            
                              1
                              f
                            
                          
                        
                        
                          0
                        
                      
                    
                    ]
                  
                
                ,
              
            
          
        
        ⁢
        
          

        
        ⁢
        
          
            A
            
              -
              1
            
          
          =
          
            
              [
              
                
                  
                    0
                  
                  
                    
                      -
                      f
                    
                  
                
                
                  
                    
                      1
                      f
                    
                  
                  
                    0
                  
                
              
              ]
            
            .
          
        
      
    
    
      
        (
        5
        )
      
    
  




Consider equation (5). A pixel on the sensor responds approximately equally to rays from all angles. Therefore its sampling kernel in ray space may be represented as a vertical line. Matrix A−1 maps this vertical line to a horizontal line because, due to the bottom right zero matrix element, input p does not influence output p. Moreover, the spatial size of that horizontal line (the amount sampled in the spatial domain) is limited only by the microlens diameter. This large size of the sampling kernel is the reason for the low resolution of the conventional plenoptic camera.
Images are rendered from the radiance captured by the conventional plenoptic camera by integrating all angular samples at a particular spatial point. However, each spatial point is sampled by a single microlens, so rendering involves integrating all of the pixels in each microimage. As designed, rendering from the conventional plenoptic camera produces only one pixel per microlens, resulting in a rendered image with very low resolution. Even with 100,000 microlenses, the conventional plenoptic camera produces a final image of only 300×300 pixels.
The Focused Plenoptic Camera
FIG. 1 graphically illustrates the focused plenoptic camera, according to at least some embodiments. As shown in FIG. 1, the focused plenoptic camera is based on an array of microlenses focused on the image plane of the main lens. Thus, each microlens captures a portion of the image formed by the main lens. The photosensor can be thought of as being moved back, away from the main lens, so the image is formed some distance a in front of the microlenses. The microlenses serve as an array of real cameras, re-imaging parts of that image onto the photosensor.
In playing this role, each microlens forms a relay imaging system with the main camera lens. The position of each microlens satisfies the lens equation, 1/a+1/b=1/f, where a, b, and f are respectively the distance from the microlens to the main lens image plane, the distance from the microlens to the sensor, and the focal length of the microlens. In some the focused plenoptic camera, b may be set to be greater than f, and with this setting the main lens image is a virtual image formed in front of the microlenses; this is referred to as the Keplerian telescopic case. A different setting is possible, where the main lens image is a virtual image formed behind the sensor. In this case, a would be negative, and b would be less than f. This is referred to as the Galilean telescopic case. The discussion of the focused plenoptic camera provided herein generally assumes the Keplerian telescopic case, but the treatment of Galilean telescopic case would be similar.
The focused plenoptic camera samples the radiance as shown in FIG. 2. FIG. 2 illustrates sampling of the radiance r(q, p) by the microlens array of the focused plenoptic camera, represented in the two-dimensional (q, p) plane. The microlens aperture is given by d; a and b are the spacing from the microlens plane to the image plane and from the microlens plane to the sensor, respectively. Each microlens image is a slanted stack of samples in the (q, p) plane, capturing both angular and positional distribution of the radiance at the image plane.
The total transfer matrix from the image plane to the sensor is:




  
    
      
        
          
            
              A
              =
              
              ⁢
              
                
                  
                    [
                    
                      
                        
                          1
                        
                        
                          b
                        
                      
                      
                        
                          0
                        
                        
                          1
                        
                      
                    
                    ]
                  
                  ⁡
                  
                    [
                    
                      
                        
                          1
                        
                        
                          0
                        
                      
                      
                        
                          
                            -
                            
                              1
                              f
                            
                          
                        
                        
                          1
                        
                      
                    
                    ]
                  
                
                ⁡
                
                  [
                  
                    
                      
                        1
                      
                      
                        a
                      
                    
                    
                      
                        0
                      
                      
                        1
                      
                    
                  
                  ]
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  [
                  
                    
                      
                        
                          -
                          
                            b
                            a
                          
                        
                      
                      
                        0
                      
                    
                    
                      
                        
                          -
                          
                            1
                            f
                          
                        
                      
                      
                        
                          -
                          
                            a
                            b
                          
                        
                      
                    
                  
                  ]
                
                .
              
            
          
        
      
    
    
      
        (
        6
        )
      
    
  




The last equality holds due to focusing. Computing the inverse,





  
    
      
        
          A
          
            -
            1
          
        
        =
        
        ⁢
        
          
            [
            
              
                
                  
                    -
                    
                      a
                      b
                    
                  
                
                
                  0
                
              
              
                
                  
                    1
                    f
                  
                
                
                  
                    -
                    
                      b
                      a
                    
                  
                
              
            
            ]
          
          .
        
      
    
    
      
        (
        7
        )
      
    
  




An important observation is that, due to the zero top right element of the matrix A−1, the sampling kernel for each pixel remains vertical in optical phase space after inverse mapping. As a result, sampling is done by a dense set of thin vertical kernels, and is decoupled from microlens size. See FIG. 3, which illustrates a sampling pattern of one microlens in the focused plenoptic camera, according to at least some embodiments. Considering that minification for each microcamera is a/b, the high spatial resolution achieved is b/a times the sensor resolution, as shown in FIG. 2.
An important result is that the spatio-angular tradeoff for the focused plenoptic camera is not fixed by the number of microlenses. Rather, the spatio-angular tradeoffs are determined by the optical geometry (a and b). In some embodiments, to counter edge effects in the microimages, relatively large microlenses may be used.
Images may be rendered from radiance captured with the focused plenoptic camera by integrating the angular samples at every spatial point. Unlike the conventional plenoptic camera, however, the angular samples for a given spatial point are sampled by different microlenses. Therefore, rendering with focused plenoptic camera data involves integrating across microlens images rather than within microlens images. FIG. 4 graphically illustrates image rendering geometry with the focused plenoptic camera, according to at least some embodiments. The left half of FIG. 4 shows rendering that integrates all directions associated with a given position. Note that integration takes place across microlens images. The right half of FIG. 4 shows rendering that only uses a single direction at each position. For the configuration shown, the rendered image includes two pixels from each microimage.
Rendering Methods for Focused Plenoptic Camera Data
Basic Full-Resolution Rendering
A basic focused plenoptic camera rendering process is graphically illustrated in FIG. 4 (right part). If an image is rendered with one angular sample for each location, M samples are obtained from each microlens image. In the example shown in the right half of FIG. 4, M=2 and the rendered image has twice as many pixels as there are microlenses, and thus twice the resolution of the conventional plenoptic camera. In general, the attainable resolution of a full resolution rendered image depends on the depth of the scene. The spatial resolution of a full-resolution image is b/a times the spatial resolution of the sensor. Resolution increases for image planes closer to the microlens plane (where b/a approaches unity), or, equivalently, for planes in the scene that are closer to the main lens (in the foreground). Thus, image planes in the foreground can be rendered with a higher resolution (a larger number of pixels per microlens) than image planes in the background.
In the conventional plenoptic camera, all of the directions for a given spatial sample are contained within a single microimage and all of the spatial samples for a given direction are spread across microimages. In contrast, in the focused plenoptic camera, the different views for a given spatial sample are spread across microimages.
Images may be rendered from the focused plenoptic camera according to equation (4). A single viewpoint rendering of equation (4) may be implemented by evaluating r(q, p) at some particular value of p=p0, i.e., let I(q)=r(q, p0). In this case, however, it may be necessary to account for the fact that a single microimage samples over a range of q and a range of p. In particular, rather than selecting one spatial sample per microlens that corresponds to a single value of p to render the final image, at each microlens a range of spatial samples corresponding to a range of directions may be extracted (see, for example, FIG. 4, right side, where M=2).
In embodiments of a basic rendering technique, an output image corresponding to a given view (a small range of angles) can be rendered from focused plenoptic camera radiance data by selecting a contiguous set of pixels (a patch) from each microimage and tiling all such patches together into the final image. An important parameter in this process is the pixel size of the patch to select from each microimage.
Consider the image capture geometry illustrated in FIG. 5, where the goal is to reconstruct the image on the main lens image plane with pieces taken from each microlens image. The distance between microlenses (i.e., the pitch of the microlens array) is given by μ. The main lens image plane may be divided into μ×μ sections such that each such section maps to an M×M portion of a microlens image. The main lens image can be reconstructed by putting together those M×M portions (which may be referred to as patches). (Strictly speaking, a negative value of M is required to “flip” the patches to their correct orientation before assembling them.)
However, there is an alternative interpretation of the image capture geometry. Namely, for a given rendering pitch (the patch size M with which rendering is performed), there is an image plane at distance a in front of the microlenses that will satisfy




  μ
  =
  
    M
    ⁢
    
      
        a
        b
      
      .
    
  




That plane is “in focus” in the sense that an image picked up from it will be rendered with no artifacts. The patches of that exact size tile together perfectly. In other words, the rendered image is “focused” only for that plane by the choice of the pitch, i.e. the patch size M.

Example pseudocode for a basic focused plenoptic camera rendering algorithm according to at least some embodiments is given below in the section titled Full resolution rendering algorithm. Intuitively, the basic full resolution algorithm operates as follows. The pitch (defined by the number of pixels per microimage) is specified, and squares of that size are selected from each microlens image. The final image is rendered by tiling the selected squares together. Choosing one pitch or another puts different world planes “in focus.” In other words, patches match each other perfectly only for one image plane behind the main lens. By the lens equation, this corresponds to a given depth in the real world. Thus, a different patch size would correspond to a different depth. In other words, the equivalent of refocusing is accomplished in the focused plenoptic camera data through the choice of the patch size (the pitch) in the full-resolution rendering algorithm. This could be called the “full resolution” rendering principle, and it is an underlying notion in focused plenoptic camera rendering methods.
Example Basic Full Resolution Rendering Algorithm
Computationally, the 4D radiance may be represented as a 4D array (or, equivalently, as a 2D array of 2D arrays). Assume each microlens image has dimension nx×ny and that the total number of microlens images is Nx×Ny. We represent the radiance as r[i,j,k,l], a 4D array of pixels with dimension Nx×Ny×nx×ny.
Given patch size P, pseudocode for the full resolution rendering algorithm to produce a P*Nx×P*Ny output image is given below. FIG. 6 graphically illustrates a basic full resolution rendering algorithm that creates a final rendered image from P×P patches of each nx×ny microimage. With Nx×Ny microimages in the captured radiance, the final rendered image is P·Nx×P·Ny.
Example pseudocode for a basic full resolution rendering algorithm that may be used in at least some embodiments is given below. Note that this pseudocode is given as an example, and is not intended to be limiting. The basic full resolution rendering algorithm as implemented in the pseudocode, given discrete Nx×Ny×nx×ny, radiance r[i,j,k,l], and pitch size P, outputs rendered P*Nx×P*Ny image I[s,t]:
For (s,t) in (P*Nx, P*Ny)

I[s,t]=r[i,j,k,l], 

where i=(s/Nx)*P, j=(t/Ny)*P,
k=(s % Nx)*P, and l=(t % Ny)*P.
Parallel Processing Implementations
In at least some embodiments, processing and rendering plenoptic image data captured with focused plenoptic camera technology may be performed at least in part on parallel computing architectures, for example the architectures of GPU platforms, multi-core or multi-processor platforms, and so on. Using parallel processing approaches, for example GPU-based approaches, for processing and rendering plenoptic image data, embodiments of the rendering algorithms described herein may be able to achieve real-time or near-real-time performance, allowing implementations of the rendering algorithms to be interactive. With the performance provided by parallel processing, embodiments may, for example, provide user interfaces whereby a user may specify a flat captured with focused plenoptic camera technology, specify that the flat is to be rendered according to one or more values of rendering parameters such as depth of focus, and quickly view the results (i.e., in real-time or near-real time) on a display device. The user can then change the value of one or more of the parameters via the user interface and quickly view the results of the change. Thus, parallel processing implementations may provide interactive performance. Without the performance provided by parallel processing, rendering an image may take many seconds or even minutes.
A number of programming languages and tools are available for GPU programming: for example, the OpenGL Shading Language (GLSL), Cg, CUDA, and OpenCL. Whereas GLSL and Cg are aimed at rendering and related tasks in mind, CUDA and OpenCL are aimed directly at general purpose programming tasks. Any suitable GPU programming language and tools may be used to implement embodiments of the rendering algorithms described herein. However, GLSL implementations are described as examples.
In at least some embodiments, the rendering algorithms may be implemented in GLSL as OpenGL fragment shaders. Embodiments may be implemented in Python (e.g., via the PyOpenGL library, a Python interface to OpenGL), interfaces to OpenGL tend to be similar across other languages, and thus other languages may be used instead of Python. Other than providing support for creating and installing the shader, the functionality provided by OpenGL may also include, but are not limited to, reading the plenoptic image data (e.g., from a stored image), serializing the light-field data to a format suitable for OpenGL, creating a 2D OpenGL texture object for the plenoptic image data, and defining a texture in OpenGL, using the serialized image data.
Rendering the plenoptic image data may then be accomplished by rendering the installed texture, for example using an embodiment of an OpenGL fragment shader as described below.
To explain the operation of the shader, the following discusses some of the details of the optical image capture geometry, and describes elements of the basic focused plenoptic camera rendering method according to the geometry, as may be interpreted by OpenGL.
FIG. 7 graphically illustrates basic rendering directly from a plenoptic image (flat), with no blending, according to some embodiments. Note that the magnification is a/b. Considering the rendering geometry shown in FIG. 7, let μ be the size of one microlens image, measured in pixels. In this example, μ=7. For a given point x in the output image, the rendering method needs to find the corresponding sampling point on the flat. To accomplish this, in at least some embodiments, the rendering method may perform two computations. First, given x, the method determines from which microlens x will be rendered. Second, the method determines where in the region of size M the point x lies.
In at least some embodiments, to compute which microlens corresponds to x, the rendering method takes the integer part of x divided by μ, which gives the index of the microlens. In other words, this number (which may be referred to asp) is given by:




  
    
      
        p
        =
        
          
            ⌊
            
              x
              μ
            
            ⌋
          
          .
        
      
    
    
      
        (
        C1
        )
      
    
  




The pixel location of the beginning of that microlens in the flat is then given by multiplying the microlens number by the size of one microlens image, i.e., pμ.

In at least some embodiments, the rendering method then computes the offset within the region of size M corresponding to x. In at least some embodiments, to do this, the method computes the difference between x and the start of microlens (p). This gives the offset in the rendered image; however, the offset in the flat is needed. Since a region of size M in the flat is scaled to a region of size μ in the final image, the offset needs to be scaled by




  
    M
    μ
  
  .




That is, the offset q is given by:





  
    
      
        
          
            
              q
              =
              
              ⁢
              
                
                  (
                  
                    x
                    -
                    
                      
                        ⌊
                        
                          x
                          μ
                        
                        ⌋
                      
                      ⁢
                      μ
                    
                  
                  )
                
                ⁢
                
                  M
                  μ
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  (
                  
                    
                      x
                      μ
                    
                    -
                    p
                  
                  )
                
                ⁢
                
                  M
                  .
                
              
            
          
        
      
    
    
      
        (
        C2
        )
      
    
  




In at least some embodiments, after the above computations, an adjustment is made. The center of the M×M region of the flat needs to render to the center of the corresponding region of the final image. The equations above will map the left edge of the microlens image to the left edge of the corresponding region in the rendered image. To accomplish this centering, an offset of




  
    μ
    -
    M
  
  2




is added to q:





  
    
      
        
          
            
              
                q
                ′
              
              =
              
              ⁢
              
                q
                +
                
                  
                    μ
                    -
                    M
                  
                  2
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  
                    (
                    
                      
                        x
                        μ
                      
                      -
                      p
                    
                    )
                  
                  ⁢
                  M
                
                +
                
                  
                    
                      μ
                      -
                      M
                    
                    2
                  
                  .
                
              
            
          
        
      
    
    
      
        (
        C3
        )
      
    
  




Combining equations (C1) and (C3), the corresponding point in the flat for a given point x in the output image is given by f(x) where:

f(x)=pμ+q′.  (C4)

Example GLSL fragment shader code that may implement the basic rendering algorithm described above and that may be used in at least some embodiments is given below. Note that this code renders one point in the output image, and may be performed in parallel to render multiple points in the output image simultaneously. Note that this code is given as an example, and is not intended to be limiting. Comments are preceded by double slashes (//).












// input or global parameters








uniform sampler2DRect flat;
// the plenoptic image


uniform float M, mu;
// M is the size of a patch;



// mu is μ, the size of one microlens



image in pixels


uniform float XOffset;
// x and y offsets or shifts for the



patches from center


uniform float YOffset;
// of microimages; may be user-provided







void main( )


{









// x/μ ; x is the point on the screen that is to be rendered



vec2 x_mu = gl_TexCoord[0].st/mu;



// p = └x/μ┘; p is the index of the microlens from which x will be



rendered



vec2 p= floor(x_mu);



// q = (x/μ − p)M ; calculates the offset q in a patch of size M



vec2 q = (x_mu − p) * M;



// q′ = q + (μ − M)/2 ; centers the offset q in the patch of size M



vec2 qp = q + 0.5*(mu − M);



// calculate shift for the patch in the microimage



vec2 offset = vec2(XOffset, YOffset)*(mu − M);



// f(x)= pμ + q′ + x and y offsets; calculates the position from which the



flat will



// be sampled, adjusted by the x and y offsets



vec2 fx = p * mu + qp + offset;



// read the value from the calculated position fx of the input flat and



// assign it to the respective point in the output image



gl_FragColor = texture2DRect(flat, fx);







}









In the above example GLSL code, the plenoptic image, as well as the values for μ and M, are provided by the user program via uniform variables. The shader program computes q, q′, and f(x) as q, qp, and fx, respectively. Changing the viewpoint of a synthesized image is enabled by adding offsets XOffset and YOffset (both equal to 0 by default) to the coordinates fx; in at least some embodiments, XOffset and YOffset may be user-specified. Finally, the value of the pixel is looked up in the flat, and that value is assigned to the requested fragment color.
Artifacts in Basic Full Resolution Rendering
FIG. 8 shows a small crop from input radiance data (i.e. a flat) captured with a focused plenoptic camera that is used for illustrating examples of rendering. FIG. 9 shows an image rendered from the radiance data illustrated in FIG. 8 using the basic full resolution rendering algorithm described above. The basic full resolution rendering process can produce artifacts, as can be seen in the background in FIG. 9. These artifacts result because the pitch necessary to produce artifact-free full resolution rendering is dependent on the depth in the scene. That is, different parts of a scene typically would require different patch sizes to be properly rendered. However, the basic full resolution rendering algorithm uses a global, fixed patch size. The pitch is too large for the background in FIG. 9, resulting in the visible artifacts.
The relationship between focusing and patch size also explains the artifacts that can arise when rendering a scene that has different depths. In particular, if a fixed patch size is used for a scene that has differing depths, there will be parts of the scene where the patch size is not the correct one to bring that part of the scene into focus. In those parts of the scene, the patches will not match at their boundaries. Unless that region of the scene is relatively smooth and uniform, artifacts at the microimage boundaries will be apparent. FIGS. 10 and 11 graphically illustrate artifacts that occur when the choice of M is respectively too small or too large for rendering a part of a scene. In FIG. 10, the chosen pitch is too small for the scene being rendered, resulting in pixilation artifacts. In FIG. 11, the chosen pitch is too large for the scene being rendered, resulting in “screen door” artifacts.
These artifacts are indications that the basic full resolution rendering approach described above is not well-matched to the particular task of rendering focused plenoptic data. Modifying the approach to produce artifact-free images depends on the particular task to be accomplished. The following describes approaches to reducing artifacts in images rendered from focused plenoptic camera data. These approaches are referred to as depth-based rendering and rendering with blending, or blended rendering.
Depth-Based Rendering
Embodiments of a depth-based rendering technique for focused plenoptic camera data are described. In the depth-based rendering technique, depth information from the scene is leveraged so that different (and correct) patch sizes can be used for rendering different parts of the scene. Embodiments of the depth-based rendering technique extract the depth information of a scene directly from a plenoptic image, and then apply this depth information to render an artifact-free image. Note that objects in the scene farther from the camera are at greater depth, while objects closer to the camera are at lesser depth. In the depth-based rendering technique, smaller patch sizes are used for portions of the scene that are estimated to be at greater depth, and larger patch sizes are used for portions of the scene that are estimated to be at lesser depth.
In embodiments of the depth-based rendering technique, to determine the correct patch sizes across an image of a scene, a property of the focused plenoptic data may be leveraged. This property is that the microimages capture overlapping regions of the scene. The patch size also determines the spacing between patches; the correct patch size for focusing a region of a scene will also be the spacing at which neighboring microimages overlap. That is, the same portion of the scene that is captured by different microlenses needs to be rendered to the same position in the output image. This matching condition leads to the following two-pass algorithm for rendering:

    
    
        For each microlens (and thus for the respective microimages in the flat), determine the patch size that results in the best match with all of its neighbors.
        Render the final image with the saved pitch value for each microlens.
    
    


Determining the minification that provides the best match between two microlens images is essentially an image registration problem. Embodiments may exploit several aspects of focused plenoptic camera technology to streamline this process. First, the microimages in the captured radiance may be precisely determined by the microlens geometry, and may be precisely aligned. Thus, the difference between neighboring microimages along the horizontal and vertical axes of the microlens array may only be horizontal and vertical translations, respectively. Moreover, based on the optical design of the focused plenoptic camera, there are bounds on how large the shift between microlens images can be. In at least some embodiments, these characteristics of the captured radiance may be used to simplify a depth estimation algorithm.
In at least some embodiments, the depth estimation algorithm produces an array of patch size values that are subsequently used in rendering the final image; this array may be referred to as a depth array or depth mask. To render the final image, the basic full resolution rendering algorithm is modified so that, rather than using a fixed pitch value, the precomputed value for a given microlens is looked up in the depth array.
Example pseudocode for a depth estimation algorithm that may be used in at least some embodiments is given in the section titled Depth Estimation. FIG. 14 graphically illustrates an embodiment of a depth estimation algorithm that may be used in at least some embodiments. FIG. 13 graphically illustrates an example of estimated depth used for the rendered image shown in FIG. 12. The lighter regions in FIG. 13 correspond to foreground, and thus to larger pitch values. The darker regions correspond to background, and thus to smaller pitch values.
FIG. 12 shows an example image rendered using a depth-based rendering algorithm, according to at least some embodiments. By extracting depth information as described above and then rendering the image with different magnification at each microlens, the image in FIG. 12 may be rendered from the radiance data illustrated in FIG. 9, according to the depth estimation illustrated in FIG. 13. Note that regions of the image in FIG. 12 at all depths are rendered essentially artifact-free when compared to the rendered image in FIG. 9, and that the image in FIG. 12 appears to be in focus at essentially all depths.
Depth Estimation
An algorithm for estimating depth (referred to as a depth estimation algorithm) that may be used in at least some embodiments is given below. The operation of the depth estimation algorithm is illustrated graphically in FIG. 14. The depth estimation algorithm produces an array of pitch values that may subsequently be used in rendering the final image. Note that the depth estimation algorithm is given as example pseudocode, and is not intended to be limiting.
For each N×N microlens image:
Select an m×m window from the center of that microlens image.
For k=−N+m/2 to k=N−m/2:

    
    
        Compute the cross-correlation between the m×m window and a corresponding window centered at kx in the neighboring microlens image along the x axis and record the value of kx with the best correlation.
        Compute the cross-correlation between the m×m window and a corresponding window centered at ky in the neighboring microlens image along they axis and record the value of ky with the best correlation.
        Record a value k equal to average of kx on the left and right boundaries and ky on the top and bottom boundaries

Return the array of recorded values of k.

Example Depth-Based Rendering Algorithm

    
    


In at least some embodiments, to render the final image using depth information, the basic rendering algorithm that was previously described may be modified so that, rather than using a fixed pitch value, the value for the given microlens is looked up in the pitch array. In at least some embodiments, the depth-based rendering algorithm may be performed at least in part on parallel computing architectures, for example the architectures of GPU platforms, multi-core or multi-processor platforms, and so on. An example GLSL implementation of the depth-based rendering algorithm that may be used in at least some embodiments is given below. Note that this code renders one point in the output image, and may be performed in parallel to render multiple points in the output image simultaneously. Note that this code is given as an example, and is not intended to be limiting. Any suitable GPU programming language and tools may be used to implement embodiments of the depth-based rendering algorithm. Comments are preceded by double slashes (//).












// input or global parameters








uniform sampler2DRect Flat;
// the plenoptic image


uniform sampler2DRect DepthMask;
// depth input, e.g. generated



// according to the depth estimation



// algorithm previously described


uniform float MicroimageSize;
// μ, the size of one microlens image



// (microimage), in pixels


uniform vec2 Offset;
// vector indicating the x and y offsets



// or shifts for the patches from center







void main( )


{









// Calculate the offset or shift for the patch in the microimage



vec2 offset = Offset*MicroimageSize;



// Calculate M2, the size of the patch for this microimage. This reads a value



// (between 0 and 1) from the DepthMask at gl_TexCoord[0].st + offset. The



// value is read from the red channel, as indicated by the “.r”, as that is the channel



// in DepthMask that is used to store the depth values; however, other methods for



// storing and reading the depth values may be used. The value −25.6 is an



// implementation-dependent scaling value.



float M2 = −25.6*(texture2DRect(DepthMask, gl_TexCoord[0].st + offset).r);



// p = └x/μ┘; x is the point on the screen that is to be rendered; p is the index of



// the microlens from which x will be rendered



vec2 p= floor(gl_TexCoord[0].st / MicroimageSize);



// Calculate and center the offset q in the patch (q′ = q + (μ − M)/2)



// q is calculated by (gl_TexCoord[0].st / MicroimageSize − p) * M2; Qp is q′.



// M2, the calculated size of the patch for this microimage based on the estimated



// depth for this microimage, is used for M instead of a global patch size.



vec2 Qp = (gl_TexCoord[0].st / MicroimageSize − p) * M2 +



0.5*(MicroimageSize − M2);



// Apply the shift to the calculated position in the patch; R is the calculated



// position in the patch including all corrections.



vec2 R = Qp + offset;



// calculate the position from which the flat will be sampled



// vPosXY = p (microlens index) * the microimage size, plus the corrected



// position R in the patch.



vec2 vPosXY = p * MicroimageSize + R;



// read the value from the calculated position vPosXY of the input flat



vec4 colXY = texture2DRect(Flat, vPosXY);



// assign the value of colXY to gl_FragColor, i.e. to the point in the output image



gl_FragColor = colXY;







}









Flowcharts for the Depth-Based Rendering Technique

FIGS. 15A and 15B are flowcharts of a depth-based rendering technique, according to at least some embodiments. FIG. 15A is a high-level flowchart of a method for depth based rendering, according to at least some embodiments. As indicated at 200, a flat including a plurality of microimages of separate portions of an image of a scene is obtained. Each of the plurality of microimages is in a separate region of the flat. The flat is a two-dimensional (2D) representation of a four-dimensional (4D) light-field that captures both spatial and angular information of the scene, captured according to focused plenoptic camera technology.
As indicated at 202, for each of the plurality of microimages, a depth of a respective portion of the image of the scene is estimated. An example method for estimating depth is given above in the section titled Depth estimation. In some embodiments, to estimate depth for a given microimage, the method computes cross-correlation between a window in the given microimage and a corresponding window centered at multiple positions in two or more neighboring microimages to determine best correlation values. The method then estimates the depth for the given microimage according to the determined best correlation values for the given microimage with the two or more neighboring microimages.
As indicated at 204, the method renders an output image of the scene from the plurality of separate microimages according to the estimated depths. To render the output image, the method given in FIG. 15A may separately determine a value for each point of the output image from the flat.
FIG. 15B is a flowchart of a method for rendering a given point in an output image, according to at least some embodiments of the depth-based rendering technique. As indicated at 210, a source microimage in the flat from which this point in the output image is to be rendered is determined. As indicated at 212, a position in the flat is determined according to this point in the output image, the determined source image, and the estimated depth corresponding to the determined source microimage. As indicated at 214, a value is read from the calculated position in the flat and assigned to the point in the output image. The section above titled Example depth-based rendering algorithm gives an example implementation of the method of FIG. 15B.
In at least some embodiments, the methods of FIGS. 15A and 15B perform the depth-based rendering technique according to parallel processing technology that renders multiple points of the output image in parallel. In at least some embodiments, the parallel processing technology is graphical processing unit (GPU) technology.
Rendering with Blending
Embodiments of a rendering with blending technique for focused plenoptic camera data are described. Rendering for finite size apertures involves integration in the angular dimensions. Intuitively, this integration process means that the same spatial point must be averaged together (blended) across different microlens images (see, e.g., FIG. 4, left portion). A direct comparison of basic full resolution rendering and rendering with blending is shown in FIGS. 16B and 16C. FIG. 16A shows a small crop from a raw image (flat) captured with a focused plenoptic camera. FIG. 16B shows an image rendered from the flat of FIG. 16A using the basic full resolution rendering algorithm. Note the presence of artifacts due to non-matching patches at large depth. FIG. 16C shows an image rendered using a rendering with blending technique. Note that the artifacts are now suppressed, and that the out-of-focus regions (the background, in this example) appear properly blurred. Note the reduction of artifacts and the effect of “focusing” on the foreground with blurred background in the blended rendering version of the image shown in FIG. 16C.
Although the depth-based rendering technique as previously described enables artifact-free rendering of a single view of the scene when compared to rendering using a basic full resolution rendering as previously described, the result is an “all in-focus” image which precludes depth-of-field and refocusing effects (see, for example, FIG. 12). Obtaining these effects may require combining multiple views of a scene, that is, integrating over a range of views as specified in equation (4):

I(q)=∫pr(q,p)dp. 

To accomplish the integration over p in equation (4) for the focused plenoptic camera, the same spatial point may be averaged together (blended) across microlens images. (Averaging across microlens images is in contrast to the conventional plenoptic camera that averages within microlens images). For microlenses spaced μ apart and a patch size of M, the pixels that need to be averaged together for a given output pixel will be separated by distance (μ−M) in the captured raw image.
From the phase space diagram of the rendering process (FIG. 4), it can be seen that for small mismatches of the slope of the integration direction, blending should be sufficient to produce a smooth blur. (Note that the slope is vertical in FIG. 4, but since different depths are related by shear in ray space, in general slope is non-vertical, and is defined by M). For larger mismatches, there may not be enough views, and ghost-like artifacts may be seen due to features being repeated across multiple patches.
A comparison of two rendering with blending results is shown in FIGS. 17A and 17B. FIG. 17A shows an image rendered using the rendering with blending algorithm with a small pitch (e.g., 7 pixels). Note that, in FIG. 17A, the background is in focus, and the foreground is out of focus. FIG. 17B shows an image rendered using the rendering with blending algorithm with a larger pitch (e.g., 10 pixels). Note that, in FIG. 17B, the background is out of focus, and the foreground is in focus.
Focusing
An important characteristic of plenoptic data captured with focused plenoptic camera technology is that refocusing may be accomplished through choice of the pitch size in the rendering algorithm. The pitch is related to shear in ray space. Conversely, the value of the pitch determines the plane (the depth) in the image that is in focus. Images captured with the focused plenoptic camera can therefore be used to generate differently focused rendered images by choosing different values of the pitch size. When multiple microlens images are integrated (blended) according to the rendering with blending technique, the out-of-focus regions appear blurred, as would be expected. Because the microlenses have a very small aperture, there is a significant depth of field, i.e., portions of the scene that are in focus for a given value of the pitch size will extend for a large depth.
Example Rendering with Blending Algorithm
To realize the integration over p in equation (4), i.e., over multiple views, the same spatial point may be averaged together (blended) across microlens images. For microlenses spaced μ apart and a patch size of M, the pixels that need to be averaged together to render a given pixel in the rendered image will be distance (μ−M) apart.
That is, all pixels at position f(x) are averaged, where:




  
    
      
        
          
            
              f
              i
            
            ⁡
            
              (
              x
              )
            
          
          =
          
            
              p
              i
            
            +
            
              q
              ′
            
          
        
        ⁢
        
          

        
        ⁢
        where
      
    
    
      
        (
        F1
        )
      
    
  
  
    
      
        
          p
          i
        
        =
        
          
            ⌊
            
              x
              μ
            
            ⌋
          
          +
          
            i
            ⁡
            
              (
              
                μ
                -
                M
              
              )
            
          
        
      
    
    
      
        (
        F2
        )
      
    
  




for i= . . . , −2, −1, 0, 1, 2, . . . and q′ is given by equation (C3):





  
    
      
        
          
            
              
                q
                ′
              
              =
              
              ⁢
              
                q
                +
                
                  
                    μ
                    -
                    M
                  
                  2
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  
                    (
                    
                      
                        x
                        μ
                      
                      -
                      p
                    
                    )
                  
                  ⁢
                  M
                
                +
                
                  
                    
                      μ
                      -
                      M
                    
                    2
                  
                  .
                
              
            
          
        
      
    
    
      
        (
        C3
        )
      
    
  




Since μ is constant, this means that for images generated with a given sampling pitch M there is a fixed upper bound, Um, for the absolute value of i, namely




  
    
      
        lim
        =
        
          (
          
            
              
                ⌊
                
                  μ
                  M
                
                ⌋
              
              -
              1
            
            2
          
          )
        
      
    
    
      
        (
        F3
        )
      
    
  




In addition, in at least some embodiments the contribution from different views may be weighted to perform weighted blending. To accomplish weighted blending within GLSL implementations, another texture (single-component, in this case) may be as a lookup table to specify the weight of each pixel in the microlens as a function of position. If fragment coordinates fall outside the weight mask, then the texture wrapping mode would determine what happens with the lookup. This situation occurs when the weight mask is smaller than one microlens image, or when the chosen lim value is larger than the one obtained from equation (F3). In some embodiments, a μ×μ Gaussian, or squared Gaussian mask with GL CLAMP set as the wrapping mode, may be used. Also, note that when using Gaussian-like masks, an alternative method for changing the viewpoint of the synthesized image is by adding an offset vector to the weight coordinates. If using varying weights, the method needs to keep track of the net weight so that the output color components can be normalized.
In at least some embodiments, the rendering with blending algorithm may be performed at least in part on parallel computing architectures, for example the architectures of GPU platforms, multi-core or multi-processor platforms, and so on. An example GLSL fragment shader code that may implement the rendering with blending algorithm that be used in at least some embodiments is given below. Note that this code renders one point in the output image, and may be performed in parallel to render multiple points in the output image simultaneously. Note that this code is given as an example, and is not intended to be limiting. Any suitable GPU programming language and tools may be used to implement embodiments of the algorithm. Comments are preceded by double slashes (//).












// input or global parameters








uniform sampler2DRect weight,
// lookup table that specifies the weight of



// each pixel in the microlens as a function



// of position










flat;
// the plenoptic image








uniform float M, mu;
// M is the size of a patch; mu is μ, the size



// of one microlens image in pixels


uniform int lim;
// fixed upper bound for the absolute value



// of i; see equation F3.







void main( )


{









// p = └x/μ┘; x is the point on the screen that is to be rendered; p is the index of



// the microlens (i.e., microimage) from which x will be rendered (in this case, x



// is blended from the values of multiple microimages in the neighborhood of p)



vec2 p= floor(gl_TexCoord[0].st / mu);



// Calculate and center the offset q in the patch (q′ = q + (μ − M)/2)



// q is calculated by (gl_TexCoord[0].st / mu − p) * M; qp is q′.



vec2 qp = (gl_TexCoord[0].st / mu − p) * M + 0.5*(mu − M);



// initialize a color and a total weight variable



vec4 colXY = vec4(0.0);



float total_weight = 0.0;



// loop through the microimages from which pixels are to be sampled and



// blended; for example, if lim = 1, a 3×3 square containing nine microimages



// will be sampled.



for (int i= −lim; i <= lim; ++i) {









for (int j= −lim; j <= lim; ++j) {









// form a vector from the current values of loop indexes i and j



vec2 ij = vec2(float(i), float(j ));



// compute the position from which the weight will be obtained



vec2 dq = qp − ij * M;



// get the weight for this position



float weight = texture2DRect(weight, dq).r;



// compute the position from which the flat will be sampled



vec2 vPosXY = (p + ij)*mu + dq;



// read the value from position vPosXY of the flat, adjust the value



// according to the weight, and add the adjusted value to colXY



colXY += texture2DRect(flat, vPosXY); * weight;



// accumulate the weight in total weight



total weight += weight;









}









}



// normalize the value of colXY by dividing by the accumulated weigh value and



// assign the normalized value to gl_FragColor



gl_FragColor = colXY / total_weight;







}









Note that, in some embodiments, instead of accumulating the weights and normalizing the accumulated value according to the accumulated weights as described above, the accumulated value may be normalized in other ways, or may simply be averaged by dividing the accumulated value by the total number of microimages that were sampled rather than the accumulated weight.
Flowcharts for the Depth-Based Rendering Technique
FIGS. 18A and 18B are flowcharts of a rendering with blending technique, according to at least some embodiments. FIG. 18A is a high-level flowchart of a method for rendering with blending, according to at least some embodiments. As indicated at 300, a flat including a plurality of microimages of separate portions of an image of a scene is obtained. Each of the plurality of microimages is in a separate region of the flat. The flat is a two-dimensional (2D) representation of a four-dimensional (4D) light-field that captures both spatial and angular information of the scene, captured according to focused plenoptic camera technology. As indicated at 302, the method renders an output image of the scene from the plurality of separate microimages. To render the output image, each point in the output image is rendered by blending values from multiple microimages.
FIG. 18B is a flowchart of a method for rendering a given point in an output image, according to at least some embodiments of the rendering with blending technique. As indicated at 310, a target microimage in the flat is determined for this point. As indicated at 312, a position in the target microimage from which a value is to be sampled is calculated. As indicated at 314, for each microimage in a neighborhood including the target image (e.g., a 3×3 neighborhood), a value from the calculated position in the respective microimage is calculated, and the value is added to a value accumulator. In at least some embodiments, the value may be weighted according to the position of the respective microimage in the neighborhood before adding the value to the accumulator. In at least some embodiments, the weight used may also be added to a separate weight accumulator. As indicated at 316, the value in the value accumulator may be normalized, and the normalized value may be assigned to the point in the output image. In at least some embodiment, normalizing may be performed by dividing the accumulated value by the accumulated weight value. Other methods for normalizing, for example averaging, may be used in some embodiments. The section above titled Example rendering with blending algorithm gives an example implementation of the method of FIG. 18B.
In at least some embodiments, the methods of FIGS. 18A and 18B perform the rendering with blending technique according to parallel processing technology that renders multiple points of the output image in parallel. In at least some embodiments, the parallel processing technology is graphical processing unit (GPU) technology.
Combining Depth-Based Rendering and Rendering with Blending
While both the depth-based rendering technique and the rendering with blending technique described herein may be implemented separately, embodiments of a combined technique that uses both depth-based rendering and rendering with blending are described. In the combined technique, depth may be estimated as described for the depth-based rendering technique. The rendering may then be performed similar to that described for the rendering with blending technique where values are sampled (with weighting) from several neighboring microimages. However, the value of M in the rendering with blending technique would be calculated as in the depth-based rendering technique (given by M2 in the example shader code) prior to sampling the values in the loop of the rendering with blending technique. Thus, for each point in the output being calculated by a shader the algorithm, the value of M would be calculated as in the depth-based rendering technique, and multiple microimages would be sampled as in the rendering with blending technique at the calculated value of M. For different points being rendered, M would be different, but for each point the value would be a blended value.
FIG. 19 is a high-level flowchart of a method for combined depth based rendering and rendering with blending, according to at least some embodiments. As indicated at 400, a flat including a plurality of microimages of separate portions of an image of a scene is obtained. As indicated at 402, for each of the plurality of microimages, a depth of a respective portion of the image of the scene is estimated. An example method for estimating depth is given above in the section titled Depth estimation. As indicated at 404, an output image of the scene is rendered from the plurality of separate microimages according to the estimated depths. Each point in the output image is rendered by blending values from multiple microimages in a neighborhood including the target microimage; the estimated depth for the target microimage applies to all of the microimages because the sampling position in the microimages is calculated according to the estimated depth for the target microimage. The section above titled Example depth-based rendering algorithm gives an example implementation of a method that applies the estimated depth to determine the sampling position. The section above titled Example rendering with blending algorithm gives an example implementation of a method that blends values from multiple microimages in a neighborhood.
Example User Interface
FIG. 20 shows an example user interface, according to some embodiments, for processing a flat captured with a focused plenoptic camera according to one of the full-resolution rendering techniques described herein to render an output image. At least some embodiments may provide a user interface 3400 and one or more user interface elements (e.g., full-resolution image 3402 and depth of focus control 3404) via which a user can interactively apply a full-resolution rendering algorithm to an input image. In at least some embodiments, the user interface may provide a depth of focus control 3404, such as a slider bar, via which the user can change the depth of focus. In at least some embodiments, the user interface may provide one or more other user interface elements for adjusting one or more other rendering parameters. In at least some embodiments, the rendering algorithm may be implemented, at least in part, to execute on parallel processing technology, for example as a graphics processing unit (GPU) application executable on a GPU. This technique may provide immediate feedback; that is, the user may adjust the user interface element and interactively see the new rendering results on a displayed full-resolution image 3402. Thus, the user may tweak the user interface element 3404 to quickly determine a preferred depth of focus or other parameter to generate a full-resolution output image 3402 from an input focused plenoptic camera image.
Example Implementations of Rendering Methods
Embodiments of the full-resolution rendering techniques as described herein may be performed by a rendering module implemented by program instructions stored in a computer-readable storage medium and executable by one or more processors (e.g., one or more CPUs or GPUs) of a computer system or other device. FIG. 21 illustrates a full-resolution rendering module rendering images from a flat captured, for example, by various embodiments of a focused plenoptic camera. Rendering module 920 may, for example, implement a basic full resolution rendering technique, a depth-based rendering technique, a rendering with blending technique, and/or a combined depth-based rendering and rendering with blending technique for rendering full-resolution images from flats captured using focused plenoptic cameras, as described herein. FIG. 22 illustrates an example computer system on which embodiments of rendering module 920 may be implemented. FIG. 20 illustrates an example user interface for a rendering module 920 (note that other user interfaces may also be provided). In some embodiments of a focused plenoptic camera, rendering module 920 may be implemented in the camera, e.g. in captured data processing module. Referring to FIG. 21, rendering module 920 receives an input flat 910 captured by focused plenoptic camera technology. Example portions of flats as may be captured by various embodiments of a focused plenoptic camera are illustrated in FIG. 8 and FIG. 16A. Rendering module 920 then processes the input image 910 according to an appropriate full-resolution rendering technique as described herein, for example the full resolution rendering technique, the depth-based rendering technique, the rendering with blending technique, or the combined depth-based rendering and rendering with blending technique. Rendering module 920 generates as output one or more images 930. Output image 930 may, for example, be stored to a storage medium 940, such as system memory, a disk drive, DVD, CD, etc. The dashed line from input image 910 to storage medium 940 indicates that the original (input) flat 910 may also be stored. The dashed line from storage medium 940 to rendering module 920 indicates that stored images may be retrieved and further processed by rendering module 920.
In some embodiments, rendering module 920 may provide a user interface 922 via which a user may interact with the module 920, for example to specify or otherwise manage input flats 910 and output images 930 as described herein. The user interface 922 may also provide one or more user interface elements whereby the user may select parameters of the full-resolution rendering method, such as the depth of focus to be used to render an image from a given flat. An example user interface is shown in FIG. 20.
Example System
Embodiments of a full resolution rendering module and/or one or more of the various full resolution rendering methods as described herein may be executed on one or more computer systems, which may interact with various other devices. One such computer system is illustrated by FIG. 22. In different embodiments, computer system 1000 may be any of various types of devices, including, but not limited to, a personal computer system, desktop computer, laptop, notebook, or netbook computer, mainframe computer system, handheld computer, workstation, network computer, a camera, a set top box, a mobile device, a consumer device, video game console, handheld video game device, application server, storage device, a peripheral device such as a switch, modem, router, or in general any type of computing or electronic device.
In the illustrated embodiment, computer system 1000 includes one or more processors 1010 coupled to a system memory 1020 via an input/output (I/O) interface 1030. Computer system 1000 further includes a network interface 1040 coupled to I/O interface 1030, and one or more input/output devices 1050, such as cursor control device 1060, keyboard 1070, audio device 1090, and display(s) 1080. In some embodiments, it is contemplated that embodiments may be implemented using a single instance of computer system 1000, while in other embodiments multiple such systems, or multiple nodes making up computer system 1000, may be configured to host different portions or instances of embodiments. For example, in one embodiment some elements may be implemented via one or more nodes of computer system 1000 that are distinct from those nodes implementing other elements.
In various embodiments, computer system 1000 may be a uniprocessor system including one processor 1010, or a multiprocessor system including several processors 1010 (e.g., two, four, eight, or another suitable number). Processors 1010 may be any suitable processor capable of executing instructions. For example, in various embodiments, processors 1010 may be general-purpose or embedded processors implementing any of a variety of instruction set architectures (ISAs), such as the x86, PowerPC, SPARC, or MIPS ISAs, or any other suitable ISA. In multiprocessor systems, each of processors 1010 may commonly, but not necessarily, implement the same ISA. In some embodiments, computer system 1000 may be a digital camera.
In some embodiments, at least one processor 1010 may be a graphics processing unit. A graphics processing unit or GPU may be considered a dedicated graphics-rendering device for a personal computer, workstation, game console or other computing or electronic device. Modern GPUs may be very efficient at manipulating and displaying computer graphics, and their highly parallel structure may make them more effective than typical CPUs for a range of complex graphical algorithms. For example, a graphics processor may implement a number of graphics primitive operations in a way that makes executing them much faster than drawing directly to the screen with a host central processing unit (CPU). In various embodiments, the various rendering methods disclosed herein may be implemented at least in part by program instructions configured for execution on one of, or parallel execution on two or more of, such GPUs. The GPU(s) may implement one or more application programmer interfaces (APIs) that permit programmers to invoke the functionality of the GPU(s). Suitable GPUs may be commercially available from vendors such as NVIDIA Corporation, ATI Technologies, and others.
System memory 1020 may be configured to store program instructions and/or data accessible by processor 1010. In various embodiments, system memory 1020 may be implemented using any suitable memory technology, such as static random access memory (SRAM), synchronous dynamic RAM (SDRAM), nonvolatile/Flash-type memory, or any other type of memory. In the illustrated embodiment, program instructions and data implementing desired functions, such as those described above for embodiments of a rendering module are shown stored within system memory 1020 as program instructions 1025 and data storage 1035, respectively. In other embodiments, program instructions and/or data may be received, sent or stored upon different types of computer-accessible media or on similar media separate from system memory 1020 or computer system 1000. Generally speaking, a computer-accessible medium may include storage media or memory media such as magnetic or optical media, e.g., disk or CD/DVD-ROM coupled to computer system 1000 via I/O interface 1030. Program instructions and data stored via a computer-accessible medium may be transmitted by transmission media or signals such as electrical, electromagnetic, or digital signals, which may be conveyed via a communication medium such as a network and/or a wireless link, such as may be implemented via network interface 1040.
In one embodiment, I/O interface 1030 may be configured to coordinate I/O traffic between processor 1010, system memory 1020, and any peripheral devices in the device, including network interface 1040 or other peripheral interfaces, such as input/output devices 1050. In some embodiments, I/O interface 1030 may perform any necessary protocol, timing or other data transformations to convert data signals from one component (e.g., system memory 1020) into a format suitable for use by another component (e.g., processor 1010). In some embodiments, I/O interface 1030 may include support for devices attached through various types of peripheral buses, such as a variant of the Peripheral Component Interconnect (PCI) bus standard or the Universal Serial Bus (USB) standard, for example. In some embodiments, the function of I/O interface 1030 may be split into two or more separate components, such as a north bridge and a south bridge, for example. In addition, in some embodiments some or all of the functionality of I/O interface 1030, such as an interface to system memory 1020, may be incorporated directly into processor 1010.
Network interface 1040 may be configured to allow data to be exchanged between computer system 1000 and other devices attached to a network, such as other computer systems, or between nodes of computer system 1000. In various embodiments, network interface 1040 may support communication via wired or wireless general data networks, such as any suitable type of Ethernet network, for example; via telecommunications/telephony networks such as analog voice networks or digital fiber communications networks; via storage area networks such as Fibre Channel SANs, or via any other suitable type of network and/or protocol.
Input/output devices 1050 may, in some embodiments, include one or more display terminals, keyboards, keypads, touchpads, scanning devices, voice or optical recognition devices, or any other devices suitable for entering or retrieving data by one or more computer system 1000. Multiple input/output devices 1050 may be present in computer system 1000 or may be distributed on various nodes of computer system 1000. In some embodiments, similar input/output devices may be separate from computer system 1000 and may interact with one or more nodes of computer system 1000 through a wired or wireless connection, such as over network interface 1040.
As shown in FIG. 22, memory 1020 may include program instructions 1025, configured to implement embodiments of a rendering module as described herein, and data storage 1035, comprising various data accessible by program instructions 1025. In one embodiment, program instructions 1025 may include software elements of embodiments of a rendering module as illustrated in the above Figures. Data storage 1035 may include data that may be used in embodiments. In other embodiments, other or different software elements and data may be included.
Those skilled in the art will appreciate that computer system 1000 is merely illustrative and is not intended to limit the scope of a rendering module as described herein. In particular, the computer system and devices may include any combination of hardware or software that can perform the indicated functions, including computers, network devices, internet appliances, PDAs, wireless phones, pagers, etc. Computer system 1000 may also be connected to other devices that are not illustrated, or instead may operate as a stand-alone system. In addition, the functionality provided by the illustrated components may in some embodiments be combined in fewer components or distributed in additional components. Similarly, in some embodiments, the functionality of some of the illustrated components may not be provided and/or other additional functionality may be available.
Those skilled in the art will also appreciate that, while various items are illustrated as being stored in memory or on storage while being used, these items or portions of them may be transferred between memory and other storage devices for purposes of memory management and data integrity. Alternatively, in other embodiments some or all of the software components may execute in memory on another device and communicate with the illustrated computer system via inter-computer communication. Some or all of the system components or data structures may also be stored (e.g., as instructions or structured data) on a computer-accessible medium or a portable article to be read by an appropriate drive, various examples of which are described above. In some embodiments, instructions stored on a computer-accessible medium separate from computer system 1000 may be transmitted to computer system 1000 via transmission media or signals such as electrical, electromagnetic, or digital signals, conveyed via a communication medium such as a network and/or a wireless link. Various embodiments may further include receiving, sending or storing instructions and/or data implemented in accordance with the foregoing description upon a computer-accessible medium. Accordingly, the present invention may be practiced with other computer system configurations.
Conclusion
Various embodiments may further include receiving, sending or storing instructions and/or data implemented in accordance with the foregoing description upon a computer-accessible medium. Generally speaking, a computer-accessible medium may include storage media or memory media such as magnetic or optical media, e.g., disk or DVD/CD-ROM, volatile or non-volatile media such as RAM (e.g. SDRAM, DDR, RDRAM, SRAM, etc.), ROM, etc., as well as transmission media or signals such as electrical, electromagnetic, or digital signals, conveyed via a communication medium such as network and/or a wireless link.
The various methods as illustrated in the Figures and described herein represent example embodiments of methods. The methods may be implemented in software, hardware, or a combination thereof. The order of method may be changed, and various elements may be added, reordered, combined, omitted, modified, etc.
Various modifications and changes may be made as would be obvious to a person skilled in the art having the benefit of this disclosure. It is intended that the invention embrace all such modifications and changes and, accordingly, the above description to be regarded in an illustrative rather than a restrictive sense.

## Claims

1. A method, comprising:
obtaining a flat comprising a plurality of microimages of separate portions of an image of a scene, wherein each of the plurality of microimages is in a separate region of the flat that is a two-dimensional (2D) representation of a four-dimensional (4D) light-field that captures both spatial and angular information of the scene;
rendering an output image of the scene from the plurality of microimages, said rendering for each point of the output image comprising:
determining a target microimage in the flat for a point;
calculating a position in the target microimage from which a value is to be sampled;
for each microimage in a neighborhood including the target microimage, reading the value from the calculated position in the respective microimage and adding the value to a value accumulator, said adding the value comprising weighting the value read from the respective microimage according to a position of the respective microimage in the neighborhood prior to said adding the value to the value accumulator; and
normalizing the value in the value accumulator and assigning the normalized value to the point in the output image.

2. The method as recited in claim 1, wherein said rendering the output image of the scene from the plurality of microimages comprises performing said rendering according to a parallel processing technique that renders multiple points of the output image in parallel.

3. The method as recited in claim 2, wherein the parallel processing technique is implemented according to graphical processing unit (GPU) technology.

4. The method as recited in claim 1, wherein said normalizing the value in the value accumulator comprises normalizing the value in the value accumulator according to a sum of the weights of the microimages in the neighborhood.

5. The method as recited in claim 1, wherein said calculating the position in the target microimage from which the value is to be sampled comprises calculating the position within an M×M region within the target microimage.

6. The method as recited in claim 1, wherein for each said microimage in the neighborhood including the target microimage, the values from the calculated positions in the respective microimages are averaged together across the plurality of microimages.

7. The method as recited in claim 1, wherein a focused plenoptic camera implements said obtaining a plenoptic image as the flat comprising the plurality of the microimages through an array of microlenses.

8. A non-transitory computer-readable storage memory storing program instructions that are executable and, responsive to execution of the program instructions, a computer device implements operations comprising to:
obtaining a flat comprising a plurality of microimages of separate portions of an image of a scene, wherein each of the plurality of microimages is in a separate region of the flat that is a two-dimensional (2D) representation of a four-dimensional (4D) light-field that captures both spatial and angular information of the scene;
rendering an output image of the scene from the plurality of microimages, said rendering for each point of the output image comprising:
determining a target microimage in the flat for a point;
calculating a position in the target microimage from which a value is to be sampled;
for each microimage in a neighborhood including the target microimage, reading the value from the calculated position in the respective microimage and adding the value to a value accumulator, said adding the value comprising weighting the value read from the respective microimage according to a position of the respective microimage in the neighborhood prior to said adding the value to the value accumulator; and
normalizing the value in the value accumulator and assigning the normalized value to the point in the output image.

9. The non-transitory computer-readable storage memory as recited in claim 8, wherein the computer device implements said rendering the output image of the scene from the plurality of microimages according to a parallel processing technique that renders multiple points of the output image in parallel.

10. The non-transitory computer-readable storage memory as recited in claim 9, wherein the parallel processing technique is implemented according to graphical processing unit (GPU) technology.

11. The non-transitory computer-readable storage memory as recited in claim 8, wherein the computer device implements said normalizing the value in the value accumulator according to a sum of the weights of the microimages in the neighborhood.

12. The non-transitory computer-readable storage memory as recited in claim 8, wherein the computer device implements said calculating the position in the target microimage from which the value is to be sampled within an M×M region within the target microimage.

13. The computer-readable storage memory as recited in claim 8, wherein for each said microimage in the neighborhood including the target microimage, the computer device implements averaging the values from the calculated positions in the respective microimages together across the plurality of microimages.

14. The computer-readable storage memory as recited in claim 8, wherein the computer device is a focused plenoptic camera that implements said obtaining a plenoptic image as the flat comprising the plurality of the microimages through an array of microlenses.

15. A system, comprising
at least one processor; and
a memory comprising program instructions that are executable by the at least one processor to:
obtain a flat comprising a plurality of microimages of separate portions of an image of a scene, wherein each of the plurality of microimages is in a separate region of the flat that is a two-dimensional (2D) representation of a four-dimensional (4D) light-field that captures both spatial and angular information of the scene;
render an output image of the scene from the plurality of microimages, and for each point of the output image:
determine a target microimage in the flat for a point;
calculate a position in the target microimage from which a value is to be sampled;
for each microimage in a neighborhood including the target microimage, read the value from the calculated position in the respective microimage and add the value to a value accumulator, the value being added comprising the value read from the respective microimage weighted according to a position of the respective microimage in the neighborhood prior to the value being added to the value accumulator; and
normalize the value in the value accumulator and assign the normalized value to the point in the output image.

16. The system as recited in claim 15, wherein the at least one processor includes at least one graphical processing unit (GPU), and wherein the program instructions are executable by the at least one GPU to render the output image of the scene from the plurality of microimages according to a parallel processing technique that renders multiple points of the output image in parallel.

17. The system as recited in claim 15, wherein the program instructions are executable by the at least one processor to normalize the value in the value accumulator according to a sum of the weights of the microimages in the neighborhood.

18. The system as recited in claim 15, wherein the program instructions are executable by the at least one processor to calculate the position in the target microimage from which the value is to be sampled within an M×M region within the target microimage.

19. The system as recited in claim 15, wherein for each said microimage in the neighborhood including the target microimage, the program instructions are executable by the at least one processor to average the values from the calculated positions in the respective microimages together across the plurality of microimages.

20. The system as recited in claim 15, wherein a focused plenoptic camera comprises the at least one processor and the memory, and wherein the program instructions are executable to said obtain a plenoptic image as the flat comprising the plurality of the microimages through an array of microlenses.