Image-class: Basic class to handle image moment analysis

Description Creating objects Slots Methods Note Author(s) See Also Examples

Description

This class contains general information about an image, and is inherited by the "CmplxIm" and "OrthIm" classes. It contains basic utilities and object slots which are needed for both continuous complex moment analysis and discrete/continuous real orthogonal moment analysis. An object of this class can be cast to either a CmplxIm type object or a OrthIm type object.

Creating objects

Objects will be created by calls of the form new("Image", img, filename). When the constructor is called and a filename is given, the input file will be loaded and the image will be converted to grayscale and stored in slot "I". Only files of type "jpeg", "bmp" or "png" may be imported this way. If the argument "img", an image in matrix or numeric form, is provided when the constructor is called, the image will be converted to grayscale and stored in slot "I" of the object. When this slot value is set, the centroid and dimensions of the image will be calculated. The constructor for this class will be called when objects of the inheriting classes "CmplxIm" and "OrthIm" are created. See OrthIm, CmplxIm.

Slots

I:

Object of class "matrix" representing the image.

dimensions:

Object of class "numeric" containing dimension of the image.

centroid:

Object of class "numeric" containing centroid of the image. See calcCentroid.

filename:

Object of class "character" containing name of the image

imType:

Object of class "character" containing image extension.

momentType:

Object of class "character" containing moment type. Either "gpzm", "fm", "fr", "fc", "krawt", "hahn", "cheby", "gegen", "legend", "chebycont". See OrthIm, CmplxIm.

moments:

Object of class "matrix" containing computed moments from the image.

invariant:

Object of class "matrix" containing computed invariants from the image.

reconstruction:

Object of class "matrix" representing the reconstructed image from the computed moment.

error:

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

Methods

initialize

signature(.Object = "Image"): Construct the "Image" object. To be used internally when constructing "OrthIm" and "CmplxIm" object only.

plotMoment

signature(obj = "Image"): Plot the calculated moments. Usage: plotMoment(obj).

setCentroid<-

signature(obj = "Image"): Set centroid of image to an array of 2 values (the x and y pixel coordinates of the centroid). If a value is not supplied, the centroid will be calculated using geometric moments. Usage: setCentroid(obj)<- c(value1,value2).

setImage<-

signature(obj = "Image"): Set the image slot of the object to an image in matrix or numeric form. Usage: setImage(obj)<- img.

Note

This class does not have functions available for calculating moments or reconstruction from moments. In order to calculate moments you must use an object of type "OrthIm" or "CmplxIm".

Author(s)

Allison Irvine

See Also

OrthIm, CmplxIm, calcCentroid, plotMoment

Examples

1
2
3
4
5
6
7
# create an object of class "Image"
data(lena)
obj = new("Image",img=img)
#display image
## Not run: displayImg(obj@I)
#convert the object to the class "OrthIm"
obj=as(obj,"OrthIm")

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