Description Creating objects Slots Methods Author(s) See Also Examples
The class contains a list of images and all information required for computing the moments of the images. The images must have the same dimensions and centroid. The object has methods for computing moments and reconstructing the image from moments. Types of moments that can be calculated for this class are: generalized pseudo-zernike, fourier mellin, fourier chebyshev, radial fourier, krawtchouk, hahn, continuous chebyshev, legendre, and gegenbauer.
Objects can be created by calls of the form new("MultiIm", images)
where "images"
is list of matrices.
The dimensions of the images will be checked for consistency when the constructor is called. Moment type, order, and parameters can
be set using the class methods.
imageList
:Object of class "list"
Contains a list of image matrices of the same dimension.
dimension
:Object of class "numeric"
Contains the dimensions of the images.
polynomials
:Object of class "list"
Contains the polynomial values used for computing moments.
storePoly
:Object of class "logi"
Default is FALSE. Set to "TRUE"
to store polynomial values. For gpzm, fm, fr, and fc moment types, if object@storePoly== TRUE, polynomial values will be stored in the slot "polynomials".
Polynomial values for other moment types will always be stored. Set directly by object@storePoly<- TRUE
momentType
:Object of class "character"
Contains the moment type.
order
:Object of class "numeric"
Contains the maximum order up to which to calculate moments.
Params
:Object of class "list"
Contains the parameters used to calculate the moments. First list element is the parameters for the moments over x coordinates, second is for the y coordinates.
moments
:Object of class "list"
Contains a list of the moments calculated for each image.
invariant
:Object of class "list"
Contains a list of the invariants calculated for each image.
reconstruction
:Object of class "list"
Contains the list of reconstructed images.
error
:Object of class "character"
Contains the last error message produced from calling a class method.
signature(obj = "MultiIm")
: Set the moment type for the moments to be calculated.
Takes one character string or an array of 2 character strings, for example c("type1","type2").
Usage: momentType(obj)<- c("krawt", "hahn") or momentType(obj)<-"gpzm"
signature(obj = "MultiIm")
: Set the orders up to which to calculate moments in the x and y
directions in the case of real orthogonal moments, or specify order and repetition for complex moment types. Usage: setOrder(obj)<- c(50,50)
signature(obj = "MultiIm")
: Set the parameters to be used for calculating moments.
If two types of moments are being used, this should be a list of the parameters to be used for each moment type
being used. Usage: setParams(obj)<- list(c(0.5), c(1,1))
signature(obj = "MultiIm")
: Perform a transform of the images which creates an image
of the pixels rearranged by polar coordinates. The rows are radius from the centroid and columns are angle. See polarTransform
.
signature(obj = "MultiIm")
: Calculate the moments of a list of images. Before calling
this method the momentType, params, and order must be set. Usage: Moments(obj)<- 0.
signature(obj = "MultiIm")
: Calculate the moment invariants w.r.t. rotation of a list
of images. Before calling this method the momentType, params, and order must be set. The method assumes that all
images have the same centroid location. For complex moments, the magnitude of the moments are invariant to rotation.
Usage: Invariant(obj)<- NULL.
For real orthogonal moments (continuous or discrete), the method normalizes all images prior to computing moments
using the same procedure as Invariant<-,OrthIm-method
. Usage: Invariant(obj)<- c(5,120)
signature(obj = "MultiIm", order = "list")
: Plot the polynomials used to calculate moments
of a specified order or array of orders. Usage: plotPoly(obj, list(3:6, 1:4)).
signature(obj = "MultiIm")
: Reconstruct the images from moments.
Any order lower than or equal to the maximum order calculated can be used for reconstruction. Usage: Reconstruct(obj)<- c(50,50)
Tan Dang
plotPoly
displayImg
Image
,
OrthIm
CmplxIm
,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # Load sample data
data(bacteria);
#create MultiIm object, calculate generalized Pseudo-Zernike moments, invariants, and reconstruction for all images
obj <- new("MultiIm", img);
momentType(obj)= c("gpzm");
setOrder(obj)= 20;
setParams(obj)= 1; # <--- GPZM has 1 parameter
obj@storePoly= TRUE;
## Not run:
Moments(obj)= NULL;
Invariant(obj)= NULL;
Reconstruct(obj)= NULL;
#display a subset of polynomials stored in the object
plotPoly(obj, order=rbind(c(3,2), c(4,2), c(5,3), c(6,3)));
displayImg(obj@reconstruction[1:5]);
## End(Not run)
## Not run:
#create MultiIm object, calculate discrete Chebyshev moments, invariants, and reconstruction for all images
obj <- new("MultiIm", img);
momentType(obj)= "cheby"
setOrder(obj)= 100;
Moments(obj)= 0;
Reconstruct(obj)= 75;
Invariant(obj)= c(7,100); # resolution is 7, scale is 100
displayImg(obj@reconstruction[1:4]);
## End(Not run)
## Not run:
#create MultiIm object, calculate continuous Chebyshev - Legendre moments, invariants, and reconstruction for all images
obj <- new("MultiIm", img);
momentType(obj)= c("chebycont", "legend");
setOrder(obj)= c(100, 110);
transform(obj)= 8; # perform polar transform on images
Moments(obj)= 0;
Reconstruct(obj)= NULL;
# order of pairs (20,10), (21, 11),...(28,18) will be plotted
plotPoly(obj, order=cbind(20:28, 10:18));
displayImg(obj@reconstruction[1:6]);
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.