This discussion is archived
8 Replies Latest reply: Apr 16, 2013 2:53 PM by 648263 RSS

how to create a grayscale georaster image

648263 Newbie
Currently Being Moderated
Hi,

This is the code that i am using to create a georaster template image.

sdo_geor.createTemplate(idw_img, 21001,
'dimSize=(512,512,3) cellDepth=32BIT_REAL interleaving=BIP ',
null, 'TRUE');

Anyways, the above code works and when i try to export, i can see a rgb image file.

But, i need to create a grayscale image. Can anyone let me know how can i specify and create a grayscale georaster image. Please note that my cell values are decimals type.

Thanks,
Bal
  • 1. Re: how to create a grayscale georaster image
    824871 Newbie
    Currently Being Moderated
    The dimSize shows that you created a 3 bands image.
    That is not a problem as long as you treat each band(layer) individually.
    What is the command you are using to export the image and what is the format you are exporting to?
  • 2. Re: how to create a grayscale georaster image
    648263 Newbie
    Currently Being Moderated
    I am using the following code to export -

    sdo_geor.exportTo(idw_img, NULL, 'tiff', 'file', 'H:/study/courses/research/project/workspace/sql/img1exp');

    I am exporting as a tiff file where the pixel values are decimal point.

    Thanks,
    Balaji
  • 3. Re: how to create a grayscale georaster image
    824871 Newbie
    Currently Being Moderated
    Balaji,

    It seems like you GeoRaster object and your tiff file are perfectly fine according to the way it was created. What happens if you change the "dimSize=(512,512*,3*)" to "dimSize=(512,512*,1*)" in your previous createTemplate call?

    What you are seem is not an RGB image but a composition of 3 bands that looks like RGB. The data type is still 23 bit real as you mentioned. Right?

    How are you visualizing that image? What software?

    Regards,

    Ivan
  • 4. Re: how to create a grayscale georaster image
    648263 Newbie
    Currently Being Moderated
    Yes, i use windows photo viewer/ oracle georaster viewer tool to view images. Also, the image does contain red, blue, green points. So, maybe it is using all the 3 bands. So, how can i use/display only 1 band.

    If i use
    sdo_geor.createTemplate(idw_img, 21001,
    'dimSize=(512,512,1) cellDepth=32BIT_REAL interleaving=BIP',
    null, 'TRUE');

    I get incorrect band/layer numbers error message.



    Thanks,
    Bal
  • 5. Re: how to create a grayscale georaster image
    824871 Newbie
    Currently Being Moderated
    Try that instead:

    sdo_geor.createTemplate(idw_img, *20001*, 'dimSize=(*512,512*) cellDepth=32BIT_REAL interleaving=BIP', null, 'TRUE');
  • 6. Re: how to create a grayscale georaster image
    648263 Newbie
    Currently Being Moderated
    i tried
    sdo_geor.createTemplate(idw_img, 20001, 'dimSize=(512,512) cellDepth=32BIT_REAL interleaving=BIP', null, 'TRUE');

    and i get invalid band and layer number

    sdo_geor.createTemplate(idw_img, 20001, 'dimSize=(*512,512*) cellDepth=32BIT_REAL interleaving=BIP', null, 'TRUE');

    and i get invalid raster spec.

    Thanks,
    Balaji
  • 7. Re: how to create a grayscale georaster image
    824871 Newbie
    Currently Being Moderated
    Balaji,

    In your second command, you copied the "*" from my post. That is not part of the command. It supposed to turn the text into bold. Sorry for the misunderstanding.

    My suggestion was for you to try to work with a single-band image. I don't know what are the other commands you have in your code but are you sure that the error message "invalid band and layer number" is coming from sdo_geor.createTemplate? You might have some code after that is still expecting the 3 bands and that is where the error is coming from.

    So here is the summary:

    If what you want to see is a "grayscale" image and your data type is 32BIT_REAL, there is no need to 3 bands. If you have to have 3 bands. You can use GeoRasterViewer and play with the option "View>Show Layer Mapping" or alt+p to select the band you want to see. If you want to see band 1, select "1" for Red, "1" for Green and "1" for Blue and click on "Refresh".

    Photo viewers can only handle well unsigned 8 bit integer. I suspect. On GeoRasterView you might try the "Image" processing option to find the best representation of the cell values of that image.

    Regards,

    Ivan
  • 8. Re: how to create a grayscale georaster image
    648263 Newbie
    Currently Being Moderated
    Thanks. That worked!!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points