The stock lens of the camera board has strong vignetting. To counter this for the normal (jpeg) output strong processing is used, with the disadvantage that the dynamic range is reduced. When mounting the board behind a DSLR lens this processing becomes a fault, as the (center of such a) lens has no vignetting. Using a RAW image taken directly from the sensor with the --raw option circumvents this disadvantage since no in-camera (or in-Pi) processing is done.
However, because an as yet unknown reason there's still significant *color* (not lightness) vignetting present in the RAW images. Besides that there seems to be a significant red hue in the shadows and possibly other problems as well. The goal of this thread is to find solutions so that the RAW output can be easily used, especially for non-stock lenses.
The images in this post were all taken with a Nikkor 50mm F/1.4D lens @ f/4. The sensor is mounted behind the lens like so (the screws and springs are there to fine tune the position of the board in order to make it exactly perpendicular to the lens axis): The scene I chose is a house at exactly 100m from the camera. On the left you see the jpeg image, on the right the RAW image directly taken from the DNG (created with raspi_dng from AlanD: http://www.raspberrypi.org/phpBB3/viewt ... 25#p361647): I also created a 'calibration' image taken with a diffuser over the lens. On the left the jpeg, on the right the image taken directly from RAW: I then wrote the following tiny program in Python. It reads a pixel from the (jpeg from raw) calibration image, determines the color difference from middle gray and then alters the same pixel from the (jpeg from raw) real image with the opposite color shift. Running this program on the Pi will take a few minutes for a single image, no doubt it will be much quicker with the right programming technique.
Code: Select all
import Image
im1 = Image.open("2699dng.jpg") #Open the calibration image taken with a diffuser
pix1 = im1.load()
size = im1.size #Get the width and hight of the image for iterating over
im2 = Image.open("13658dng.jpg") #Open the real image to be calibrated
pix2 = im2.load()
for x in range (0,size[0]):
for y in range (0,size[1]):
p1=pix1[x,y] #Get the RGBA Value of the a pixel of the calibration image
dr=p1[0]-127
dg=p1[1]-127
db=p1[2]-127
p2=pix2[x,y] #Get the RGBA Value of the a pixel of the real image
r=p2[0]-dr
g=p2[1]-dg
b=p2[2]-db
pix2[x,y] = (r,g,b) # Set the calibrated RGBA Value of the real image (tuple)
im2.save("final.jpg")