face-trace

所属分类:图形图像处理
开发工具:matlab
文件大小:142KB
下载次数:279
上传日期:2007-05-23 10:17:41
上 传 者apei100
说明:  人脸跟踪的一些主流算法的matlab实现
(face tracking algorithm for the mainstream to achieve the Matlab)

文件列表:
trace4all (0, 2007-03-14)
trace4all\a0.pgm (80074, 2004-02-19)
trace4all\b0.pg2 (186860, 2001-05-29)
trace4all\c0.pg2 (195806, 2001-05-29)
trace4all\computeFunctional.m (541, 2004-06-23)
trace4all\d0.pg2 (175763, 2001-05-29)
trace4all\e0.pg2 (182766, 2001-05-29)
trace4all\functional.cpp (5204, 2004-07-21)
trace4all\lines3h.h (16750, 2004-07-21)
trace4all\modioperandi0.h (30041, 2004-07-21)
trace4all\objectListing.c (968, 2004-06-23)
trace4all\objects0.h (12495, 2004-07-21)
trace4all\rm_hlam.bat (183, 2004-05-19)
trace4all\show_iwC_txt.m (2103, 2004-06-26)
trace4all\stages0.h (8303, 2004-07-21)
trace4all\start.m (59, 2004-06-24)
trace4all\telafft.c (48321, 1995-06-28)
trace4all\testTr.m (8268, 2004-06-26)
trace4all\trArray1.mat (856, 2004-06-17)
trace4all\trArray2.mat (240, 2004-06-16)
trace4all\trArray3.mat (984, 2004-06-18)
trace4all\trArray4.mat (984, 2004-06-18)
trace4all\trArray5.mat (984, 2004-06-23)
trace4all\trArray6.mat (384, 2004-06-23)
trace4all\tt.cpp (29098, 2004-07-21)
trace4all\unit2.h (38017, 2004-07-21)
trace4all\Outinfo (0, 2007-03-14)
trace4all\Outinfo\TrMatrs (0, 2007-03-14)
trace4all\Outinfo\Circuses (0, 2007-03-14)
trace4all\Outinfo\Triple (0, 2007-03-14)
trace4all\subroutines (0, 2007-03-14)
trace4all\subroutines\Disp.m (471, 2001-06-29)
trace4all\subroutines\fig.m (219, 2003-10-29)
trace4all\subroutines\figim.m (787, 2001-11-27)
trace4all\subroutines\imafFill0.m (1733, 2001-04-07)
trace4all\subroutines\medianW.m (200, 2001-04-08)
trace4all\subroutines\plotcirc.m (267, 2004-06-24)

