# momentObj: Calculate moments of image In IM: Orthogonal Moment Analysis

## Description

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

## Usage

 1 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 will be of first type and the moments in the y direction will be of the second type. 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 the case of complex moments (except for generalized Pseudo-Zernike), two values should be provided to specify the order and repetition. If generalized Pseudo-Zernike moments are being calculated, repetition is constrained by order, so only one value should be specified to indicate order. 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 moments in both the x and y directions, the parameters may be specified only by this argument. 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.

## 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.

## 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.

## Author(s)

Allison Irvine, Tan Dang

OrthIm,CmplxIm,MultiIm

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 #compute chebyshev moments of an image data(lena) ## Not run: displayImg(obj@I) obj = momentObj(I=img,type="cheby",order=c(500,500)); ## Not run: plotMoment(obj) #reconstruct the image from the moments Reconstruct(obj) = c(200,200); ## Not run: displayImg(obj@reconstruction) ## Not run: #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); ## End(Not run) ## Not run: #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; ## End(Not run) 

### Example output   Loading required package: png