User Tools

Site Tools


wiki:pktools_basic

Part 2

  • Introduction to pktools
  • Image filtering
  • Image compositing
  • Information extraction from raster/vector images

Introduction to pktools

Basic concepts and web page

Installation of tools

  • linux_install.pdf
  • installation of pktools

Image filtering

  • smoothing
  • wavelet transform
  • morphological filters

Open the lena image in an image viewer (e.g., openev)

openev -h lena.tif

Try different filtering techniques.

Smoothing filter
pkfilter -i lena.tif -f smooth -o lena_smooth.tif
Sobel edge detection
pkfilter -i lena.tif -f sobelx -o lena_sobelx.tif
pkfilter -i lena.tif -f sobely -o lena_sobely.tif
Discrete wavelet transform

Forward wavelet transform

pkfilter -i lena.tif -f dwt -o lena_dwt.tif -ot Float32

Inverse wavelet transform

pkfilter -i lena_dwt.tif -f dwti -o lena_dwtdwti.tif -ot Byte

Compare both images with an image viewer.

Note on JPG2000 (based on discrete wavelet transform). Check the result on ignoring high frequency content:

Perform the forward discrete wavelet transform

pkfilter -i lena.tif -f dwt -o lena_dwt.tif -ot Float32

Crop the low pass filter result only (in both X and Y):

The image is of size 512×512
Geotransform information is different for projected and not-projected images
projected images: dy is negative!
not-projected images: dy is positive!
pkcrop -i lena_dwt.tif -o lena_ll.tif -ulx 0 -uly 0 -lrx 256 -lry 256

Then set the image extent to the original image, setting all other components to 0:

pkcrop -i lena_ll.tif -o lena_ll.tif -ulx 0 -uly 0 -lrx 512 -lry 512 -nodata 0
Notice input and output are the same (which works due to the line by line operation)

Calculate the inverse discrete wavelet transform on the low pass filter components only:

pkfilter -i lena_ll.tif -o lena_compressed.tif -f dwti -ot Byte

Though we threw away one fourth of the image, the reconstructed image is still looking nice. Zoom in on the hair and check that fine details are missing in the reconstructed image.

Morphological filtering
  • erode
  • dilate
  • close
  • open
  • exercise 6b: Morphological filtering applied to cloud masking

Image mosaicking and compositing

Some definitions first:

Image reprojection

transforms an image from one (source) projection to a new (target) projection.

Image warping

the process of registering an image with a georeferenced grid. The transformation of image coordinates (row and columns) to georeferenced coordinates (X and Y) is based on computing least squares fit polynomials from a provided set of ground control points (GCP).

Image mosaicing

stiches multiple georeferenced input images to a single output image that covers the union bounding boxes of the individual input images.

GDAL utilities gdalwarp and gdal_merge.py can deal with reprojection, warping and mosaicing.

Image compositing

Combining multiple input images that overlap. Pixel values have in overlapping areas need to be resolved to a new value according to some composit rule. Typical rules to compose the new value are: maximum or minimum value and mean or median value.

There is currently no tools in GDAL dealing with image compositing where the user can select its own rules. We will use pkmosaic for this.

Reference for pkmosaic

Examples

Information extraction from raster and vector data

wiki/pktools_basic.txt · Last modified: 2017/12/05 22:53 (external edit)