Trace Transform Package, version 1, June 2004 This package presents C++ tools to the trace transform of a 2D image, and related objects, i.e. circuses and triple features, matlab tools to visualise these entities, and tools to check newly coded functionals. This version is released with a small number of functionals only. ===================================== THEORY The theory of the trace transform is described in papers A Kadyrov and M Petrou, 2001. "The Trace transform and its applications". IEEE Transactions on Pattern Analysis and Machine Intelligence, PAMI, Vol 23, pp 811-828. M Petrou and A Kadyrov ''Affine invariant features from the Trace transform'', IEEE Transactions on Pattern Analysis and Machine Intelligence, vol.26, No.1, January 2004, pp 30-44. A Kadyrov and M Petrou "Object signatures invariant to affine distortions derived from the trace transform", Image and Vision Computing, 1 December 2003, vol. 21, no. 13, pp. 1135-1143, Elsevier Science. PART 1. Program tt.cpp PREAMBLE A program "tt.cpp" version 0.1 takes one or more images as input and outputs trace transforms, circuses and triple features. The code is in C++; the main source program is "tt.cpp" and there are a few include files with extension *.h. The program can be compiled by any C++ compiler with optimisation: for example, using gnu compiler g++, as g++ tt.cpp -o tt -O3 If matlab is available, the user can view the results using matlab. For that purpose a set of matlab m-files is provided. To make results accessible by matlab, a set of options in the form -*w*txt is provided, where "w" stands for "write", and "txt" indicates text file, that can be read by the standard matlab function "textread". Running the program uses a standard "-" way of description in the form tt -option1 -option2 argument -option3 argument argument... The order of the options is not significant. To check that the program properly understood your input, tt will print input variables. To make it silent, use "silent" option -S On the other hand, to retrieve maximum information, including timing and long list of images, use the "verbose" option -V TWO SPEED OPTIONS The user is not supposed to change the code except the first line which is //#define USEPEANO This directive can be commented out as above or uncommented as #define USEPEANO This directive makes available the use of Peano indexing of images. For some computers this speeds up the program by a factor of 2. However, in other computers this indexing slows it down. FILE SYSTEM Place the program tt in a current directory, in our example it is directory tr4all. The result of the program may encompass many files of different nature, so a file system is proposed to find a way to output the data. For writing down the results, the user should create an output directory , and its three subdirectories with predefined names: "TrMatrs\", "Circuses\" and "Triple\". As it is obvious from the names, these three directories will accumulate information about the trace matrices, the circuses and the triple features, respectively. It is advisable to use different output directories for different sets of images and functionals. If is not specified in the options, program tt.cpp uses as default ="Outinfo/". PATH TO IMAGES The most important argument is an image or a list of images. All images should be in *.pgm format; both P5 (byte) or P2 (text) are allowed. It should be mentioned that matlab Release 13 reads and writes *.pgm files. The images should be in a single directory and the path can be given as an argument: -Ipath Comment: a path should end with the symbol "/". If this option is omitted, the default is an empty string "", pointing to the current directory LIST OF IMAGES: TWO ALTERNATIVES: -I ... Comment: one or more names of image files. -Ifile Comment: It is used if the list of image names is too long for the command line. OUTPUT INFORMATION DIRECTORY To provide the program with an output directory, the following option is used -Dir where is the path to a directory for the output information Comment: default: =Outinfo/ As it was mentioned earlier, this directory must have three subdirectories TrMatrs/ Circuses/ Triple/ The first one is for the trace matrices, the second one is for circuses, and the last one is for triple features. FUNCTIONALS The following overview of basic ideas may help one understand our functional enumeration system. A functional is an operation that produces a number out of a function. In the program we use notions of "modus operandi" and an "object". Modi operandi and objects have independent numbering. A modus operandi computes one or more objects, and in computations it uses some (or none) other objects. An object may be a number or a more complicated object, like an array, as in the case of the Fourier transform. Some objects are numbers and therefore they may be obtained as results of functional computations. This explains why the enumeration of functionals is not successive, since not all objects are functionals. Another implication is that the user may only use legitimate code numbers of functionals. If the user tries to refer to numbers that identify helping objects, as opposed to functionals, a run time error may occur. The list of available functionals will grow in the next versions of our program. Having a list of functionals, the program finds an economical set of modi operandi in order to share computations. Occurring symmetries also are taken into consideration to shorten computations. This explains why computation of several functionals in one run of the program may be faster than several runs for each functional separately. In an argument list means identify the functional you want to use by its index. For example, "sum" is functional 33; being used as a trace functional, it will produce the Radon transform of an image, see an example below. LISTS OF FUNCTIONALS Trace, diametrical and circus functionals are specified as follows: -T .. -P < diametrical_functional> .. -F .. The option "-T" is necessary, the other two options may be omitted. For example, if the user does not want to compute triple features, then option "-F" is superfluous. The indices of the functionals should be given in ascending order. If not, the program will rearrange the lists in ascending order. We designated the number of trace functionals by LtrList, the number of diametric functionals as LdiList, and the number of circus functionals as LcirList. These designations are used in this manual and in the program. A SIMPLE FUNCTION CALL To demonstrate an idea of a program call consider the following minimalistic example. Suppose you have an image "image1.pgm" in the current directory. Then, to refer to it, you do not need to specify an image directory. Let a directory "Outinfo/" be in the current directory and its subdirectory "TrMatrs/" be created. Then, the following call tt -I image1.pgm -T 33 -wTtxt will compute the Radon transform of the image. Here option "-wTtxt" means that all trace matrices, (one only in this example), are to be written as text files. The result of the program is a file Outinfo/TrMatrs/image1T033.txt To view the Radon transform, the following matlab command may be used: T33=textread('Outinfo/TrMatrs/image1T033.txt')'; imagesc(T33); Here transposition (') is involved to make the angle axis horizontal. TRACE DISCRETISATION PARAMETERS An image function considered along a line is called a trace. This explains the term "Trace transform": each trace is converted into a number and the numbers are organised in a trace matrix. A line position is identified by parameters p and fi. Along the line the varying parameter is t. The user can specify discretisation of these parameters as -dt Comment: default 1.0. The distance between successive points along each tracing line is measured in terms of inter-pixel distances -dp < distance_in_pixels> Comment: default 1.0 -360 Comment: default N2pi=128, that is 360/128=1.8125 degrees between consecutive directions. Hence, N2pi is the length of any circus which will appear in the program. This number should be divisible by 4. These three arguments allow the shortening of computation time. Even a moderate increase of dt and dp improves the time, which is proportional to N2pi/(dt*dp). In order to choose these arguments, we may speculate that the optimal size of a trace matrix should be approximately equal to the size of the image in order to store equivalent information, or smaller, if many trace matrices are used to characterise a particular image. OUTPUT TEXT INFORMATION The option ending with "txt" forces writing the text output readable for matlab. -wTtxt Comment: all trace matrices to be written in files with names according to the convention: "T"".txt" -wCtxt Comment: all circuses to be written in files with names according to the convention: "T""C"".txt" -wCAtxt Comment: all associated normalised circuses to be written in files. If a circus cannot be normalised, the file is filled with zeros. File names follow the convention: "T""CA"".txt". -wCPtxt Comment: all plain normalised circuses to be written in files. If a circus cannot be normalised, the file is filled with zeros. The file name is in the form "T""CP"< functional number, 3 digits >".txt" The last three options may lead to a huge number of files. Overall LtrList* LdiList files per image will be written. They can be merged into one file corresponding to a particular image. The following options produce a long line of concatenated LtrList*LdiList circuses for each image, -iwCtxt Comment: the file names are in the form: "C.txt" -iwCAtxt Comment: the file names are in the form: "CA.txt" -iwCPtxt Comment: the file names are in the form: "CP.txt" In each file the circuses follow in lexigraphical order corresponding to pairs (). Therefore, the circuses for a given trace matrix are concatenated. Overall one file per image will be produced. OUTPUT pgm INFORMATION -wTpgm Comment: all trace matrices being scaled to the range [0,255] to be written for visualisation in files with names following the convention: "T"".pgm" OUTPUT BYTE INFORMATION Text files are unnecessarily big and take time for reading and writing. Then, for working with a big database, we use the formats *.sm and *.sc, which allow smaller (by more than a factor of 10) files. As for Unix and Windows, files in these formats are portable. For writing a trace matrix M, its minimum (min) and maximum (max) element are found. Then a matrix M1 is composed as M1=round(255*(M-min)/(max-min)) Then max and delta=max-min are coded in 4 bytes each. Therefore, the numerical information has an 8 byte scale normalising prefix. For the rule of coding and decoding the numbers, see in unit2.h, functions "packdouble" and "unpackdouble". Coding and decoding the matrix is done by "writeMatrixSmall" and "readMatrixSmall" For writing a set of concatenated circuses into one *.sc file, each circus is preceded by its 8 byte scale normalising prefix. Therefore, the number of bytes in *.sc is equal to the product (number of trace functionals = LtrList)* (number of diametrical functionals = LdiList)* (8+(length of one circus = N2pi)) Consequently, to read these files the user should know numbers LtrList, LdiList and N2pi beforehand. Functions writeAllCircByParts and readAllCircByParts write and read *.sc format. The following options correspond the options listed above, except they use a different output format -wT Comment: the file name is in the form "T"C".sm" -wC Comment: the file name is in the form "T"C".sm" -wCA Comment: the file name is in the form "T"CA".sm" -wCP Comment: the file name is in the form "T"CP".sm" Comment for these four options: output files: *.sm; overall LtrList* LdiList files per image are created. -iwC Comment: the file name is in the form "C.sc" -iwCA Comment: the file name is in the form "CA.sc" -iwCP Comment: the file name is in the form "CP.sc" Comment for these three options: output files: *.sc, one file per image. TRIPLE FEATURES The program offers one file of triple features for each image; therefore, the first letter of option is "i". This file can be of three kinds: triple features for plain (ie initial) circuses; the option to get such a file is -iwFtxt Comment: the file name is in the form "F.txt" triple features computed for normalised associated circuses; the option is -iwFAtxt Comment: the file name is in the form "FA.txt" and features computed for normalised plain circus; the option is -iwFPtxt Comment: the file name is in the form "FP.txt" As it is seen from the extension, the files are text files. Triple features are arranged in lexicographical order of the triplets (this explains why the term "triple features" are used): (, ,). Therefore, all the computed triple features for a given trace matrix follow each other, then triple features for the next trace matrix follow, etc. Overall one file per image is produced, in it the number of triple features is equal to the product LtrList*LdiList*LcirList. PART 2. OTHER PROGRAMS LIST OF ALL FUNCTIONALS: PROGRAM "functional.cpp" This can be compiled, for example, as g++ functional.cpp -o functional -O3 Without arguments, this program types the list of currently available functionals. With argument it computes a single functional, and it can be used to check the properties of that functional. The latter can be done by using the matlab program "testTr.m", described below. Read about the program functional.cpp in the first commented lines of its code. MATLAB The matlab session should start with "start.m". Matlab can be used for the following purposes: 1. To view a trace transform *.txt file, use line M=textread(trace_transform_file_name)'; imagesc(M);colorbar;pixval For example, T33=textread('Outinfo/TrMatrs/image1T033.txt')';imagesc(T33) (if the file exists) 2. To view all circuses for a given image, use the command show_iwc_txt(text_file_containing_all_circuses,) Example: show_iwc_txt('a0CA.txt') (if ="Outinfo/"). For further information type help show_iwc_txt 3. Function "computeFunctional.m" computes a functional "fnlNo" for a given trace f(t)=array "AA". It does this via "functional.cpp". Call this function as fnlvalue=computeFunctional(fnlNo,typ,AA,Lbeg) where "typ" can be one of the following two options: 0 - if the array "AA" consist of integer numbers in the range [0,255], 2 - if the elements of "AA" are interpreted as double. This argument appears because a functional may be programmed in either of these two ways. The integer argument Lbeg is equal to the first value t in trace f(t)=array "AA". Then the values of t are Lbeg, Lbeg+1, Lbeg+2, ..., Lbeg+length(AA). Output is fnlvalue(1) - value of the functional for f(t) fnlvalue(2) - value of the functional for f(-t) fnlvalue(3) - value of the functional for -f(-t) This kind of output is due to the fact that a functional for f(-t) and -f(-t) may be computed by different algorithms. This fact in the program is associated with attributes "attBack" and "attSack", and it is explained later. 4. In order to check the properties of a functional, one may investigate the behaviour of the functional to scaling, shrinking and shifting the trace f(t). Behaviour with respect to inverting the trace, in the sense of using f(-t) and -f(-t), is also needed since this should be described in program tt.cpp. The "testTr.m" performs this analysis using function "computeFunctional.m". As a result, an estimation of kappa, lambda and the invariance of the functional are given. For further information use help testTr PART 3. WRITING A CODE FOR A NEW FUNCTIONAL The number of objects and modi operandi is limited by constant int const Amount=100; in file "objects0.h". You can change this constant if larger indices are needed. A new object should be first described in "objects0.h". Coding of a new object is demonstrated in an example of object 46. ATTRIBUTES Object no. 46 is described by its 12 attributes in "objects0.h": k=46; attIsfnl[k]=1;//0=non-scalar; 1=scalar attName[k]="integral of |f'| circular"; attKind[k]=1;//0 = no info;1 = invariant; 2 = sensitive attGray[k]=2;//0=for binary trace only,1=for integer trace, 2=for double trace attBack[k]=0;//0=same,1=sign,k>1 in object k attSack[k]=0;//0=same,1=sign,k>1 in object k attHasKappa[k]=1; attKappa[k]=0; attHasLambda[k]=1;attLambda[k]=1; attBlank[k]=0; attIsInteger[k]=1;//0=double output,1=integer output This object uses another object, no. 45, which is called . Object 45 is a summation of |f'(t)|, t=0,1,2,...,L-1. Object 46 is an object 45 plus |f(L-1)-f(0)|. In turn, object 45 uses object 44. Its description is k=44; attIsfnl[k]=0;//0=non-scalar; 1=scalar attName[k]="differences 1"; From this, one may notice that objects 46 and 45 are scalar objects, and therefore they may be treated as functionals. Object 44 is a helping array, and it is not a functional. For helping objects one needs only 2 attributes, and for scalar objects 12 attributes are needed. Attributes have the following meaning: attIsfnl[k] explains whether the object no. k is a scalar one attName[k] is its description or its formula attKind[k] shows whether it is invariant, sensitive, or neither attGray[k] explains whether it can be computed only for binary image, only for integer image, or for any real-valued image. attBack[k] describes that functional T no. k has one of the properties: T(f(-t))=T(f(t)) (attBack[k]=0), T(f(-t))=-T(f(t)) (attBack[k]=1), or T(f(-t)) can be found in object no. attBack[k] (if attBack[k]>1). In the latter case you have to create object k1= attBack[k]. For object k1 n ... ...

近期下载者

相关文件


收藏者