From CS294-69 Image Manipulation and Computational Photography Fa11

Jump to: navigation, search

I implemented "Digital Photography with Flash and No-Flash Image Pairs" by Petschnigg et. al.

I first implemented the bilateral filter in matlab. This proved unbearably slow, so I constrained the gaussian filter to a radius of 6 pixels. This showed no noticeable degradation in the output quality. However, it was still too slow- for a 389x581 image, a single pass of the bilateral filter (for one channel) took 22 minutes. I then decided to port the code to optimized C, and ran it through mex. This improved the computation time to 24 seconds. The joint bilateral filter and the normalization term in the calculation repeat many of the same calculations, and caching the results would have improved the speed further.

The notation used in the figures is as follows:

"Bilateral ambient" is the bilateral filter run on the ambient image, or A_base in the paper.

"Bilateral flash" is the bilateral filter run on the flash image, or F_base in the paper.

"Joint bilateral" is A_nr in the paper.

"Detail layer" is F_detail in the paper.

"Final" is the combined flash/no-flash image.


Image 1: Rug

I first tested on the sample image provided in the paper.

Input Images

Click to enlarge.

No flash (ambient):

Carpet 01 noflash.jpg


Carpet 00 flash.jpg

Detail of input images

No flash (ambient) - notice the odd chromatic noise:


Flash - notice the blandness of the washed out colors:


Intermediate images

Notice how the bilateral ambient is missing a lot of detail, but retains the warmth of the image. Notice how the bilateral flash has the fine weaves of the carpet, but the colors are washed out.


Final image

Notice how the detail of the carpet is transferred, giving warm colors and fine details.


And the details of this image:


Image 2: Lens

I then tested on my own image. I decided to try out an image option that was more like what you would get in a dark scene: both underexposed and grainy. The bilateral filter had some difficulty with the fine text printed on the lens, but worked outside of that.

Input Images

Click to enlarge.

No flash (ambient), ISO 3200:

Cam noflash.jpg


Cam flash.jpg

Detail of input images

No flash (ambient) - notice how it is both very dark and grainy:


Flash - notice how the blanket looks very one-dimensional- namely, the shadows in the grooves are lost:


Intermediate images


Final image

The slight motion blur effect in the background is due to camera shake. Notice how the shadows in the blanket were properly transferred without noise.


And the details of this image:


Notice how the grain is removed and the shadows are restored.

[add comment]
Personal tools