Using setColor(r,g,b) to pseudocolor Bayer Raw Image
Posted by
Daddymoen on
Dec 19, 2012; 10:06pm
URL: http://imagej.273.s1.nabble.com/Using-setColor-r-g-b-to-pseudocolor-Bayer-Raw-Image-tp5001221.html
To All,
I'm just learning ImageJ macro writing and this problem has me stumped. I've searched the forum posts looking for clues. Hopefully a more experienced macro writer can point me in the right direction to find a solution.
Using DCRaw (-v -4 -D -T filename.crw) I've converted a Camera Raw file to a 16-bit Tiff, Bayer Raw file. The resulting image file is not demosaiced or interpolated so the pixel intensity data is as close to the original camera sensor values as I know how to get. The 16-bit image has values in the range of 0 to 1023 (camera's 10-bit sensor range) with one value per pixel in an RGGB (2x2) pattern.
I want to pseudocolor this image using a method that writes RGB values to each pixel location. The LUTs available have more than one pixel intensity value in each bin which is too coarse for my application. (In the past I've used an algorithm in a FilterMeister filter that worked well. But alas, FilterMeister is C+, ImageJ is Java, and me no speakee Java.) As an experiment a wrote a macro to see if I could pseudocolor the Bayer Raw image at all. I attempted to change all the pixels in the image to Red using the following code.
// My first program to Color Bayer Raw Pixels
print("This Macro Colors Bayer Raw Pixels");
// Color all pixels Red
for (j=0; j < getHeight();j+=1)
{ for (i = 1; i < getWidth(); i+=1)
{ setColor(255,0,0);
}
}
updateDisplay();
print("I'm Done");
Needless to say if that code had worked I wouldn't be here asking for assistance. I assume there is something about my Bayer Raw image, my macro, or my lack of knowledge that won't allow my novice's
approach to work.
Is there a way to do this? Is there another approach to pseudocoloring 16-bit Bayer Raw images that might succeed?
Open to suggestions,
Daddymoen
Imagination is more important than knowledge. Albert Einstein