13.14 SDO_GEOR_UTL.generateGrayRamp

Format

SDO_GEOR_UTL.generateGrayRamp(
     graySeeds      IN SDO_GEOR_GRAYSCALE, 
     rampSteps      IN SDO_NUMBER_ARRAY, 
     cellValueType  IN VARCHAR2 DEFAULT 'integer', 
     interpoParam   IN VARCHAR2 DEFAULT 'method=linear' 
     ) RETURN SDO_GEOR_GRAYSCALE;

Description

Generates an SDO_GEOR_GRAYSCALE object with a grayscale ramp (gradient) by interpolating the values entered as seed.

Parameters

graySeeds

An SDO_GEOR_GRAYSCALE object with the seed values to be used as the beginning and end values for the interpolation. Should contain at least two pixel-value/gray-value pairs.

rampSteps

An array where each item indicates how many interpolated values will be generated for each section of the gray ramp. Should contain at least one integer value indicating how many values will be generated for each section of the gray ramp.

cellValueType

A string indicating whether the cell values should be creates as integer or real values. The possible values for this parameter are integer (the default) or real.

interpoParam

A string specifying the interpolation method. The possible values are method=linear (the default) and method=cosine.

Usage Notes

This function returns an object of type SDO_GEOR_GRAYSCALE, which is described in SDO_GEOR_GRAYSCALE Object Type.

A gray ramp can have several different sections with different lengths for each section. If graySeeds specifies three values, the function will generate two sections on the same gray ramp. The number of gray levels for each section is controlled by rampSteps array. The total number of the generated grayscale is the sum of the values in the rampSteps array and the number of values in the graySeeds. To generate independent sections, insert a new item in the graySeeds parameter, and a new item in rampSteps. (Any value of 0 in rampSteps indicates that no interpolated values are needed to generate in that section.)

Examples

The following example generates and applies a gray ramp containing 102 grayscales interpolated linearly from 0 to 255. (It assumes the existence of a table named RAMP_TEST containing at least columns named ID and RASTER.)

DECLARE
  gr sdo_georaster;
  gs sdo_geor_grayscale;
BEGIN
  select raster into gr from ramp_test where id = 3 for update;

  gs := sdo_geor_utl.generateGrayRamp( 
           graySeeds  => sdo_geor_grayscale(
             sdo_number_array( 0, 1000),
             sdo_number_array( 0,  255)),
           rampSteps  => sdo_number_array( 100 ),
           cellValueType => 'integer',
           interpoParam  => 'method=linear' );

  sdo_geor.setGrayScale( gr, 0, gs );

  update ramp_test set raster = gr where id = 3;
  commit;
END;

The following example generates and applies a gray ramp of 203 grayscale values, with 100 interpolated values between -100 and 0 and 100 interpolated values between 0 and 1000. (It assumes the existence of a table named RAMP_TEST containing at least columns named ID and RASTER.).

DECLARE
  gr sdo_georaster;
  gs sdo_geor_grayscale;
BEGIN
  select raster into gr from ramp_test where id = 3 for update;

  gs := sdo_geor_utl.generateGrayRamp( 
           graySeeds  => sdo_geor_grayscale(
             sdo_number_array( -100, 0, 1000),
             sdo_number_array(  255, 0,  255)),
           rampSteps  => sdo_number_array( 100, 100 ),
           cellValueType => 'real',
           interpoParam  => 'method=linear' );

  sdo_geor.setGrayScale( gr, 0, gs );

  update ramp_test set raster = gr where id = 3;
  commit;
END;

The following example generates a gray ramp of 204 grayscale values, with 100 interpolated values between -100 and 0 and 100 interpolated values between 100 and 1000. (It assumes the existence of a table named RAMP_TEST containing at least columns named ID and RASTER.)

DECLARE
  gr sdo_georaster;
  gs sdo_geor_grayscale;
BEGIN
  select raster into gr from ramp_test where id = 3 for update;

  gs := sdo_geor_utl.generateGrayRamp( 
           graySeeds  => sdo_geor_grayscale(
             sdo_number_array( -100,  0, 100, 1000),
             sdo_number_array(    0, 10, 100,  200)),
           rampSteps  => sdo_number_array( 100, 0, 100 ),
           cellValueType => 'real',
           interpoParam  => 'method=linear' );

  sdo_geor.setGrayScale( gr, 0, gs );

  update ramp_test set raster = gr where id = 3;
  commit;
END;

The value of 0 in the rampSteps array (rampSteps => sdo_number_array( 100, 0, 100 );) indicates that no interpolated values are needed for generation in the second section.