IM (version 1.0)

momentObj: Calculate moments of image

Description

Computes continuous complex or discrete/continuous orthogonal moments for an image or list of images.

Usage

momentObj(I, type, order, paramsX, paramsY)

Arguments

I
Either an image in matrix representation or a list of images.
type
One string or an array of two strings indicate the moment types to be calculated. Two types can be given only if they are both either continuous or discrete orthogonal moment types (not complex types). In this case, the moments in the x direction wil
order
In the case of real orthogonal moments, one or two numbers may be provided to indicate the orders up to which to calculate moments in the x and y directions of the image. If one value is provided, the order will be the same in the x and y directions. In
paramsX
Parameters required for calculation of moments in the x direction. These are only required for certain types of moments: generalized Pseudo-Zernike, Hahn, Krawtchouk, and Gegenbauer. If the same moment types and parameters are to be used to calculate
paramsY
Parameters required for calculation of moments in the y direction. These are only required for certain types of moments: generalized Pseudo-Zernike, Hahn, Krawtchouk, and Gegenbauer.

Value

  • If only one image is provided to the function in the first argument "I", an object of type "CmplxIm" or "OrthIm" will be returned, depending on the moment type specified. If the argument "type", specifying the moment type to be calculated, is "gpzm","fm","fc",or "fr", an object of type "CmplxIm" will be returned. If the argument "type", specifying the moment type to be calculated, is "cheby","chebycont","hahn","krawtchouk","gegen", or "legend", an object of type "OrthIm" will be returned. If a list of images is provided to the function in the first argument "I", an object of type "MultiIm" will be returned.

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. For Gegenbauer moments, a single parameter is required, $$a$$ with the constraints $$a > 1$$ and $$a ~= 0$$.A larger value of $$a$$ increases the values of the polynomials used for moment calculation. If $$a = 1$$, the moments are equivalent to continuous Chebyshev moments. For Hahn moments, two parameters are required, $$a$$ and $$c$$ with the constraints $$a > -\frac{1}{2}$$ and $$a > abs(c)-1$$. $$a$$ specifies where the polynomials are centered and the difference between $$a$$ and $$c$$ is positively correlated to the range of the polynomial values used to calculate moments. For Krawtchouk moments, a single parameter is required, $$a$$ with the constraint $$0 < a < 1$$.$$a$$ specifies where the polynomials are centered, relative to the image centroid. See references for further details on these parameters. See the documentation for OrthIm,CmplxIm,and MultiIm for details about image reconstruction.

See Also

OrthIm,CmplxIm,MultiIm

Examples

Run this code
#compute chebyshev moments of an image 
data(lena)
displayImg(obj@I)
obj = momentObj(I=img,type="cheby",order=c(500,500));
plotMoment(obj)
#reconstruct the image from the moments
Reconstruct(obj) = c(200,200);
displayImg(obj@reconstruction)


#calculate bivariate Legendre/Gegenbauer moments up to orders 50 and 100 with parameter 1 for Gegenbauer moments.
	data(lena);
	displayImg(obj@I);
	obj= momentObj(img,c("legend", "gegen"),c(200, 300),NULL,2);
	plotMoment(obj);
	#reconstruct the image from all the moments
	Reconstruct(obj) = NULL;
	displayImg(obj@reconstruction);


#compute Radial Harmonic-Fourier moment invariants of a list of images, using up to order 10 and repetition 10
	data(bacteria);
	obj= momentObj(I=img[1:10],type="fr",order=c(10,10));  
	Invariant(obj) = NULL;

Run the code above in your browser using DataCamp Workspace