Convert from grayscale 32-bit to RGB 8-bit

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Convert from grayscale 32-bit to RGB 8-bit

stfnix

Is there a way of doing this conversion directly? I was able to do this by first
cvConvertScale'ing to an intermediate 8-bit grayscale and then cvCvtColor'ing to 3 channels.

Can I also do this without the intermediate frame buffer?

Best,

/stefan

Reply | Threaded
Open this post in threaded view
|

Re: Convert from grayscale 32-bit to RGB 8-bit

Mike Sarahan
Using the python openCV interface, I did this by calling cvConvertScale:

cvConvertscale(32bitImage, 8bitimage, 256)

where the 32bit image is the thing I want to convert; the 8 bit
(unsigned int) image is the target/destination image (which might be
what you refer to as a frame buffer), and 256 indicates the scale to
linearly adjust to.  The documentation all shows 1.0 instead of 256 -
this makes a black image for me (or more likely, a binary image that
looks black because it's all 0's and 1's on a scale of 256).

Good luck.
-Mike

On Thu, Jan 15, 2009 at 8:59 AM, stfnix <[hidden email]> wrote:

>
> Is there a way of doing this conversion directly? I was able to do this by
> first
> cvConvertScale'ing to an intermediate 8-bit grayscale and then
> cvCvtColor'ing to 3 channels.
>
> Can I also do this without the intermediate frame buffer?
>
> Best,
>
> /stefan
>
>