PDL::Image2D - Miscellaneous 2D image processing functions
Miscellaneous 2D image processing functions - for want of anywhere else to put them
use PDL::Image2D;
Signature: (a(m,n); kern(p,q); [o]b(m,n); int opt)
2D convolution of an array with a kernel (smoothing)
$new = conv2d $old, $kernel, {OPTIONS}
perldl> $smoothed = conv2d $image, ones(3,3), {Boundary => Reflect}
Boundary - controls what values are assumed for the image when kernel crosses its edge: => Default - periodic boundary conditions (i.e. wrap around axis) => Reflect - reflect at boundary => Truncate - truncate at boundary
Signature: (a(m,n); kern(p,q); [o]b(m,n); int opt)
2D median-convolution of an array with a kernel (smoothing)
Note: only points in the kernel >0 are included in the median, other points are weighted by the kernel value (medianing lots of zeroes is rather pointless)
$new = med2d $old, $kernel, {OPTIONS}
perldl> $smoothed = med2d $image, ones(3,3), {Boundary => Reflect}
Boundary - controls what values are assumed for the image when kernel crosses its edge: => Default - periodic boundary conditions (i.e. wrap around axis) => Reflect - reflect at boundary => Truncate - truncate at boundary
Signature: (a(m,n); int bad(m,n); [o]b(m,n))
patch bad pixels out of 2D images,
$patched
= patch2d $data, $bad;
$bad
is a 2D mask array where 1=bad pixel 0=good pixel. Pixels
are replaced by the average of their non-bad neighbours.
Signature: (a(m,n); [o]b(); int [o]c(); int[o]d())
Return value/position of maximum value in 2D image
Contributed by Tim Jeness
Signature: (im(m,n); x(); y(); box(); [o]xcen(); [o]ycen())
Refine a list of object positions in 2D image by centroiding in a box
$box
is the full-width of the box, i.e. the window is +/-
$box/2
Signature: (a(m,n); [o]b(m,n))
Connected 8-component labeling of a binary image.
Connected 8-component labeling of 0,1 image - i.e. find seperate segmented objects and fill object pixels with object number
perldl> $segmented
=
cc8compt($image>$threshold);
Copyright (C) Karl Glazebrook 1997 with additions by Robin Williams (rjrw@ast.leeds.ac.uk) and Tim Jeness (timj@jach.hawaii.edu) All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file.