OrthIm-class: Class for handling continuous or discrete orthogonal moments...

Description Creating Objects Slots Extends Methods Author(s) See Also Examples

Description

This class contains an image and all information about the image required for computing a moments analysis of the image. The object can be passed to functions to compute moments and reconstruct the image from the moments. The types of moments that can be calculated using this object are: chebyshev, krawtchouk, hahn, continuous chebyshev, legendre, and gegenbauer.

Creating Objects

Objects can be created by calls of the form new("OrthIm", img, filename). First the constructor checks for an input 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".

Slots

polynomials:

Object of class "list" Contains the polynomials used to calculate moments. First list element contains the polynomials over the x coordinates, the second contains polynomials over the y coordinates. The number of rows is the pixel coordinates, the number of columns is the order of the polynomials.

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.

order:

Object of class "numeric" Contains the order used to calculate moments. Two values may be given to calculate different orders in the x and y directions.

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 types of moments being calculated. Up to two different types may be selected, the first being the type of moments calculated in the x direction, the second being for the y direction. If two different types are chosen, they must both be either discrete or continuous. Choices of discrete moments are: "cheby","krawt","hahn". Choices of continuous moments are: "chebycont","gegen","legendre".

moments:

Object of class "matrix" Contains the moments calculated from 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" Contains the last error message produced from calling a class method.

Extends

Class "Image", directly.

Methods

Moments<-

signature(obj = "OrthIm"): 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 = "OrthIm"): Calculate the invariants of the image by normalization before computing moments. polarTransform will be called with resolution=value[1],scale=value[2]. Before calling this method the momentType, params, and order must be set. Usage: Invariant(obj) <- c(6,100)

Reconstruct<-

signature(obj = "OrthIm"): 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 = "OrthIm"): Constructor. A call to new("OrthIm",img,filename) calls this function and creates an OrthIm object. The object slots I, centroid and dimensions are set. (And filename and imType if a filename was provided)

momentType<-

signature(obj = "OrthIm"): 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")

plotPoly

signature(obj = "OrthIm", order = "numeric"): Plot the polynomials used to calculate the moments in this object. The order, can be 1 number or several numbers, and the polynomials of those orders will be plotted for all x coordinates.

setOrder<-

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

setParams<-

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

transform<-

signature(obj = "OrthIm"): Perform a transform of the image which creates an image of the pixels rearranged by polar coordinates. The rows are radius from the centroid and columns are angle. The method calls polarTransform with padded=FALSE, scale=0

Author(s)

Allison Irvine

See Also

OrthMoments, OrthReconstruct, calcCentroid, plotMoment, displayImg, checkOrder, polarTransform, Image, CmplxIm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(mandril);
obj <- new("OrthIm",img = img,filename = "");
momentType(obj) = c("chebycont","legend");
setOrder(obj) = c(150,150);
Moments(obj) = NULL;
Reconstruct(obj) = c(125,125);
## Not run: 
	displayImg(list(obj@I,obj@moments,obj@reconstruction));
	plotPoly(obj,order=c(100,150));

## End(Not run)

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