You need to cite the following report in all publications including results for which you used this code:
Christian Wolf, Graham Taylor and Jean-Michel Jolion. Learning individual human activities from short binary shape sequences. Technical Report RR-LIRIS-2011-018 Laboratoire d'Informatique en Images et Systemes d'Information (LIRIS), INSA de Lyon, France, October 2011.
This code allows to calculate complex Zernike moments on a binary image and to reconstruct an image from its Zernike moments. The moments are calculated robustly which allows to use them even for the reconstruction with high order moments.
All manipulations use a structure holding Zernike basis functions up to a certain maximum order, which are returned by the function zernike_bf (the arguments are (square) image size and highest order, see manual below):
zbf=zernike_bf(101,12)
The moments are extracted from an image i using the function zernike_mom ...
v=zernike_mom(i,zbf)
... and reconstructed using the function zernike_rec:
r=zernike_rec(v,101,zbf)
ZBFSTR=zernike_bf(SZ,ORDER) ZBFSTR=zernike_bf(SZ,ORDER,WITHNEG) Calculate the Zernike basis functions up to order ORDER for a square image of size SZ (rows = cols!) If WITHNEG is 1, then the basis functions with negative repetition are included. The array contains basis function entries for couples of (p,q), where q can be negative. ZBFSTR is a structure with the following elements: .bf ....... the basis functions (SZ, SZ, LENGTH). .orders ... a matrix (2, LENGTH), where the first column holds the order p and the second column the repetition q. .index .... a matrix (1+2*ORDER, 1+2*ORDER) which holds for each element the index in .orders and in .bf of this couple of p,q. -1 means that there are no basis functions for this couple ATTENTION!!! since indixes in matlab always start with 1 they should be negative (as well as positive) here, the index starts with -ORDER, which requires adding ORDER+1 to both dimensions. So given an order of 12, instead of ZBFSTR.index(-5,3) we write ZBFSTR.index(8,16); .maxorder . the maximum order, basically the ORDER parameter given to this function. .withneg .. 1 if there are basis functions with negative repetition, so basically the WITHNEG parameter to this function All pixels out of the disk inscribed into the image square are ignored.
Z=zernike_mom(I,ZBFSTR) Calculate the Zernike moments from an image. We suppose that some amount of first (lower) order moments, not necessarily all moments, are available. Z ........ The COMPLEX Zernike moments I ........ The input image ZBFSTR ... The Zernike basis functions, can be computed by zernike_bf
I=zernike_rec(Z,SZ,ZBFSTR) I=zernike_rec(Z,SZ,ZBFSTR,OPTSTARTIND) Reconstruct an image from some of its Zernike moments. We suppose that some amount of first (lower) order moments, not necessarily all moments, are available. Z ............. The COMPLEX Zernike moments SZ ............ The size of the square image ZBFSTR ........ The Zernike basis functions, must be precomputed with zernike_bf() OPTSTARTIND ... If given, the starting index from which reconstr. is performed. Allows to ignore a higher or lower number of lower order polynomials. THIS IS NOT THE ORDER, BUT ITS INDEX! Default value: 4 for a full basis, 3 for a basis w/o negative repetitions
CS=centersquare(I) CS=centersquare(I,OPTSIZE) Take an image window and resize it to a given target size. Place it in a squared window such that it's size is maximized without distortion. I ......... The input image OPTSIZE ... If given, than the desired size from parameters.m is overridden
File | Download | Remark |
zernike_chriswolf.tgz | http | Tarball of matlab sources |
Permission is granted for anyone to copy, use, modify, or distribute this program and accompanying programs and documents for any purpose, provided this copyright notice is retained and prominently displayed, along with a note saying that the original programs are available from my web page.
The programs and documents are distributed without any warranty, express or implied. As the programs were written for research purposes only, they have not been tested to the degree that would be advisable in any important application.
All use of these programs is entirely at the user's own risk.
You need to cite the following report in all publications including results for which you used this code:
Christian Wolf, Graham Taylor and Jean-Michel Jolion. Learning individual human activities from short binary shape sequences. Technical Report RR-LIRIS-2011-018 Laboratoire d'Informatique en Images et Systemes d'Information (LIRIS), INSA de Lyon, France, October 2011.
This code was written by Christian Wolf.