CmplxIm-class: CmplxIm Class

Description Details Objects from the Class Slots Extends Methods Author(s) See Also Examples

Description

This class contains an image and all information about the image required for computing the moments of the image. The object has methods for computing moments, moment invariants, and reconstructing the image from moments.
The types of moments that can be calculated using this object are: generalized Pseudo-Zernike, Fourier Mellin, Fourier Chebyshev, and Radial Harmonic Fourier.

Details

For generalized Pseudo-Zernike ("gpzm") moments, a single parameter is required,

a

. A larger value of

a

decreases the range of the polynomial values used for moment computation.

Objects from the Class

Objects can be created by calls of the form new("CmplxIm", img, filename). First the constructor checks for an input argument containing an image (img). This can be a multidimensional numeric array or a matrix. The image is converted to grayscale by summing over all colors and stored in slot "I". If an input image is not provided, a filename (filename) can be passed to the constructor. The constructor will then read in the image file and convert it to grayscale. If a filename is given, it must have the extension ".jpg", ".png", or ".bmp". If "img" and "filename" are not provided, and empty object will be created.

Slots

radius:

Object of class "matrix" Contains the radius of all of the pixels with respect to the centroid of the image.

theta:

Object of class "matrix" Contains the angle of all of the pixels with respect to the centroid.

constants:

Object of class "matrix" Contains constants used in the calculation of generalized pseudo-zernike moments and image reconstruction.

params:

Object of class "numeric" Contains the parameters used to calculate generalized pseudo-zernike moments.

order:

Object of class "numeric" Contains the order and repetition used to calculate moments. Two values may be given, which specify order and repetition, except in the case of generalized Pseudo-Zernike moments. In this case only one value should be provided, specifying order. Then repetition is constrained by the order.

I:

Object of class "matrix" Contains the original image, in grayscale.

dimensions:

Object of class "numeric" Contains the dimensions of the image.

centroid:

Object of class "numeric" Contains the x and y coordinates of the centroid (center point) of the image, used for calculating continuous orthogonal moments.

filename:

Object of class "character" Contains the filename of the image.

imType:

Object of class "character" Contains the original image file type.

momentType:

Object of class "character" Contains the type of moments being calculated. Choices are: "gpzm" (Generalized Pseudo-Zernike),"fm" (Fourier Mellin),"fc" (Fourier Chebyshev),"fr" (Harmonic Radial Fourier).

moments:

Object of class "matrix" Contains the moments calculated from the image. Dimensions are order by repetition.

invariant:

Object of class "matrix" Contains the invariants computed for the image. Dimensions are order in y direction by order in x direction.

reconstruction:

Object of class "matrix" Contains the image reconstructed from the moments.

error:

Object of class "character" containing a list of error messages produced from calling class methods.

Extends

Class "Image", directly.

Methods

Moments<-

signature(obj = "CmplxIm"): Calculate the moments of the image. Before calling this method the momentType, params, and order must be set. Usage: Moments(obj) <- 0

Invariant<-

signature(obj = "CmplxIm"): Calculate moment invariants of the image by taking the absolute values of the moments and normalizing them by the moment with order and repetition 0. Before calling this method the momentType, params, and order must be set. Usage: Invariant(obj) <- 0

Reconstruct<-

signature(obj = "CmplxIm"): Reconstruct the image from the moments, using moments up to a specified order. If no order value is given, the image will be reconstructed from all available moments. Useage: Reconstruct(obj) <- order

initialize

signature(.Object = "CmplxIm"): Constructor. A call to new("CmplxIm",img,filename) calls this function and creates an CmplxIm object. The object slots I, centroid, radius, theta, and dimensions are set. (And filename and imType if a filename was provided)

momentType<-

signature(obj = "CmplxIm"): Set the moment type for the moments to be calculated.

setImage<-

signature(obj = "CmplxIm"): Set "I", the image in the object. Input can be a matrix or multidimensional numeric array. When this is called, the object slots centroid, radius, theta, and dimensions are set.

setOrder<-

signature(obj = "CmplxIm"): Set the order up to which to calculate moments in the x and y directions.

setParams<-

signature(obj = "CmplxIm"): Set the parameters to be used for calculating moments.

setPolar<-

signature(obj = "CmplxIm"): Calculate the polar coordinates of the pixels with respect to the centroid. The object slots "radius" and "theta" are set.

Author(s)

Allison Irvine

See Also

calcCentroid, polarXY, plotMoment, displayImg, checkOrder, polarTransform, Image, OrthIm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#load image
data(earth)
#initialize object
obj<- new("CmplxIm", img=img)
## Not run: displayImg(obj@I)
#set the moment type to generalized Pseudo-Zernike
momentType(obj)<- "gpzm"
#set the order
setOrder(obj)<- 25
#set the parameter  
setParams(obj)<- 1

## Not run: 
	#calculate moments of the image
	Moments(obj)<- NULL
	#calculate rotation invariants
	Invariant(obj) =NULL;
	#reconstruct the image from moments
	Reconstruct(obj)<- c(20,20)

## End(Not run)
## Not run: plotMoment(obj);
## Not run: displayImg(obj@reconstruction);

IM documentation built on May 2, 2019, 8:55 a.m.