6.8 Image Filtering

Image filtering is the process of applying a convolution filter on an image to achieve a specific purpose. For example, applying a low-pass filter on an image can smooth and reduce noise in an image, while applying a high-pass filter on an image can enhance the details of the image or even detect the edges inside the image.

The SDO_GEOR_IP.filter procedure provides standard filters such as low-pass filter (LPF), high-pass filter (HPF), and high-boost filter (HBF). It also allows you to apply customized filters on images.

The following example performs image filtering by providing a customized 3-by-3 Laplacian filter on the image for edge detection.

DECLARE
  gr1 sdo_georaster;
  gr2 sdo_georaster;
  cropArea sdo_geometry;
BEGIN
  INSERT INTO georaster_table (georid, georaster)
    VALUES (41, sdo_geor.init('RDT_1'))
    RETURNING georaster INTO gr2;

  SELECT georaster INTO gr1 FROM georaster_table WHERE georid=4;

  sdo_geor_ip.filter(gr1, 0, cropArea, null, ‘filtertype=CUSTOM, kernelsize=(3,3)’, sdo_number_array(0, 1, 0, 1, -4, 1, 0, 1, 0 ), null, gr2);
  UPDATE georaster_table SET georaster=gr2 WHERE georid=41;
  COMMIT;
END;
/