Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.idl-pvwave

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-15-2010, 12:31 AM
David Grier
Guest
 
Posts: n/a
Default Bayer to RGB conversion

Dear Folks,

Is there a good set of IDL routines for converting Bayer images
to luminance and RGB images? I'm looking for something equivalent
to the Matlab demosaic function, and thought I'd ask before
biting the bullet and coding it myself.

I'm particularly interested in an efficient implementation
of the 5x5 Malvar-He-Cutler interpolation algorithm.

TTFN,

David
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 12-15-2010, 01:44 PM
nata
Guest
 
Posts: n/a
Default Re: Bayer to RGB conversion

I don't exactly know what are you looking for but when I want to
retrieve the RGB values of an image, I use the COLOR_QUAN function.
Cheers,
nata


Reply With Quote
  #3 (permalink)  
Old 12-15-2010, 01:49 PM
David Fanning
Guest
 
Posts: n/a
Default Re: Bayer to RGB conversion

nata writes:

> I don't exactly know what are you looking for but when I want to
> retrieve the RGB values of an image, I use the COLOR_QUAN function.


Oh, dear! Really? :-(

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Reply With Quote
  #4 (permalink)  
Old 12-15-2010, 02:01 PM
nata
Guest
 
Posts: n/a
Default Re: Bayer to RGB conversion

Mmmmhh ! :S ???
Ok, maybe I didn't understand the question. I was just trying to help
him.

nata



Reply With Quote
  #5 (permalink)  
Old 12-15-2010, 02:10 PM
David Fanning
Guest
 
Posts: n/a
Default Re: Bayer to RGB conversion

nata writes:

> Ok, maybe I didn't understand the question.


Well, I didn't understand the question either. :-)

In fact, I was thinking yesterday about how long I would
be able to play competitive tennis, and I came to the
conclusion that it was not that much longer. Not too many
60 year old men beating the kids. At least around here.

So, last night I play with an, uh, older gentleman,
about my age, and we got our butts kicked by a
couple of young guys. Totally intimidating. I feel
like I should be wearing a cup out there!

Then I come home and read this question. I swear I aged
about five years overnight. :-(

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Reply With Quote
  #6 (permalink)  
Old 12-15-2010, 06:25 PM
Karl
Guest
 
Posts: n/a
Default Re: Bayer to RGB conversion

On Dec 15, 8:10*am, David Fanning <n...@dfanning.com> wrote:
> nata writes:
> > Ok, maybe I didn't understand the question.

>
> Well, I didn't understand the question either. :-)
>


Color quantization has nothing to do with it.

Bayer sensors, or more accurately perhaps, sensors that output Bayer-
format images are often found in smartphones as part of their built-in
camera system. The phone probably has a DSP or other specialized
hardware to convert the Bayer image to RGB and then eventually to the
JPEG file or whatever ends up storing your photo.

Wikipedia has a decent article about it, including links to GPL
software that might do the conversion.

I've not looked at the algorithms involved, but if performance is
important, then I'd doubt that coding it in IDL would work well.
Matlab has a built-in function for it and there are GPU
implementations out there. If I could use the GPL code, I'd probably
put it in a DLM and call it from IDL, if it is not already in IDL or
ENVI.

Karl

Reply With Quote
  #7 (permalink)  
Old 12-16-2010, 12:34 AM
David Grier
Guest
 
Posts: n/a
Default Re: Bayer to RGB conversion


On 12/15/10 2:25 PM, Karl wrote:
> On Dec 15, 8:10 am, David Fanning<n...@dfanning.com> wrote:
>> nata writes:
>>> Ok, maybe I didn't understand the question.

>>
>> Well, I didn't understand the question either. :-)
>>

>
> Color quantization has nothing to do with it.
>
> Bayer sensors, or more accurately perhaps, sensors that output Bayer-
> format images are often found in smartphones as part of their built-in
> camera system. The phone probably has a DSP or other specialized
> hardware to convert the Bayer image to RGB and then eventually to the
> JPEG file or whatever ends up storing your photo.
>
> Wikipedia has a decent article about it, including links to GPL
> software that might do the conversion.
>
> I've not looked at the algorithms involved, but if performance is
> important, then I'd doubt that coding it in IDL would work well.
> Matlab has a built-in function for it and there are GPU
> implementations out there. If I could use the GPL code, I'd probably
> put it in a DLM and call it from IDL, if it is not already in IDL or
> ENVI.
>
> Karl
>


I'm using a home-brew dlm to read raw (Bayer-encoded) images from
a Prosilica GigE video camera. This is a reasonably high-end
scientific camera that my group plans to use for holographic
video microscopy. I just finished wrapping an open-source
implementation of the 5x5 Malvar-He-Cutler Bayer conversion
algorithm in a dlm, and am reasonably happy with the result.
I was just hoping for a "pure" IDL implementation.

The most popular conversion algorithms aren't too sophisticated, but
involve some detailed bookkeeping. They'd be a pain to recode.

Mostly, I'm surprised that IDL doesn't support conversions from
this fairly common class of image formats. As Karl mentioned,
Matlab comes with quite sophisticated Bayer conversion algorithms
in the demosaic.m package. Matlab also has read/write support for
all sorts of video formats. Python has all this (and more) through its
opencv bindings.

Sometimes IDL starts to feel a little old and creaky.

TTFN,

David


Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 12:27 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.