Today I continue exploring using a technique to produce half-sized images from sensors with Bayer color filter arrays (CFAs). The technique was described here, and the way I’m implementing it was explained here.
I started with a raw file of this scene, photographed with the Sony a7R and the Sony/Zeiss 55mm f/1.8 Sonnar FE (aka the Zony 55) lens:
I demosaiced the image with bilinear interpolation, and with adaptive homogeneity-directed demosaicing (AHD), then downsampled those images to half size in Photoshop using bicubic sharper. I also produced a half size image with the four-pixels-into-one technique. I enlarged a tight crop of each of the three images by 400% using nearest neighbor.
This is the image demosaiced with bilinear interpolation:
This is the image demosaiced with AHD:
This is the image downsampled using the four-pixels-into-one method:
The AHD and the bilinear interpolation images are virtually identical. The four-pixels-into-one crop is clearly sharper, but it also suffers from false-color artifacts, which are almost completely absent from the bilinear interpolation and AHD images. The side of the chimney is a good place to see the false-color four-pixels-into-one artifacts (which are red there), but you can also see many false colors in the tree leaves, although it wouldn’t be so obvious that they are artifacts if you didn’t have the other images to compare it with. Notice that the small branches and foliage in the bottom part of the crop are larger in the bilinear interpolation and AHD images, a symptom of lost sharpness.
This is typical of the differences throughout the scene. My conclusion is that the four-pixels-into-one technique is not, in general, worth the trouble. If the objective were a monochrome image, maybe things would be different.
It is also possible that some specialized filtering operation before the four-pixels into one operation would help. However, I have no plans to explore this.
Royi says
Do you know if DCRAW does a naive calculation of the “Super Pixel” or something fancy?
By Naive I mean only averaging the green and taking the ‘R’ and ‘B’.
If so, this is not a smart thing to do.
I think with slightly optimized algorithm the results should be much much better.
Jim says
Using your terminology, my understanding is that it does a “naive” calculation. IF you have suggestions for a better way, I’m all ears, especially if you have some Matlab code.;).
Jim
Royi says
Do you have a MATLAB code which knows how to get data from RAW files?
Maybe I’ll give it a try.
By the way, you should have “Enroll for updates” for the comments.
Otherwise I’ll never know about your response.
Jim says
Is this what you mean? Uses DCRAW…
pathInput = ‘ C:\temp\dcraw\’; %need the space in front for dcraw command
rawSuffix = ‘.ARW’; % this is for Sony
dcrawTiffSuffix = ‘.tiff’;
inFilename = ‘xxx’; %put file name here
dcrawOptions = ‘dcraw -v -w -P -o2 -h -k 128 -4 -T’; % put your chosen options here
fullFileName = strcat(pathInput,inFilename,rawSuffix);
dcrawCommand = strcat(pathDCRAW,dcrawOptions,fullFileName);
system(dcrawCommand); % result stored as TIFF
Then just read in the TIFF file.
Jim