|
|
The toolbox can be roughly split into 5 categories - file
operations, polarimetric theory, statistical
simulation, image & signal processing
and detection theory. Each command has a
help header that can be read in Matlab using help
command or by running the mex file without any
arguments. The source is usually well commented so you are encouraged
to check what
it does - occasionally there are additional inputs/outputs that work
but have not been well tested. Some files have been prefixed by RT_
to prevent
name clashes with other Matlab toolboxes.
Cross referenced help is also available here
File Operations
The trouble with having standards is that there are so many to
choose from... data from each radar has its own peculiar format and it
is usually
better to convert it to a raw binary for import into Matlab via fread
However, for NASA/JPL AirSAR
both the format and data is well specified and publicly available from
the web site. Extremely high quality data is freely available and distributable
(given acknowledgement) which means it is well worth using the compressed
AirSAR format natively.
openairsar.m
|
| [data,structure]
= openairsar(filedir,filecode,frequency,start_line,load_lines) |
Known Problems: Same as openairsar_new.m except this
does not require the auxiliary hd####.log and
.radvec files - the
binary cm####_?.dat file
is read directly. Structure titles may be slightly different depending
on the AirSAR file e.g. (New Format) structure.AZIMUTH_PIXEL_SPACING__METERS_ and
(Old Format) structure.AZIMUTH_PIXEL_SPACING___METERS__ (2 additional _ ). Only
tested with quad polarimetry files.
|
Demo: segmentation_demo.m |
Reads, decompresses data, interprets the header
and (if available) reads the radiation vector for AirSAR data.
Files are assumed to lie in the (string) directory filedir and
be of the form cm####_?.dat.
The (string or number) filecode defines #### and ? is
the (string) frequency chosen
from C, L or P.
The data is decompressed from the Stoke's matrices into covariance
matrix components: real data.hhhh, data.hvhv, data.vvvv and
complex data.hhhv, data.hvvv and data.hhvv each
as a matrix of [range_samples,
time_lines].
For New Format data, the header file is interpreted as a Matlab data
structure with AirSAR fields by converting all 'illegal' characters
(!@#$%^&*()+-{}[]:";''<>?/.,|\`~ )
into the underscore character _ This
means information such as structure.NUMBER_OF_LINES_IN_IMAGE is
easily available.
For Old Format data, part of the header file is stored as a text block
in structure.OLD_HEADER. This may contain garbage at the end because
I don't
have the specs on this
format.
The optional radiation correction vector is only present for
some datasets and is returned as a [range_samples,1] size radvec.hh , radvec.hv and radvec.vv when
requested.
|
Source: Airsar Integrated Processor Documentation
(Data Formats)
`Understanding Synthetic Aperture Radar Images' by C. Oliver and S. Quegan,
1998
Direct evaluation in Mathematica - compressed_stokes_simple.nb
|
openairsar_new.m |
| [data,structure,{radvec}]
= openairsar_new(filedir,filecode,frequency,start_line,load_lines) |
| Known Problems: Won't work on old data, requires hd####.log
files to be present. Memory intensive. Will fail if the format or
filenames change. Case sensitive
so may
fail
when
transferring
data through a Windows system. P polarisation can have two files,
RF filtered or unfiltered, currently the filtered file is read -
source
code is easily changed. Slightly lossy compression means that the
derived covariance matrices are not strictly positive definite - posdef_swap.m is
required. Only
tested with quad polarimetry files. |
Demo: segmentation_demo.m |
Reads, decompresses data, interprets the header
and (if available) reads the radiation vector for AirSAR data.
Files are assumed to lie in the (string) directory filedir
and be of the form cm####_?.dat,
hd####.log and
cm####_?.rad_vec
respectively. The (string or number) filecode
defines #### and
? is the (string)
frequency chosen
from C, L
or P.
The data is decompressed from the Stoke's matrices into covariance
matrix components: real data.hhhh,
data.hvhv, data.vvvv
and complex data.hhhv,
data.hvvv and data.hhvv
each as a matrix of [range_samples,
time_lines].
The header file is interpreted as a Matlab data structure with
AirSAR fields by converting all 'illegal' characters (!@#$%^&*()+-{}[]:";''<>?/.,|\`~
) into the underscore character _
This means information such as structure.NUMBER_OF_LINES_IN_IMAGE
is easily available.
The optional radiation correction vector is only present for
some datasets and is returned as a [range_samples,1]
size radvec.hh
, radvec.hv and
radvec.vv when
requested.
|
Source: Airsar Integrated Processor Documentation
(Data Formats)
`Understanding Synthetic Aperture Radar Images' by
C. Oliver and S. Quegan,
1998
Direct evaluation in Mathematica - compressed_stokes_simple.nb |
posdef_swap.m |
| corrected =
posdef_swap(data,swapdist,{irange},{jrange} |
| Known Problems: Will fail if the selected data contains
'borders' as these are usually zero value. May fail if unacceptable
values are found in edge and corner cases. |
Demo: segmentation_demo.m |
Due to slightly lossy compression in AirSAR data,
the derived covariance matrix is not necessarily positive definite.
This causes major problems in the C code for classification and
segmentation (det is negative, square root gives complex numbers...).
This routine returns a corrected corrected data
structure ( .hhhh .hvhv
.vvvv .hhhv .hvvv , .hhvv) given a similar input such as
from openairsar.m
. Neighbour swapping is performed with the data up to swapdist
away. The data is optionally cut to the desired size by an input
such as irange=[200:400]
jrange=[300:400].
|
Source: see www.mathworld.com for the conditions
of positive definite matrices. |
Polarimetric Theory
These routines are based on my own work, papers from IEEE International
Journal of Remote Sensing and IEE Radar, Sonar and Navigation.
coherence_distribution.m |
| P = coherence_distribution(caxis,rho,looks) |
| Known Problems: None |
Demo: polarisation_demo.m |
Returns the coherence (sometimes termed
correlation) probability distribution function between a pair of
channels given the complex correlation coefficient rho.
Applicable to both polarimetric and interferometric radar if the
underlying statistics are assumed to conform to a Complex Wishart
distribution. Only the magnitude of rho
is used. |
| Source:
`Understanding Synthetic Aperture Radar Images' by
C. Oliver and S. Quegan,
1998 |
intensity_distribution.m |
| P = intensity_distribution(iaxis,looks) |
| Known Problems: None |
Demo: None |
| Returns the intensity probability distribution function
of a single channel. Applicable to all radar models if many scatterers
are assumed to contribute within a single range/imaging cell. The
Gaussian central limit theorem then predicts a Gamma(looks) distribution
in intensity, which for a single look reduces to the exponential distribution. |
| Source: `Understanding Synthetic Aperture Radar Images'
by C. Oliver and S. Quegan,
1998 |
multiple_polsep.m |
| S = multiple_polsep(ex,ey,ez,looks) |
| Known Problems: Numerical integration unstable in extreme cases.
Attempts 10e-6 accuracy goal. |
Demo: separation_demo.m |
| Returns a measure of separation between two arbitrary
classes for an arbitrary number of looks,
given the eigenvalues of the class covariance ratio (eig(C1
* inv(C2))). This is equivalent to 1-Bayes error when a
maximum likelihood classifier is used. Especially applicable to
polarimetric
radar when the covariance matrices are known, this function can be
used to determine the most valuable channels/polarisations. For polarimetric
radar, this assumes the underlying statistics conform to a Complex
Wishart distribution but it describes the general case of up to 3
independent (zero correlation) channels with class intensity ratios
ex,ey,ez
each forming a multivariate Gamma distribution. |
| Source: `Polarimetric Classification using Expectation Methods', G Davidson et al. |
phase_distribution.m |
| P = phase_distribution(paxis,rho) |
| Known Problems: Overflow has been minimised by using log gamma functions. |
Demo: polarisation_demo.m |
Returns the phase-difference probability distribution
function between a pair of channels given the complex correlation
coefficient rho.
Applicable to both polarimetric and interferometric radar if the
underlying statistics are assumed to conform to a Complex Wishart
distribution. In general the phase of a single scattered wave has
a uniform distribution which provides no useful information. When
two channels are present, dependent on the correlation rho,
the phase difference between the channels can provide additional
classification power (polarimetric) or an interferometry map. |
| Source: `Understanding Synthetic Aperture Radar Images'
by C. Oliver and S. Quegan,
1998 |
single_polsep.m |
| S = single_polsep(ex,ey,ez) |
| Known Problems: None |
Demo: segmentation_demo.m |
| As multiple_polsep
but the single look case has a simple closed form. Returns a measure
of separation between two arbitrary classes for a single look, given
the eigenvalues of the class covariance ratio eig(C1
* inv(C2)). This is equivalent to 1-Bayes error when a maximum
likelihood classifier is used. Especially applicable to polarimetric
radar when the covariance matrices are known, this function can be
used to determine the most valuable channels/polarisations. For polarimetric
radar, this assumes the underlying statistics conform to a Complex
Wishart distribution but it describes the general case of up to 3
independent (zero correlation) channels with class intensity ratios
ex,ey,ez
each forming a multivariate Exponential distribution. |
| Source: `Single Look Classification Accuracy for Polarimetric SAR', G Davidson et al., `Polarimetric Classification using Expectation Methods', G Davidson et al.
and Mathematica notebook single_polsep.nb |
Statistical Simulation
Simulation is always useful to test processing methods with perfectly
sampled data. Although Matlab has a fast implemented random number generator
for uniform and normally distributed (Gaussian)
statistics, it lacks generators for other common distributions. Although
an official statistics toolbox is available, it's largely inapplicable
to radar and the useful distributions are implemented as .m
files which are often too slow.
Unless stated, all functions assume that measurements are made
in intensity, usually referred to as x,
(never use i, j, I or J in Matlab as this is complex notation).
This section includes MEX interfaces to the well known public domain C
library dcdflib which is
at least an order of magnitude faster than the native routines. This code
is by Barry W. Brown, James Lovato, Kathy Russell, John Venier at the
University of Texas (see http://utmdacc.mdacc.tmc.edu/
and http://odin.mdacc.tmc.edu/
). The original documentation is included in the toolbox download.
cov_channels.m |
| S = cov_channels(N,rho) |
| Known Problems: The definition of covariance between A and B is
the Matlab <A' *B>, some radar texts use the conjugate <A
* B'>. Fairly slow as it is not vectorised. |
Demo: polarisation_demo.m |
Generates N samples from channels with normalised
correlated complex Gaussian noise of arbitrary correlation, covariance
matrix rho. If rho is a scalar then two channels are output with
correlation rho, apart from this corrcoef(S)
should match rho. The covariance matrix input should be hermitian
positive definite. |
| Source: Cholesky factorisation - see www.mathworld.com |
cov_matrices.m |
| S = cov_matrices(N,rho,L) |
| Known Problems: For low L, and particular rho a proportion of the
output will be slightly non-positive definite. This appears to be
because of finite precision problems and that Matlab does not have
specific commands for handling symmetric matrices. |
Demo: polarisation_demo.m |
Where rho is a p x p covariance matrix, this outputs
p x p x N sample covariance matrices drawn from the Wishart distribution
for L looks. This is the general form of polarimetric and interferometric
radar statistics. If rho is a scalar then 2x2 matrices are output
as for a correlation co-efficient to exist there must be at least
two channels, apart from this mean(S,3)
should match rho. The covariance matrix input should be hermitian
positive definite. Note the determinant of single look samples should
equal zero, but this means they are not strictly positive-definite.
See cwishart_variates.m
for an alternative method. |
| Source: Brute force evaluation using cov_channels.m |
cwishart_variate.sm (not recommended - use cov_matrices.m) |
| [S,d] = cwishart_variates(rho,L,N) |
| Known Problems: For low L, and particular rho a significant proportion
of the output will be slightly non-positive definite. This appears
to be because of finite precision problems and vectorisation, also
that Matlab does not have specific commands for handling symmetric
matrices. |
Demo: None |
This is an attempt at an order N method
for generating N sample
covariance matrices from the complex Wishart distribution.
For low L looks
it appears to be too sensitive to precision and too many outputs
are
not positive-definite.
Note the determinant of single
look samples should equal zero, but this means they are not strictly
positive-definite. See the source code for more information.
See cov_matrices.m
for a more robust order N X L method. |
| Source: Brute force evaluation using cov_channels.m |
RT_cdf.c |
| [P,{Q},{status},{bound}]
= RT_cdf(cdftype,param1,param2...) |
| Known Problems: None |
Demo: statistics_demo.m |
P is
the integral from 0 to param1 of
distribution cdftype -
see dcdflib.fdoc for usage. Q is
(1-P) which maintains
full double precision when P approaches
1. cdftype = [1..12]
as beta(1), binomial(2), chisquare(3), non-central chisquare(4),
F(5),
non-central F(6), gamma(7), negative binomial(8), normal(9), poisson(10),
student T(11), non-central student T(12). Use RT_cdf(cdftype) to
display required parameters. |
| Source: see http://utmdacc.mdacc.tmc.edu/
and http://odin.mdacc.tmc.edu/ |
RT_expcdf.m |
| C = RT_expcdf(x,mu) |
| Known Problems: None |
Demo: statistics_demo.m |
Returns the cumulative distribution function for
the exponential distribution , i.e. C=Integral_0^x[P(x|mu)dx].
This is applicable to the intensity distribution of single look
speckle with a mean of mu
. Both x and mu
can be matrices with compatible sizes. |
| Source: www.mathworld.com |
RT_expinv.m |
| X = RT_expinv(P,mu) |
| Known Problems: Although Floating Point can represent small values
close to zero (i.e. realmin),
the closest value to 1 is 1-eps.
Use RT_gaminv with a shape=1 when this is a problem. |
Demo: statistics_demo.m |
Returns the inverse cumulative distribution function
for the exponential distribution , i.e. Integral_0^x[P(x|mu)dx]=P
limited to input 0<P<1. This is applicable to the intensity
distribution of single look speckle with a mean of mu
. Both x and mu
can be matrices with compatible sizes. |
| Source: www.mathworld.com |
RT_exppdf.m |
| P = RT_exppdf(x,mu) |
| Known Problems: None |
Demo: statistics_demo.m |
Returns the probability distribution function for
the exponential distribution , i.e. P(x|mu)dx.
This is applicable to the intensity distribution of single look
speckle with a mean of mu
. Both x and mu
can be matrices with compatible sizes. |
| Source: www.mathworld.com |
RT_exprnd.m |
| S = RT_exprnd(mu,{rows},{cols}) |
| Known Problems: None |
Demo: statistics_demo.m |
Given scalar parameter mu,
this routine returns a matrix of exponential variates of size [rows,cols].
This is applicable to the intensity distribution of single look
speckle with a global mean of mu.
Alternatively a speckle matrix with a varying underlying mean can
be generated by passing this as the matrix mu
and omitting rows
and cols. |
| Source: `Non-Uniform Random Variate Generation'
by L. Devroye, Springer-Verlag, 1986. |
RT_gamcdf.m |
| [P,{Q}] = RT_gamcdf(x,mu,shape) |
| Known Problems: None |
Demo: statistics_demo.m |
Returns the cumulative distribution function for
the gamma distribution as P. The complementary cumulative distribution
is returned as Q, but calculated separately. Q is (1-P) which maintains
full double precision when P approaches 1. shape can be non-integer,
but integer values correspond to multi-look speckle. |
| Source: www.mathworld.com |
RT_gaminv.m |
| X = RT_gaminv(P,mu,shape,{Q}
) |
| Known Problems: When Q is not passed, for P the closest value to
unity is 1-eps. Pass
complement Q when this is a problem. |
Demo: statistics_demo.m |
Returns the inverse cumulative distribution function
for the gamma distribution. shape can be non-integer, but integer
values correspond to multi-look speckle. 0 < p < 1.
Input the complementary value Q if p > (1-eps) such that
P + Q = 1. |
| Source: www.mathworld.com
, uses RT_invcdf.m |
RT_gampdf.m |
| P = RT_gampdf(x,mu,shape) |
| Known Problems: None |
Demo: statistics_demo.m |
Returns the probability distribution function for
the gamma distribution. shape can be non-integer, but integer values
correspond to multi-look speckle. |
| Source: www.mathworld.com |
RT_gamrnd.m |
| S = RT_gamrnd(mu,shape,{rows},{cols}) |
| Known Problems: Slow |
Demo: statistics_demo.m |
Returns a matrix of gamma variates of size [rows,cols].
shape can be non-integer, but integer values correspond to multi-look
speckle. |
| Source: Direct inverse of the cumulative distribution
function via RT_invcdf.m |
RT_invcdf.c |
| [X,{status},{bound}]
= RT_invcdf(cdftype,P,Q,param1,param2...) |
| Known Problems: None |
Demo: statistics_demo.m |
X is returned so that the integral from 0 to X of
distribution cdftype gives P, where Q = (1-P). See dcdflib.fdoc
for usage. cdftype = [1..12] as beta(1), binomial(2), chisquare(3),
non-central chisquare(4), F(5), non-central F(6), gamma(7), negative
binomial(8), normal(9), poisson(10), student T(11), non-central
student T(12). Use RT_invcdf(cdftype) to
display required parameters. |
| Source: see http://utmdacc.mdacc.tmc.edu/
and http://odin.mdacc.tmc.edu/ |
RT_Kcdf.m |
| [P,{UERR}] =
RT_Kcdf(x,nu,mu,{noflag}) |
| Known Problems: None |
Demo: statistics_demo.m |
Returns the cumulative probability distribution
function for the K distribution of mean mu.
The distribution approaches the exponential
distribution as the shape parameter nu goes
to infinity. Returns UERR when the besselk
function has problems, pass noflag!=0
to suppress this. |
| Source: Direct Evaluation. |
RT_Kcdf_noise.m
|
| [P,{Q}]
= RT_Kcdf_noise(x,nu,mu,rho,{tol}) |
| Known Problems: Slow, transform used to remove singularity is not
optimised for convergence. |
Demo: k_noise_demo.m |
Returns the cumulative probability distribution
function for the K distribution of mean mu in
the presence of thermal noise of variance rho. The
overall mean is (mu + rho).
The distribution approaches the exponential distribution as the
shape parameter nu goes
to infinity or if rho>>mu.
Attempts to achieve an absolute accuracy of tol (default
sqrt(eps)) , and will produce a warning if the relative accuracy
is less than 0.1%. Some effort was required to get this numerically
stable
and it may fail for extreme nu values
- manually use the limiting distribution when this is the case.
For reasonable
nu, the limiting
distribution is returned based on the Clutter(mu)
to Noise(rho) Ratio.
CNR>+30dB implies pure K-distribution, and CNR<-30dB implies exponential
distribution.
|
| Source: Direct Evaluation of a partial
Mathematica solution using a single numerical integration. |
RT_Kpdf.m |
| [P,{UERR}]
= RT_Kpdf(x,nu,mu,{noflag}) |
| Known Problems: BesselK function can have problems at extreme values. |
Demo: statistics_demo.m |
Returns the probability distribution function for
the K distribution of mean mu. The distribution approaches the
exponential
distribution as the shape parameter nu goes to infinity. Returns
UERR when the besselk
function has problems, pass noflag!=0 to suppress this. |
| Source: `A model for non-Rayleigh sea echo', E. Jakeman
and P.N. Pusey, IEEE Trans., 1976, AP-24, pp 806-814 |
RT_Kpdf_noise.m
|
| P = RT_Kpdf_noise(x,nu,mu,rho,{tol}) |
| Known Problems: Slow, transform used to remove singularity is not
optimised for convergence. |
Demo: k_noise_demo.m |
Returns the probability distribution
function for the K distribution of mean mu in
the presence of thermal noise of variance rho.
The overall mean is (mu
+ rho). The distribution approaches the exponential distribution
as the shape parameter nu goes
to infinity or if rho>>mu.
Attempts to achieve an absolute accuracy of tol (default sqrt(eps))
, and will produce a warning if the relative accuracy is less than
0.1%. Some effort was required to get this numerically stable and
it may fail for extreme nu values
- manually use the limiting distribution when this is the case.
For reasonable nu,
the limiting distribution is returned based on the Clutter(mu)
to Noise(rho) Ratio.
CNR>+30dB implies pure K-distribution, and CNR<-30dB implies
exponential distribution.
|
| Source: Direct Evaluation using a single
numerical integration. |
RT_Krnd.m |
| S = RT_Krnd(nu,mu,{rows},{cols}) |
| Known Problems: Slow (via RT_gamrnd.m) |
Demo: statistics_demo.m |
Returns a matrix of K variates of size [rows,cols].
S has an expected mean of mu and a shape parameter of nu. The
compound K formulation is used but Independent Identically Distributed
variates are returned. |
| Source: `Compound representation of high resolution
sea clutter', K.D. Ward, Electronics Letters, 1981, 17(16), pp561-563 |
RT_Krnd_noise.m
|
| S=RT_Krnd_noise(nu,mu,rho,rows,cols) |
| Known Problems: Slow (via RT_gamrnd) |
Demo: k_noise_demo.m , k_detection_demo |
Returns a matrix of K variates in the presence of
thermal noise of size [rows,cols].
S has an expected mean of (mu + rho) and a (noise contaminated)
shape parameter of nu. The variance of the zero mean Gaussian noise
is
rho. The compound K formulation is used but Independent Identically
Distributed
variates
are returned.
|
| Source: Direct evaluation. |
RT_weibcdf.m
|
| [P,{Q}] = RT_weibcdf(x,a,mu) |
| Known Problems: If a<<0.1 this can lose accuracy or fail - this
value should never arise in practice. |
Demo: statistics_demo.m |
Returns the cumulative distribution function for
the Weibull distribution as P. The form used is such that the mean
value is mu and
larger a is closer
to a Gaussian distribution. a = 1 is equivalent to an exponential
distribution. The complementary
cumulative distribution is returned as Q, but calculated separately.
Q is (1-P) which maintains
full double precision when P approaches 1.
|
| Source: Direct evaluation via rescaled
exponential |
RT_weibest.m
|
| [a,mu] = RT_weibest(x,{fast}) |
| Known Problems: Numerical search for MLE can be slow. |
Demo: weibull_demo.m |
Estimates the parameters a and mu of
a Weibull distribution that best fits the data in X.
The form used is such that the mean
value is mu and
larger a is closer
to a Gaussian distribution. a =
1 is equivalent to an exponential distribution. The
method uses an initial least squares fit to Weibull paper. It is
not the Maximum Likelihood Solution, but a is
reasonably accurate (mu is quite poor). To return this estimate,
set the
fast flag. With fast unset
or 0, a numerical MLE solution is generated (slow) but this can
fail when a is too
small (a << 0.1).
|
| Source: Direct evaluation from least squares
fit, initialising a numerical MLE search. |
RT_weibinv.m
|
| X = RT_weibinv(P,a,mu,{Q}
) |
| Known Problems: If a<<0.1 this can lose accuracy or fail
- this value should never arise in practice. When
Q is not passed, for P the closest value to unity is 1-eps. Pass
complement Q when this is a problem. |
Demo: statistics_demo.m |
Returns the inverse cumulative distribution function
for the Weibull distribution. The form used is such that the
mean value is mu and
larger a is closer
to a Gaussian distribution. a =
1 is equivalent to an exponential distribution. 0 < P < 1.
Input the complementary value Q if P> (1-eps) such that P +
Q = 1.
|
| Source: Direct evaluation via rescaled exponential |
RT_weibpdf.m
|
| P = RT_weibpdf(x,a,mu) |
| Known Problems: If a<<0.1 this can lose accuracy or fail
- this value should never arise in practice. |
Demo: statistics_demo.m |
Returns the probability distribution function for
the Weibull distribution. The form used is such that the mean
value is mu and
larger a is closer
to a Gaussian distribution. a =
1 is equivalent to an exponential distribution.
|
| Source: Direct evaluation via rescaled exponential |
RT_weibrnd.m
|
| S = RT_weibrnd(a,mu,{rows},{cols}) |
| Known Problems: If a<<0.1 this can lose accuracy
or fail - this value should never arise in practice. |
Demo: statistics_demo.m |
Returns a matrix of Weibull variates of size [rows,cols].
The form used is such that the mean
value is mu and
larger a is closer
to a Gaussian distribution. a =
1 is equivalent to an exponential distribution.
|
| Source: Well known result from a power transform of
an exponential |
Image & Signal Processing
cgamgen.m
|
| nn = cgamgen(Rg,shape) |
| Known Problems: Only valid for shape < 25 - but you shouldn't
be using this anyway for that shape. |
Demo: correlation_demo.m |
Returns the mapping of a correlation Rg under
an MNLT for a measured gamma correlation. When a correlated Gaussian
is directly mapped to a gamma distribution using a Memoryless Non-Linear
Transform (MNLT) the correlation structure is not preserved. It
has been shown by Tough and Ward (see below) how to correctly obtain
the desired correlation structure while maintaining the distribution.
The demo shows how to invert this to obtain a general gamma shape distribution with a desired correlation structure. Many additional
functions
are associated with this command.
|
| Source: `The correlation
properties of gamma and other non-Gaussian processes generated by
memoryless nonlinear transformation', R. J. A. Tough and K. D. Ward,
J. Physics D: Applied Physics, vol. 32, pp. 3075-3084, Dec. 1999 |
covfullint.c
|
| [mu, weights,
labels] = COVFULLINT(HHHH, HVHV, VVVV, HHHV, HVVV, HHVV, population,
Nclasses, looks, tol ] |
| Known Problems: Can fail for too many classes or not enough data |
Demo: segmentation_demo.m |
Fully polarimetric, multifrequency classification
algorithm based on expectation maximisation of the covariance matrices.
The polarisation inputs (HHHH etc.)
are vectors of image segments size [Ndata, Nfreq] this requires
use of the utility reclassrho.c to
subsequently map to the original image. Note that the weights are
output based on the number of segments, i.e. they are not weighted
wrt segment population. The initialisation is based on a dB K-means
search over the first frequency. A maximum of seven classes is
recommended although 9 may be selected. If Ndata <= 10*Nclasses the initialisation algorithm usually cannot proceed.
|
| Source: Theory explained in `Polarimetric Classification using Expectation Methods', G Davidson et al..
This is a very complicated routine. An undocumented Bayesian input
is also possible - see the source code. |
nleU.m |
| U = nleU(data) |
| Known Problems: An alternate parameter measure is [z log(z)]. See
the references beside k_demo. |
Demo: k_demo.m |
Returns the normalised log estimate U of the data,
a reasonable parameter estimate for long-tailed distributions.
For
an image pass data(:) otherwise
it will process column-wise. |
| Source: See file for references |
nleU2nu.m
|
| nu = nleU2nu(U) |
| Known Problems: Can fail for extreme values |
Demo: k_demo.m |
Converts the U estimate to the K distribution parameter
nu. Inverts U=log(nu) -
psi(nu) - psi(1) by an iterative scheme.
Does not use a numerical search so it's very fast.
|
| Source: See file for references |
nu2nleU.m |
| U = nu2nleU(nu) |
| Known Problems: Requires recent version of Matlab with psi.m
or an equivalent digamma function. |
Demo: k_demo.m |
Converts the K distribution parameter nu to the equivalent
normalised measure U. U=log(nu) - psi(nu) - psi(1) |
| Source: See file for references |
RT_cgaussian_iir.m
|
| [S,err] = RT_cgaussian_iir(acf,Nsamples) |
| Known Problems: IIR filter can be unstable, approximation error
can be large. Requires Matlab Signal Processing Toolbox. |
Demo: correlation_demo.m |
Returns Nsamples of correlated zero-mean, unit-variance
gaussian variates with an approximate autocorrelation function
of acf. Note that
Nsamples does not
have to be the same size as acf. It uses ac2poly from
the Signal Processing toolbox. This
function is not necessarily stable as it uses an IIR filter, however
this can make it more accurate. err can be returned to give the
overall
'prediction
error'. The normalised, one sided form for acf should be used.
|
| Source: Matlab signal processing toolbox manual |
RT_cgaussian_fft.m
|
| [S1,{S2}] =
RT_cgaussian_fft(acf) |
| Known Problems: A large number of samples are required for the
sample acf to approach the desired shape. The acf is
only correct in the sense of an ensemble average - not a time average. acf should
be a power-2 length for optimum speed. |
Demo: correlation_demo.m |
Returns up to two innovations of correlated
zero-mean, unit-variance gaussian variates with an approximate
autocorrelation
function
of acf. It shapes the power spectrum via a standard FFT method
and so the number of samples is limited by the length of acf. The
normalised, one sided form for acf should be used.
|
| Source: Standard method based on the Wiener-Khinchin
Theorem. |
segfullX.c
|
| [HH_HH_out,
HV_HV_out, VV_VV_out, HH_HV_out, HV_VV_out, HH_VV_out, {labels}]
= segfullX(connectivity, looks, no_regions, penalty, HH_HH, HV_HV,
VV_VV, HH_HV, HV_VV, HH_VV) |
| Known Problems: Memory intensive |
Demo: segmentation_demo.m |
Fully polarimetric, multifrequency segmentation
algorithm that merges a scene from single pixels. The method is
reasonably fast for what it does but it was developed for a computer
with 2GB memory so speed was optimised rather
than space. Each polarisation input (HH_HH etc.)
should have the size
[X,Y{,Nfreqs}]
for image size X by Y. The pixel connectivity can be 4 or 8, but
I recommend only using 8 otherwise you can't segment diagonal
lines. The number of looks is input so that the mean variance
ratio of the segmented and original co-polarised images can be
calculated. By setting no_regions=0 , the algorithm will automatically
stop when the variance ratio matches the expected value. Otherwise,
the desired no_regions can be input - but be warned that oversegmentation
can take a very long time. A positive penalty value can be used
to constrain the surface tension of each individual segment, typical
values are 0.01. For multilook data such as AirSAR there is no
need for any penalty (use 0.0), but for a two look radar the images
can be significantly improved. See the theory in Stewart et al.
for a good explanation, but check the source code for the exact
algorithm used. The routine uses a slightly modified version of
Red Black Tree code by kind permission of James S. Plank at http://www.cs.utk.edu/~plank/
|
Source: Theory explained in `Polarimetric Classification using Expectation Methods', G Davidson et al..
This is a very complicated routine. An undocumented Bayesian input
is also possible - see the source code.
`Optimal
approach to SAR image segmentation and classification', D. Stewart,
D. Blacknell, A. Blake, R. Cook and C. Oliver, IEE Proc. Radar, Sonar
and Navigation, 147(3), pp. 134-148, June 2000.
|
Detection Theory
Regardless of environment, the object or area of interest
is usually referred to as a `target'. It must be stated that the following
routines and referenced papers are primarily for detecting small targets
such as icebergs or liferafts.
RT_cfar.m
|
| Z = RT_cfar(data,model,Nwindow,Nguard{,k1,k2}) |
| Known Problems: Edge effects are ignored (their output
is returned as zero). Be aware that random number generators may
have correlation which can cause inaccuracies due to resonance.
For Matlab 5 & 6 this is at N=32 (the demo shows how to correct
this). In theory, the implementation is not optimum and can be speeded
up
for large Nwindow - see cfarmex.c for details. |
Demo: cfar_sim_demo.m |
A wrapper function for the cfarmex.c file which
implements fast CFAR processors for 1D vector data. Returns the
test statistic Z (as defined in [1]) for the following CFAR
models:
CA
- Cell
Average,
CAGO
- Cell
Average
Greatest Of,
CASO - Cell Average Smallest Of, OS - Order Statistic (k1th largest),
TM - Trimmed Mean (k1 smallest & k2 largest trimmed). The total
window size Nwindow and the number of guard cells Nguard must be
even numbers. These are then split equally, centred over
the test cell.
|
| Source: [1] `Analysis of CFAR Processors in Nonhomogeneous
Background', P.P.Gandhi and S.A.Kassam, IEEE Trans. AES, 24(4), July
1988, pp 427-445 |
RT_fcdf.m
|
| [P,{Q}] = RT_fcdf(x,df1,df2) |
| Known Problems: None |
Demo: change_demo.m |
Returns the F cumulative probability density with
degrees of freedom
of df1(numerator) and df2(denominator)
at the values in vector X. The
F distribution arises from the ratio of two homogenous
multilook speckle
fields. Strictly speaking, df1 and df2 should
be integers.
Q is returned as
the complementary value, and is calculated
separately from P via dcdflib.
This allows the full range
of realmin < x < realmax
to be processed for inversion via
RT_finv.
|
| Source: www.mathworld.com |
RT_finv.m
|
| X = RT_finv(P,df1,df2,{Q}
) |
| Known Problems: When Q is not passed, for P the closest value to
unity is 1-eps. Pass
complement Q when this is a problem. |
Demo: change_demo.m |
Returns the inverse of the F cumulative probability
density with degrees of freedom
of df1(numerator) and df2(denominator) for
the value P(0 < P< 1).
The F distribution arises from the ratio of two homogenous multilook speckle
fields. Input the complementary value Q if P> (1-eps) such
that
P + Q = 1.
|
| Source: www.mathworld.com ,
uses RT_invcdf.m |
RT_fpdf.m
|
| P = RT_fpdf(x,df1,df2) |
| Known Problems: None |
Demo: change_demo.m |
Returns the F probability density with degrees of
freedom
of df1(numerator) and df2(denominator) at
the values in vector X. The F distribution arises from the ratio of two homogenous
multilook speckle
fields. Strictly speaking, df1 and df2 should be integers.
|
| Source: www.mathworld.com |
RT_Pcfar.m
|
| P = RT_Pcfar(T,N,S,model{,k1,k2}) |
| Known Problems: May have slight numerical problems
for extreme values. |
Demo: cfar_theory_demo.m |
Given a linear threshold T, returns the CFAR probability
for models: CA - Cell Average, CAGO - Cell Average Greatest Of,
CASO - Cell Average Smallest Of, OS - Order Statistic (k1th
largest), TM - Trimmed Mean (k1 smallest & k2 largest trimmed).
N is the total background window size which has to be an
even number.
Using S = 0 returns the Probability of False Alarm. Passing a
linear target strength S > 0 returns the Probability of
Detection for a Swerling 1 target. T can be an array if size
is compatible with S. Use RT_Tcfar.m to invert for threshold
T from probability P.
|
Source: [1] `Analysis of CFAR Processors in Nonhomogeneous
Background', P.P.Gandhi and S.A.Kassam, IEEE Trans. AES, 24(4),
July 1988, pp 427-445
[2] `Detection performance of the trimmed-mean CFAR processor with
noncoherent integration', M.B. El Mashade, IEE Proc. Radar, Sonar
and Navigation, 142(1), Feb 1995, pp 18-24 |
RT_Tcfar.m
|
| T = RT_Tcfar(P,N,S,model{,k1,k2,trace}) |
| Known Problems: Attempts a relative accuracy goal of
1e-4. Numerical inversion using fzero can be slow. |
Demo: cfar_theory_demo.m |
Inverts RT_Pcfar.m to obtain the required threshold given
a probability goal P. See RT_Pcfar.m for parameters, pass non-zero
trace to follow the integration steps.
|
Source: [1] `Analysis of CFAR Processors in Nonhomogeneous
Background', P.P.Gandhi and S.A.Kassam, IEEE Trans. AES, 24(4), July
1988, pp 427-445
[2] `Detection performance of the trimmed-mean CFAR processor with noncoherent
integration', M.B. El Mashade, IEE Proc. Radar, Sonar and Navigation, 142(1),
Feb 1995, pp 18-24 |
swerling_pd.m
|
| Pd = swerling_pd(threshold,SNR,No_Pulses,model) |
| Known Problems: Some of Swerling's original equations use approximations.
Note that the code uses the Matlab form for the incomplete gamma
function, not the Pearson's form or that used in Mathematica. |
Demo: k_detection_demo.m |
Gives the Probability of Detection with respect
to number of pulses for a class of Swerling target models.
Signal to Noise Ratio SNR should be in linear format (not dB).
The fluctuating
target models are numbered 1 to 4. A non-fluctuating target is
commonly referred to as model 0 and 5, both are accepted. Some
cases are necessarily an approximation, don't rely on the exact
value but in practice it should be accurate enough. Additionally,
the approximation error is far outweighed by the variability in
real radar data. The Swerling theory assumes an optimum processor,
see cfar_theory_demo.m for the losses associated with practical
processors. Uses logs for numerical stability.
|
| Source: `Probability of Detection for Fluctuating Targets',
P. Swerling, (1960), IRE Trans. Inform. Theory IT-6 (271), p273-308. |
|