Eric Burkhart, Eunjoon Cho, James Painter

From Psych 221 Image Systems Engineering
Revision as of 00:23, 17 March 2011 by imported>Eburk
Jump to navigation Jump to search

Introduction

To a user, a digital camera feels straightforward - look at a scene, take a picture, and the image comes out looking like the scene. Inside the case, there's a complex processing pipeline required to transform the raw data into that image. This complexity comes from two limitations in the data - noise and a color filter array (CFA).

The CFA is an array of sensors, one per pixel of the final image, that collects incoming light from the scene. The problem is that each node in the array only outputs a single number instead of one number for every wavelength to which the human eye responds. This causes two problems - first an algorithm needs to estimate the value of red, green, and blue at all pixels, and second each sensor has spectral sensitivities at all wavelengths even though it's value ends up representing a single color. Demosaicing methods have been established to determine the value of missing colors at each pixel using neighboring values.

The sensors themselves are subject to a variety of noises - shot noise, read noise, fixed pattern noise, reset noise, dark current noise, etc. Some of these noise sources can be calibrated out while others cannot be avoided. As a result, denoising methods are an important step in transforming raw data to a high quality image.

For many years, the denoising and demosaicing steps were performed seperately with the first step complicating the noise for the next one. The pipeline explored in this project combines these steps to avoid that problem.

Methods

Zhang Paper: Joint Denoising and Demosaicing of Channel Dependent Noise

Describe theory of algorithm here.

Equations

If you want to use equations, you can use the same formats that are use on wikipedia.
See wikimedia help on formulas for help.
This example of equation use is copied and pasted from wikipedia's article on the DFT.

The sequence of N complex numbers x0, ..., xN−1 is transformed into the sequence of N complex numbers X0, ..., XN−1 by the DFT according to the formula:

where i is the imaginary unit and is a primitive N'th root of unity. (This expression can also be written in terms of a DFT matrix; when scaled appropriately it becomes a unitary matrix and the Xk can thus be viewed as coefficients of x in an orthonormal basis.)

The transform is sometimes denoted by the symbol , as in or or .

The inverse discrete Fourier transform (IDFT) is given by


Modifications

Implementation

  • Shift in the Bayer Pattern: The Bayer pattern provided in the project code was a 90 degree counter-clockwise rotation of that assumed by the default Zhang implementation. To fix this we rotated the CFA pattern in the project code, although shifting the first column of the image by one would have also worked.
  • Input Range Scaling: The Zhang implementation requires a 0-255 input value whereas the project provides a 0-1 value. We scaled the values by 255 going into Zhang's denoising/demosaicing step and then scaled back once it output the result.

Algorithmic

  • Power level normalization: The Zhang interpolation method incorporates the magnitude of all nearby pixels, not just those of the same color. As a result, a pixel with a high green component would cause nearby red and blue pixels to interpolate to higher than expected values. To fix this we scaled the input values of each channel independently based on the largest entry in that color channel (i.e. redScale = 255/maxRed, greenScale = 255/maxGreen, blueScale = 255/maxBlue). After getting the results from Zhang's denoising/demosaicing step, we the undid that scaling by dividing the result by the scale factor.

Results

Introduction to results here! Might be nice to have a table outlining numbers?

All SCIELAB measurements taken were in XYZ space and assumed the image takes up 20 degrees of visual angle.

Sample Images

  • Show some example images for the different light levels. (The script showresultimages.m should be helpful.)

Differences From An Ideal Image

  • Under what conditions are the differences between images from your pipeline and the ideal images visible or annoying? (By conditions I mean light levels, images, or image features. The errorImage output from scielabfind should be helpful to look at image features.)

Color Accuracy

The following MCC images display the color accuracy of the Zhang Improved (left) and original Zhang (right) pipelines as compared to the original image (middle). By comparing the mean SCIELAB differences on a smooth image with many colors, we get a good picture of the overall color accuracy.


MCC image comparison at 2000cd/m^2

The following graphs show the actual SCIELAB deltaE difference between the images in XYZ space using a 20 degree visual angle for the image. The first shows results at all light levels, and the second is a zoomed in version to display the difference. Since the deltaE difference between Zhang and Zhang improved is near 1 at low luminance and decreases from there as luminance increases, the change in XYZ space is unlikely to be visible. From the images above however in RGB space this difference is more visible.

MCC Color Bias Averaged Over Patches MCC Color Bias Averaged Over Patches (Zoomed In)

Noise Elimination: Smooth Regions

To test noise elimination in smooth regions of an image, we used the image of a Macbeth color checker due to the smooth nature of each color patch. The output of the simple pipeline at 20 cd/m^2 is on the left and the Zhang Improved output for the same image is on the right.


MCC Color Noise at 20cd/m^2

The results over all seven light levels used are shown in the graph below using the SCIELABS delta E metric. The largest improvements come at the low light levels.


deltaE of MCC over different luminances

Computation Time

The computation time for the simple pipeline is about 1/40th of a second while the improved Zhang method takes over 15 seconds.

Simple Pipeline Run Time Zhang Pipeline Run Time

Conclusions

According to SNR and SCIELAB metrics, our modification to the implementation of Zhang's algorithm improves performance in almost all cases (for very low luminance, the unmodified version does better by up to 1 dB in SNR). This modification addresses the problem of color bias by compensating for each color channel having a different power level.

After our modification, Zhang's method outperforms the basic bilinear interpolation demosaicing approach for all three noise models in both the SNR and SCIELAB metrics. The largest performance gains for Zhang's algorithm over the simple pipeline were seen for the noise model addressed in the paper - additive white Gaussian channel dependent noise with differing standard deviations in each color channel.

If we had more time, we would like to take real CFA data from a camera and test the performance of this algorithm. In this project the ISET noise models do not include the channel dependent noise that this algorithm was designed to address. As a result, we used an unrealistic additive white Gaussian noise to display the algorithm's abilities. It would be useful to see how it performs in a real world case where there may actually be different noise standard deviations in each color channel.

In terms of computation time, Zhang's algorithm takes 635 times longer to run than bilinear interpolation. This is about 15 seconds on a standard PC in 2011, meaning the current implementation may be too slow to see practical use. Further work may be able to speed up the algorithm either through more efficient code or hardware acceleration. Also, with the open source camera project [1] the implementation of the pipeline could potentially be moved to a PC in order to make it viable.

Finally, the SNR and SCIELAB metrics are useful for measuring fidelity to the ideal image but that ideal image may not be the most visually appealing representation. We subjectively preferred the output of the unmodified Zhang algorithm to the original image. If the end goal of a pipeline is to sell devices to real people, this is an important point to keep in mind.

References

Papers

L. Zhang, X. Wu, and D. Zhang, "Color Reproduction from Noisy CFA Data of Single Sensor Digital Cameras," IEEE Trans. Image Processing, vol. 16, no. 9, pp. 2184-2197, Sept. 2007. [2]

Software

  1. ISET Code [3]
  2. Zhang Algorithm Matlab Code [4]

Appendix I - Code and Data

Code

TODO: UPLOAD FINAL CODE!

Data

All source files and data needed to run the algorithm

Appendix II - Work partition (if a group project)

Brian and Bob gave the lectures. Jon mucked around on the wiki.