Getting RGB values of a MrSID image at a given scale

For discussion of LizardTech's free Decode SDK for MrSID and JPEG 2000.

Moderator: jskiffington

Getting RGB values of a MrSID image at a given scale

Postby jeffastorey » Sun Jan 09, 2011 7:42 pm

Hi, I'm trying to get the RGB values of a given region of a MRS image at a particular scale, and I'm running into some problems. Here's what I have so far

Code: Select all
MrSIDImageReader *reader = MrSIDImageReader::create();
reader->initialize(fileSpec);
LTINavigator nav(*reader);
// I do some computations here to get the bounds and the scale
nav.setSceneAsGeoULLR(ulx, uly, lrx, lry, scale);
LTIScene scene = nav.getScene();


How do I go about getting the RGB values for just the pixels in the given region at the scale I have set?

I tried the following (which I got from a the post h_t_t_p://w_w_w.lizardtech.org/forums/viewto ... d0b4df03f3):

Code: Select all
unsigned red, green, blue;
int count = 0;
for (unsigned int pixelY = 0; pixelY < h; pixelY++)
{
    for (unsigned int pixelX = 0; pixelX < w; pixelX++)
    {
    red = static_cast<lt_uint8*>   (bufData.getWindowBandData(0))[count];
    green = static_cast<lt_uint8*>(bufData.getWindowBandData(1))[count];
    blue = static_cast<lt_uint8*>(bufData.getWindowBandData(2))[count];
    count++;
    printf("r=%d,g=%d,b=%d",(unsigned char)red, (unsigned char)green, (unsigned char)blue);
  }
}


But this results in a bunch of values of r=205,g=205,b=205 (which is not my image). Any thoughts as to what I am doing wrong or if there is a better way to go about this?

thanks,
Jeff
jeffastorey
 
Posts: 1
Joined: Sun Jan 09, 2011 7:23 pm

Return to SDKs

Who is online

Users browsing this forum: No registered users and 3 guests

cron