Login  Register

Re: An alternate approach to pseudocolor Bayer Raw Image?

Posted by Aivar Grislis on Dec 21, 2012; 5:19am
URL: http://imagej.273.s1.nabble.com/Using-setColor-r-g-b-to-pseudocolor-Bayer-Raw-Image-tp5001221p5001249.html

>I think I can easily create the "empty" 8-bit RGB file of the correct
>dimensions by just using DCRaw to convert a RAW file from the same camera
>into an ordinary, demosaiced and interpolated RGB file. As preparation I
>might even create a macro to change all the pixels in this empty file to
>black (0,0,0) or some other color by using setColor(r,g,b) so it doesn't
>contain any real image's data.

It's easy to create a second image of the same size as follows:

// examine source
sourceTitle = getTitle();
getBoundingRect(x, y, width, height);

// make copy
destTitle = sourceTitle + " deBayered";
newImage(destTitle, "RGB", width, height, 1); // type "RGB"; depth 1

Aivar

On 12/20/12, Daddymoen  wrote:

> To All,
>
> Been thinking about this some more and would like to run an idea past more
> experienced folks. I'm not familiar enough with ImageJ macros to know if
> this idea is possible. Feedback on this proposed, alternate method would be
> appreciated:
>
> 1. Create a new, "empty" 8-bit RGB image of exactly the same width and
> height (in pixels) as my Bayer Raw image and save it as some name, like
> maybe EmptyRGB.tiff or EmptyRGB.jpg
>
> 2 Run a macro in which I:
> 2a. Open my 16-bit, Bayer Raw image which has only a single pixel
> intensity value at each pixel location.
> 2b. Open my 8-bit, EmptyRGB.Tiff image which has three values per pixel,
> one r, one g and one b.
>
> 3. With both of these images simultaneously open.
>
> 4. Use a "for/next type" loop to read the single pixel value in the Bayer
> Raw image (to a variable) starting at location (0,0)
>
> 5. Use this variable in an algorithm (similar to a LUT) to select rgb
> values for a specific color (for example 255, 0, 0 for Red). (Note: I think
> I can handle this part)
>
> 6. Then somehow (setColor(r,g,b)?) insert these selected rgb values into
> the newly created, "empty" 8-bit RGB image at location (0,0)
>
> 7. Repeat this loop until all the pixel locations in the 16-bit Bayer Raw
> image have been used to psuedo-color all the corresponding locations in the
> 8-bit RGB image.
>
> 8. Then save the pseudo-colored 8-bit RGB image as something like,
> BayerColored.Tiff
>
> This approach sort of uses the Bayer Raw file as if it is an array of
> values, but it's actually just a 16-bit image file. It's probably a typical
> novice's, brute force approach that could be more elegantly done by a more
> experienced person, if it can work at all. Hopefully my description conveys
> the concept.
>
> I think I can easily create the "empty" 8-bit RGB file of the correct
> dimensions by just using DCRaw to convert a RAW file from the same camera
> into an ordinary, demosaiced and interpolated RGB file. As preparation I
> might even create a macro to change all the pixels in this empty file to
> black (0,0,0) or some other color by using setColor(r,g,b) so it doesn't
> contain any real image's data.
>
> So, is this approach possible? If so, any clues about how actually do it?
> The part I am not sure about is how to have both images simultaneously open
> and then go back and forth between reading the Bayer Raw image pixel,
> selecting the rgb values with my algorithm, and writing the algorithm result
> to the RGB image.
>
> I look forward to comments and suggestions.
>
> Daddymoen
>
>
>
> --
> View this message in context: http://imagej.1557.n6.nabble.com/Using-setColor-r-g-b-to-pseudocolor-Bayer-Raw-Image-tp5001221p5001235.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html