Hello Sajjadul,

Sajjadul Islam wrote:
> Hello,
> 
> I am trying to generate height map terrain by reading a tga file.

you might want to take a look at the code in Source/Contrib/Terrain (by 
default it is not compiled into the library though - see 
Source/Contrib/README).

> Is there any function within Image class to detect if the image read
> is RGB image or greyscale

Image::getPixelformat() returns the format of the data stored in the 
image (see Source/System/Image/OSGImage.h for possible values). For a 
greyscale image it would be OSG_L_PF, for RGB OSG_RGB_PF and for RGBA 
OSG_RGBA_PF.

> and if it is an RGB is there any functionality
> to convert that to greyscale image?

You can use Image::reformat to convert to a different pixel format; it 
will do a pretty simple conversion, nothing fancy.

        Hope it helps,
                Carsten

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to