Learn R Programming

IM (version 1.0)

CmplxIm-class: CmplxIm Class

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.

Arguments

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.

Extends

Class "Image", directly.

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.

See Also

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

Examples

Run this code
#load image
data(earth)
#initialize object
obj<- new("CmplxIm", img=img)
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

#calculate moments of the image
	Moments(obj)<- NULL
	#calculate rotation invariants
	Invariant(obj) =NULL;
	#reconstruct the image from moments
	Reconstruct(obj)<- c(20,20)
plotMoment(obj);
displayImg(obj@reconstruction);

Run the code above in your browser using DataLab