version 1.5.0.0 (15.1 MB) by
Dirk-Jan Kroon

Cootes 2D/3D Active Shape & Appearance Model for automatic image object segmentation and recognition

This is an example of the basic Active Shape Model (ASM) and also the Active Appearance Model (AAM) as introduced by Cootes and Taylor, 2D and 3D with multi-resolution approach, color image support and improved edge finding method. Very useful for automatic segmentation and recognition of biomedical objects.

.

Basic idea ASM:

The ASM model is trained from manually drawn contours (surfaces in 3D) in training images. The ASM model finds the main variations in the training data using Principal Component Analysis (PCA), which enables the model to automatically recognize if a contour is a possible/good object contour. Also the ASM modes contains matrices describing the texture of the lines perpendicular to the control point, these are used to correct the positions in the search step.

After creating the ASM model, an initial contour is deformed by finding the best texture match for the control points. This is an iterative process, in which the movement of the control points is limited by what the ASM model recognizes from the training data as a "normal" object contour.

.

Basic idea AAM:

PCA is used to find the mean shape and main variations of the training data to the mean shape. After finding the Shape Model, all training data objects are deformed to the main shape, and the pixels converted to vectors. Then PCA is used to find the mean appearance (intensities), and variances of the appearance in the training set.

Both the Shape and Appearance Model are combined with PCA to one AAM-model.

By displacing the parameters in the training set with a know amount, an model can be created which gives the optimal parameter update for a certain difference in model-intensities and normal image intensities. This model is used in the search stage.

.

Literature:

- Ginneken B. et al. "Active Shape Model Segmentation with Optimal Features", IEEE Transactions on Medical Imaging 2002.

- T.F. Cootes, G.J Edwards, and C,J. Taylor "Active Appearance Models", Proc. European Conference on Computer Vision 1998

- T.F. Cootes, G.J Edwards, and C,J. Taylor "Active Appearance Models", IEEE Transactions on Pattern Analysis and Machine Intelligence 2001

Examples(2D):

Run the example "ASM_2D_example" and "AAM_AAM_2D_example", the examples are made from manually drawn contours in 10 hand photos (with DrawContourGui). After training the ASM / AAM model will automatically find the contour in the test hand image.

Examples(3D):

First train the classifier to recognize the Mandible "ASM_3D_train_example" or "AAM_3D_train_example", and then segment with "ASM_3D_apply_example", or "AAM_3D_apply_example".

Comments:

Please leave a comment, if you like it, find a bug, or know (made) good improvements to the code.

Dirk-Jan Kroon (2020). Active Shape Model (ASM) and Active Appearance Model (AAM) (https://www.mathworks.com/matlabcentral/fileexchange/26706-active-shape-model-asm-and-active-appearance-model-aam), MATLAB Central File Exchange. Retrieved .

Created with
R2010a

Compatible with any release

- Image Processing and Computer Vision > Image Processing > Image Segmentation and Analysis > Image Segmentation >
- Image Processing and Computer Vision > Computer Vision > Deep Learning, Semantic Segmentation, and Detection >
- AI, Data Science, and Statistics > Statistics and Machine Learning > Dimensionality Reduction and Feature Extraction >

**Inspired:**
Face detection with Active Shape Models (ASMs), Shape Model Builder

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!Create scripts with code, output, and formatted text in a single executable document.

Jayanti DasHow to identified coordinates of the facial pts in final image? Please help me.

Sidra Ashrafwhen i run the example 2d file, it gives errors in the "cd" function. please help me tosolve this problem. i will be really thankful to you.

Error:

Error using cd

Cannot CD to InterpFast_version1 (Name is nonexistent or not a directory).

Error in ASM_2D_example (line 17)

cd([functiondir 'InterpFast_version1'])

Sidra AshrafShall the files run separately or link the files??? how I train them??

Yasser ElhouderiThank you very much!!

I just have one question, where can I find the paper that proposed or mentioned using the Eigenvalues and Eigenvectors to calculate the best match instead of Mahalanobis distance. In function "ASM_ApplyModel2D"

"bc = PCAData(j).Evectors'*(gi-PCAData(j).Emean);

bc = bc./(sqrt(PCAData(j).Evalues));

f(i,j)=sum(bc.^2);"

zzm oliverIn ASM_getProfilesAndDerivatives2d.m have two lines:

xi(xi<1)=1; xi(xi>size(I,1))=size(I,1);

yi(yi<1)=1; yi(yi>size(I,2))=size(I,2);

Is this mistaken? X should correspond to the width,which is size(I,2). Y should corresponds to the height,which is size(I,1)

So is this mistaken?

halilthe 3d does not run

halilHi

I run the 2d example with almost no problem, but when running the AAM_3D_train_Example.m (and after installing the MinGW64 compiler), I receive this message

Error using mex

C:\Users\k\AppData\Local\Temp\mex_62428655287349_2380\polygon2voxel_double.obj:polygon2voxel_double.c:(.text+0x6c):

undefined reference to `max'

and

C:\Users\k\AppData\Local\Temp\mex_62428655287349_2380\polygon2voxel_double.obj:polygon2voxel_double.c:(.text+0xb5):

undefined reference to `min'

collect2.exe: error: ld returned 1 exit status

I checked it the

cd([functiondir 'polygon2voxel_version1j'])

works, so it should not be a problem with the path.

Please advise.

xing chanCannot perform an assignment because the index on the left is incompatible with the size on the right

error: ASM_MakeShapeModel (line 19)

x(:,i)=[TrainingData(i).centerx TrainingData(i).centery]';

my e-mail 17791573200@163.com

Julia de LangeHi,

Thank you for your code.

Just one question, in making the the shape model, shouldn't the PCA be applied to the covariance matrix of training data???!

In your code it's applied to the raw training data matrix!

Thanks

Adithya Chakilamhii.....

I met an error:

??? Undefined variable "p" or class "p.x".

Error in ==> efface at 21

pointsx=interp(p.x,r); pointsx=pointsx(1:end-r+1);

plz help me out

Ozan KARAHANJoão Antônio Chagas Nunesbob Esmailpouryohann Le BourloutThank you for the code ! I have some trouble for the 3D version with the "patchnormals". Says that it request (17179869184.0GB). Did someone figure out this bug ?

FrogInHotthank you for your code。i have a question ,where is the function named bspline_transform() and point_registration() in file AAM_Appearance2Vector2D.m？thanks。

Feifei Zhouyangyang yangM ArmengolHello @Chee Khong Liong what's the name of the function that creates the .mat file to get p?

Juan Alberto Antonio VelazquezHi, thank you for your code, my problem is the next, I would like to work with people pictures and and get the complete outline of the person with the algorithm but I have problems with the file train000.mat since it corresponds to the data obtained from the outline of the hand. Could they help me find the coordinates of any object? Thank you very much

Champa Srinidhi Ragunathanchee khong Liongwhoever wants to know how to create .mat file, there is a file can create it in 'function' folder.

dphamHi, thanks for sharing your code.

Regarding the 2D ASM implementation,

you use minimal PCA parameters using the intensities to calculate a distance instead of the originally proposed Mahalanobis distance in the search step (if options.originalsearch is set to true).

Could you provide a reference to the paper describing this approach?

As far as I understand this does not seem to be Ginneken's approach =).

Kind regards and thanks again for uploading your code =) !

NeffatiYanrong ChenThanks for your code! But I have trouble with the mex. Could you please tell me which version of MATLAB and compiler you guys use?

Sana khanHello all !

I am working on a project for which I have to segment Disc regions of lumbar sine using ASM from MRI images. Can anyone help me out that what changes I should made for making this code usable for my project.

Thanks in advance.

Sana khanHI

I am trying to use this ASM model for creating a model of MRI image of lumbar spine and segment the disc regions. please i cant understand this coding.kindly explain it.

Yong ShiIs this the source code for the Tom algorithm?

yameifang fangd

Igor OliveiraIn the file "train001.mat" there is a structure "p". What does parameters "t" (1x100) and "l" (500x750) of this structure mean?

everton skeikaPlease,can any one help me with how to make the .mat file for the new training image?

Yihao XiaI have same question about how to make the landmark and refsurface for the training of 3D ASM model. Is there anyone know how to get it?

shanshan zhuHi,i have used the statismo software building a shape model,now i want to use this model to segment the target surface(my shape model is 3D),how can i use your code to implement the searching scheme???And which part of your code implement the searching schemeand model fitting???

Thanks very much!

shanshan zhuNinaHi, I am trying to run the example of AAM_3D_train_example.m with my dataset.But I don't know how to get the Landmark and RefSurface. Anyone knows ?

Alice WangMahmoud KhattabThank you very much.

I have the same question about how can i make my datasets (.dcm) like the used dataset. and how can i generate the same number of faces with each of the dataset

Fadzil Hassani have the same question as below: How can i use this code to train my own dataset?

Thanks a lot!

Beulah AHow can i use this code to train my own dataset? how to start from the scratch. My email : beulah.arul@gmail.com

Thanks a lot!

Xuefeng PengHey, is there anyone who used this code know what does the E_init in AAM_ApplyModel2D.m means? Besides, how could I check the whether the final result is converged or not. i.e what variable should I check to decide convergence.

By the way, "mean point position error" is mentioned in the paper of "Active Appearance Models" fromT.F. Cootes, G.J Edwards, and C,J. Taylor, anyone knows how to compute it?

Thanks very much!

kamelHow can I obtain the same number of vertices and faces from 2 binary volumetric images?

Dear Mr, Kroon,

Thanks for his project codes:

http://www.mathworks.com/matlabcentral/fileexchange/26706-active-shape-model--asm--and-active-appearance-model--aam-

I have a question about how to create the simulation data in the 3D ASM and AAM algorithm. I have some segmented 3D volume (brain mask from volumetric MR images) but as I see for 3D examples that all the Jaw volumes have same number of triangles (vertices and faces).

I used Matlab commands :

[F1 V1] = isosurface (mask 1,0)

[F2 V2] = isosurface (mask2,0)

but in these cases the number of vertices (V1 and V2) are different even for faces. I am just wondering how may I generate the same number of triangles for each images volumetric binary image.

Thanks

Silvia WognumUpdate on my earlier question below.

It appears that all the following toolboxes are required to make the 2D example work (in newer versions of Matlab?):

•Image Processing Toolbox

•Statistics and Machine Learning Toolbox

•System Identification Toolbox

•Control System Toolbox

•Signal Processing Toolbox

M. Imadhouh I can get the shape parametre?

Julian WesleyHi there, I've seen some materials (e.g. train001.mat, train002.mat, etc) in these tool and yet I still have no idea how to get it, could anyone tell me how to do it?

Thanks before :)

Cheng ZHANGThanks so much for this program! It runs almost perfectly with my data except for a small problem when choosing the initial position to apply the method. A correct roration of the statistical model on the image is essential which influence the result a lot. But when chosing the initial position manually, the function ASM_align_data2D won't allow chaning the rotation, cause it has been defined based on the barycenter of the model:

% Center data to remove translation

offsetv = -mean(Vertices,1);

% offsetv=barycentre(Vertices);

Vertices(:,1) = Vertices(:,1) + offsetv(1);

Vertices(:,2) = Vertices(:,2) + offsetv(2);

This function works perfectly in the training phase because our data have similar shapes, therefore similar barycenter and rotation along it, although the result displayed are up side down. So I added/modified this function ASL_align_data only in the 'application' part. More precisely, I changed the line 105 in ASM_2D_example.m:

pos=ASM_align_data_inverse2D(pos,tform);

to pos=ASM_align_data_inverse2D_selectpos(pos,tform,roAngle):

defined as follow:

function pos=ASM_align_data_inverse2D_selectpos(pos,tform,roAngle)

% Correct for rotation

rot = atan2(pos(:,2),pos(:,1))+roAngle %pi/2 for example depending on your subject;

rot = rot-tform.offsetr;

dist = sqrt(pos(:,1).^2+pos(:,2).^2);

% *tform.offsets;

pos(:,1) =dist.*cos(rot);

pos(:,2) =dist.*sin(rot);

pos(:,1) = pos(:,1) - tform.offsetv(1);

pos(:,2) = pos(:,2) - tform.offsetv(2);

Hope this helps those who have this rotation issue. And again thanks very much for this program!!!

Jay changeSilvia WognumWhen running the 2D example of ActiveModels_version7, I get an error message:

Undefined function or variable 'interp'.

Error in LoadDataSetNiceContour (line 21)

pointsx=interp(p.x,r); pointsx=pointsx(1:end-r+1);

Error in ASM_2D_example (line 60)

[Vertices,Lines]=LoadDataSetNiceContour(filename,options.ni,options.verbose);

Could it be that the function "interp" doesn't exist in Matlab 2015?

Instead, I tried to use the results of the asm example of creating the training set, but failed.

I hope you can help me solve this problem. I would like to use this example in my lecture on active shape models.

Silvia

Andres Cristancho¿Para utilizarlo en imagenes MRI del tracto vocal necesito solo MATLAB o tambien necesito un compilador de archivos .C?

Lungile MtetwaHi, I am trying to run the example of AAM_3D_train_example.m please advise which code i need run first, as i get can not find path error.

Shantanu BanikHi,

Thank you so much for this nice tool. I am trying to use it in 3D and test it on my dataset. I have some segmented 3D volume but as I see for 3D examples that all the Jaw volumes have same number of triangles (vertices and faces). I am just wondering how may I generate the same number of triangles for each images for training?

Shantanu Baniktareq AltalmasError using load

Unable to read file 'lips/train001.mat'. No such file or directory.

Error in LoadDataSetNiceContour (line 17)

load(filename);

always i got that error

help me please

juned khanwhenever i m running ASM_3D_Train_example is giving linking error.'unable to connect '

max32 error

Plz help me out

Richa Sharmacan any one help me with how to make the .mat file for the new training image?

simin asHi

.I need some help urgently. I have been trying to implement the AAM_2D_example model for prostat MRI images.The following error was encountered.

Please help me.

Error using -

Matrix dimensions must agree.

Error in AAM_align_data2D (line 25)

offsetr=-mean(rot-rotb);

Error in AAM_MakeShapeModel2D (line 19)

[TrainingData(i).CVertices, TrainingData(i).tform]=AAM_align_data2D(TrainingData(i).Vertices,MeanVertices);

Error in AAM_2D_example (line 82)

[ShapeData,TrainingData] = AAM_MakeShapeModel2D(TrainingData,options);

dpappuInesHi!

I have seen that the effect of varying parameters for appearance normalization is not included in AAM_MakeSearchModel.m. Why? Thanks in advance!

zhixiangHi!

There are somethings wrong about the results.Can you tell me how to promote the code?Thank you!

subhaHi

I am doing my project in lung nodule segmentation. I have to the segment lung alone, for that i am using ASM model. What is the value that i have to use for vertices? Thanks in advance.

HEMALATHA PHI

I am trying to use this ASM model for creating a model of knee image.please i cant understand this coding.kindly explain it.

AnumHello all !

I am using this code for the lung segmentation of xrays by defining my own landmark points but getting following error :

Subscripted assignment dimension mismatch.

Error in ASM_MakeShapeModel2D (line 20)

x(:,i)=[TrainingData(i).CVertices(:,1)' TrainingData(i).CVertices(:,2)']';

Error in ASM_2D_example (line 82)

[ShapeData TrainingData]= ASM_MakeShapeModel2D(TrainingData);

Can anyone help me out where I am doing wrong ?

AnumHello all !

I am working on a project for which I have to segment lung regions using ASM from chest xrays. Can anyone help me out that what changes I should made for making this code usable for my project.

Thanks in advance.

Wang HongyuThank you very much for the sharing.I hanve a question about how to create the simulation data in the 3D ASM algorithm(eg:V 400*400*352 logical).

Thanks again.

si weiHello all,I learned a lot for this model.But when I use this model for face property,It didn't works well.I didn't change the model.Are there any changes in the model?Thanks a lot.

Faniya MokhayeriLianliHi all, I am a bit confused about the use of "face" property. Why specify contour points (vertices) will not suffice? Many thanks!

HarleyHarleyLucaHi,

is it possible to train the software for multiple contours eg. face countour + nose countour?

TaoufikI need ASM for detection points on the frontal face recognition. I will use for facial expression recognition. My email is: taoufik.tba@gmail.com

Thanks a lot!

Sorath AsnaniHello all. I tried ASM_2D_example.m

It is working perfectly. When I tried it for my own training data set (Images of Guns), after showing the gun images with landmark points upto figure 4, i got the following error.

Subscripted assignment dimension mismatch.

Error in ASM_MakeShapeModel2D (line 19)

x(:,i)=[TrainingData(i).CVertices(:,1)' TrainingData(i).CVertices(:,2)']';

Can anyone help me to resolve this issue?

nguyenTangthanks for your sharing, but there are 2 bugs as I run:

1 function SelectPosition doesn't correspond sometimes, keeping running: while(~data.done), pause(0.1); data=getMyData(); end

2 DrawContourGui get contours perpendicular with real images.

Chaw Thim VaiHi everyone here, I am new to this image processing topic. I executed this program "AAM_2D_example.m" and there are some errors. I don't know how to solve it. Is anyone here can help me? Thanks

Error using zeros

Out of memory. Type HELP MEMORY for your options.

Error in AAM_MakeSearchModel2D (line 6)

drdp=zeros(size(ShapeAppearanceData.Evectors,2)+4,6,length(TrainingData),length(AppearanceData.g_mean));

Error in AAM_2D_example (line 154)

R=AAM_MakeSearchModel2D(ShapeAppearanceData,ShapeData,AppearanceData,TrainingData,options);

Andre AgustinHi, I'm very new to this and image processing in general but I'm interested in using aam for object recognition/segmentation. It's quite amazing for me and so far AAM_ApplyModel2D works but when it goes to piecewise linear transformation (cp2tform) something goes wrong

it gives this error

'At least 4 non-collinear points needed to infer piecewise linear transform.'

The objects that I was trying to detect were eyeglasses with 7 training images.

Ehsan golkI encounter this error after applying for my own 3D training data please help me:

Error in ASM_align_data3D (line 17)

offsetrxy=mean(rotB-rot);

Error in ASM_MakeShapeModel3D (line 16)

[TrainingData(i).CVertices,

TrainingData(i).tform]=ASM_align_data3D(TrainingData(i).Vertices,MeanVertices);

The vectors of my have different dimensions because using marching-cube create different vertices sizes. please hep me if possible.thanks

fatemehHi everyone,I applied this code on my images but in part of"% Show some eigenvector variations" my shape shown in incorrect direction and then in part "% Apply the ASM model onm the test image" shape moved in incorrect direction.Does anyone know about this?

mohaLauraI would like to use this code with faces (face tracking). Do you know any set of training set images or demo that I can use?

Thanks,

Laura

WONGhello,evertyone.I want to apply this code on 3d segmentation.It works well.The only thing I want to know is how to put the trained shape on a initial position for segmenting like the example for 2d hand.I think it's necessary as updated points positions are limited by PCA.If we don't put the trained shape on a initial position like the example for 2d hand,the result should be uncorrect.Thanks.

TU Darmstadt@All with out of memory issues:

This happens because in AAM_MakeSearchModel the variable drdp is 4D, you can just split it into smaller matrices, such as i did it in 2 3D matrices,and did averaging by adding and dividing instead of using mean and squeeze function. Because in the end you are using this drdp for the calculation of matrix R which is 2D

Yiping@Ardeal

Hi, I had the same error as yours, when it tried to allocate a matrix of 13*6*10*468249 = 365234220 double precision values.

I've added a "single" parameter to the "zero" statement that make it use single precision values instead, and it uses approx. 1.3GB of memory now. Before the change it might take 2.6GB, which will cause a "Out of memory" on my PC.

I don't know whether this change will have an impact on accuracy.

Regards.

ArdealHi, All,

when I run the code without any changes after I download it, I get the following error messages:

??? Error using ==> zeros

Out of memory. Type HELP MEMORY for your options.

Error in ==> AAM_MakeSearchModel2D at 6

drdp=zeros(size(ShapeAppearanceData.Evectors,2)+4,6,length(TrainingData),length(AppearanceData.g_mean));

Error in ==> AAM_2D_example at 154

R=AAM_MakeSearchModel2D(ShapeAppearanceData,ShapeData,AppearanceData,TrainingData,options);

The RAM of my PC is 4GB, and I have already enlarged the virtual RAM to 3G. I think I have enough memory.

why did that error happen still?

Le HienMing Jingoodwork, thanks

liao luluhow can i use the ASM_2D_example.m to train my own shapes? my email : 378483809@qq.com

thanks a lot!

Zuying Wois this sample permitted in commercial use or any development for some commercial purpose?

IsabelJack Sparrowsnoorwal NoorwaliHi

I ran the "AAM_2D_example" in my MAC computer

it is work but it is stuck in some point ! ... I just see the 7 Figures that apeares then it is stuck I am not sure why !!

I have question , how can I implement this code to work in something else (segmenting the vertebra for example)

snoorwal NoorwaliHi

I ran the "AAM_2D_example" in my MAC computer

it is work but it is stuck in some point ! ... I just see the 7 Figures that apeares then it is stuck I am not sure why !!

I have question , how can I implement this code to work in something else (segmenting the vertebra for example)

LIU WEIHUAhuangainleuh-89j ia pas compris le principe de asm si quilqun m'idee pour comprendre le principe d asm

AnaDear all,

can any one help me with how to make the .mat file for the new training image for 3D?

LaceyDoes anybody have code to apply this to face images? I'm looking to use it to extract the full contour of a face. I can't seem to get the model trained properly. It is always too far rotated one direction or the other, but my training images are all well aligned.

MingVery Good

saman abdananHi

could you please explain to me why you plus and minus 0.5 to the following line of ASM_MAkeAppearanceModel2D

% Get the pixel profiles of every landmark perpendicular to the contour

for i=1:s

P = (TrainingData(i).Vertices-0.5)*scale+0.5;

Cheers

shwetaHi all,

I need some help urgently. I have been trying to implement the AAM_2D_example model for fetal ultrasound images. It works perfectly for some training data but generates the below mentioned error in other data sets. I am of the opinion if it is so because of change in image scales for the training sets. So i ran the code for certain similar scale images too still i get stuck sometimes with this error. Although I have made the contours keeping the number of major Landmarks same across all the training images. Please will be grateful if any one of u could give some suggestion to get rid of this error.

??? Error using ==> minus

Matrix dimensions must agree.

Error in ==> AAM_align_data2D at 25

offsetr=-mean(rot-rotb);

Error in ==> AAM_MakeShapeModel2D at 19

[TrainingData(i).CVertices,

TrainingData(i).tform]=AAM_align_data2D(TrainingData(i).Vertices,MeanVertices);

Error in ==> AAM_2D_US at 95

[ShapeData,TrainingData] = AAM_MakeShapeModel2D(TrainingData,options);

Also does the training contours drawn using DrawContourGui need to have same number of major land marks and have to have closed loops?

Will be looking forward to some early replies.

Thanks

shwetaManoj MuraliSee the image with feature points or landmark points marked on an image as shown in the link below:

https://picasaweb.google.com/lh/photo/0m11XI7aPFzIRvmGyw7OhOI260_aDNLmtwkl29F-3tA?feat=directlink

Now my problem is that I need to write a program which could identify and plot the landmark points on any face image given as the test/input image to the program.I think we need to first train the program with a set of database images with the land mark points.Then I need to use some logic to exactly fit those points on the specific positions in the input image to identify the feature points on the face.So frns how to do this program.What methodology cud be used to do this coding.I need some suggessions..

Manoj MuraliFriends my project is to perfom what is shown in the below youtube link using Matlab.Plz help me how to start form the begiining from creation of databases step by step..plz help me..

http://www.youtube.com/watch?v=94_8qhJXE8o

Long@amany

The error proclaimed itself: your computer does not have enough memory. Try a better computer.

amanyhi everybody >>> i need help plz,,,,

i get this error when i applied ASM_3D_train_example.m:

Error using ==> rand

Out of memory. Type HELP MEMORY for your options.

Error in ==> ASM_3D_train_example at 62

I=single(V)-0.5*single(imerode(V,ones(5,5,5))); I=I+rand(size(I))*0.1;

and get the same on applying AAM_3D_train_example.m

i used matlab 2009a and visual studio 2008

RIn 2D DrawContourGui works, does anyone has a solution how a trainingset can be created for a 3D dataset?

Rexample=training dataset

researcherto robert,and any one needs to apply this program on his own images, you should use DRawContureGui.m to get the mat file. you will find the program in functions folder.

save the mat files and use them in the example program.

robertDear all,

can any one help me with how to make the .mat file for the new training image?

ChenIn the file ASM_align_data2D.m, the position and rotation are considered during aligning the training set, but the scale is not considered. It seems that the align process is simplified very much.

SHAHENAAZ SHAIKIf anyone has applied it for face recognition please share the code. It will be much appreciated.

Filka YanevaDear Fati,

I have the same quenstion. Did you get some answer?

Thank you very much,

Filka

Fatima laghrafiDear all,

Ineed facial expression recognition AAM or ASM ? how can I use this code to train my own databse?.

my email : fati.laghrafi@yahoo.fr

Thanks in advance.

Fati

Fatima laghrafiDear all,

Can I use this demo for Facial expression recognition? If so, could you please specify what parts need to be modified ?.

Thanks in advance.

Naved

Rayalps jiaDear all

when I was running "ASM_2D_example.m",

I have some questions about "ASM Functions\ASM_ApplyModel2D.m ":

In the file

code number:66-70

"for k=1:size(Itest,3),

coffset=(k-1)*(2*options.k+1);

coffset2=(k-1)*(options.ns*2+1);

gi(1+coffset:2*options.k+1+coffset)=gt(i+coffset2:2*options.k+i+coffset2,j);

end"

I have made some changes about "coffset2" as follows:

coffset2=(k-1)*((options.k+options.ns)*2+1);

But it does not get a correct resoult,

So I want to know how to align "gt",

thanks.

marshmallowI need a Face recognition model too, how could I train my own face as dataset? my email is: harp_moon1003@yahoo.com.hk

Thanks a lot!

SrirajAnybody tried this code for Face recognition pls share Face shape model with me at chinta.sriraj@gmail.com

divyahello

Thanx for d project.you have done a great job.i am doing my thesis on sign language recognition. i have segmented the hand and done with fingertips detection and tracking.i want to do feature extraction using PCA(principal component analysis). please suggest me which features should i take to match signs and how to do this. I shall be very thankful to you

yayunThanks!

When I executed the ASM_2D_example.m, I got this information

"can't find interp2fast_double.mexw32.manifest" , and I check the folder, it only produced a file called interp2fast_double.mex not interp2fast_double.mexw32.manifest, so how can I do to solve this problem? By the way, my computer system is Windows7 and Matlab version is (R2009b)7.9.0.

Thank you very much!!!

shruti saraswatHello,How can we rotate the landmarking image? is there any coding or just a key function? Please help me..as I am learning this landmarking.

Jiahao QiuJiahao Qiu??? Referance to non-existent field 'offsetv'.

Error in ==>AAM_align_data_inverse2D at 15 Vertices(:,1) = Vertices(:,1)-tform.offsetv(1).

Error in==>AAM_2D_example at 188

pos = AAM_align_data_inverse2D(pos,tform)

How can i maintain the code,which will run successully?

Jiahao QiuDear Mr, Kroon,

When i run the 'AAM_2D_example.m' on matlab 2010a,the command window shows 'compile c-files failed :example will be slow'.How can i compile c-files successful?

Thanks in advance.

samia dopplease i need a help i need just someone how can send me training data wich he used just 10 images tks for all

fpuspitasarihi, when training the data, should the image contour be located in roughly the same location? what if I have several hand images with different orientation, e.g. horizontal and 45 degree angle. should I do some pre-processing before training the data. thanks

samia dopfirst u choose ur image for example u do that:

im2=lirimage;u read ur training data then u save it

save('samia','im2');ur training data now is called samia.mat

Pasindu AbeysunderaHow do we create the .Mat files in the training data. Can some one please enlighten me?

samia dopWhen I execute either ASM_example.m or AAM_example.m

I met an error:

??? Undefined variable "p" or class "p.x".

Error in ==> efface at 21

pointsx=interp(p.x,r); pointsx=pointsx(1:end-r+1);

ZhengI read the code again. I find that the function AAM_NormalizeAppearance.m is used to compensate for illumination, and plays the similar role to the texture transform parameter u.

ZhengThe classical aam model contains three parts of paramters: c,t,and u. u is the texture transformation. But in the function AAM_MakeSearchModel.m, u is not included. Why? and how to include it?

Munie AhmadHi SDU, now it works perfectly! Thank u so much for your solution :)

sduHi,Munie Ahmad,I meet the same trouble like yours.I do this like below:Add the function'save' after AppearanceData.It you want to use training data, then 'load'.

AppearanceData = ASM_MakeAppearanceModel(TrainingData,options);

save('Model.mat','AppearanceData');

load('Model.mat');

Munie AhmadHi there, I've tried with my image database (chest x-ray, for lung segmentation), it works, many thanks! But how can I run the algorithm for batch processing without repeating the 'training process'? Thank u in advance..

sduWith my training data,It works,Thank you!

Joy KingI'm using ASM and AAM to train and segment carotid ultrasound images. ASM_example.m works very well, But when I execute AAM_example.m, I met an error:

??? Error using ==> cgprechecks at 47

Not enough unique points specified.

Error in ==> delaunayn at 48

cgprechecks(x, nargin, cg_opt);

Error in ==> delaunay at 50

tri = delaunayn([x(:) y(:)]);

Error in ==> PreProcessCp2tform at 43

tri = delaunay(xy(:,1),xy(:,2));

Error in ==> AAM_Appearance2Vector at 20

[xy uv]=PreProcessCp2tform(xy,uv);

Error in ==> AAM_MakeAppearanceModel at 32

g(:,i)=AAM_Appearance2Vector(TrainingData(i).I,TrainingData(i).x,TrainingData(i).y, base_points,

ObjectPixels,options.texturesize);

Error in ==> AAM_example at 90

AppearanceData=AAM_MakeAppearanceModel(TrainingData,ShapeData,options);

If I use your dataset, it works very well. I really don't know why, hoping you can help me or give directions. Thanks in advance.

Saidanithesis a good work

can i use this work for face base

if yes how

please help me

mirsHere is maybe the solution

http://www.mathworks.com/support/solutions/en/data/1-663J0X/index.html?solution=1-663J0X, by I can´t tell exactly, didn´t try yet.

AgnieszkaHello,

I have the same problem with function DrawContourGui.m. Have anyone knows how to run this function without error. Thanks in advance

mirsThanks a lot! I would like to use your work as a part of my school project, which deals with facial detection (nose, eyes, mouth). For face detection, I am going to use Viola-Jones detector, for it´s parts AAM and ASM. But I have a little problem, when I´m trying to run DrawCountoutGui, there is some kind of bug "Segmentation violation". Could you please tell me, how to run it properly?

Thanks

Best regards

ManuelGreen_AppleI have researched about this.Can you share your code with me for reference, Weiyuan?

Thanks and best regards!

Fettah LightHello,

i want just know how i can get the train.mat from an image, so if u have code source of this function ,can u give it to me

Thanks

With my best regards

NslakshmiAnybody tried this code for Face recognition pls share Face shape model with me at nslakshmiprabha@gmail.com

WeiyuanVery good.

I made some modifications for faces, and it works!! Thanks a lot.

Aakashkickass

Qiang LiExcellent!

I applied it on faces with little revisions:

First, in building of the combine model, 'dpdr' may be too large for a real application. I replaced it by averaging submatrix in the big loop.

Second, 'svds' in pca may cause unexpected mistake... I use svd instead, though it may slower...

A.RahimDear all

I want to apply this script on my own images. Could guide me how I can do this (in which order I should use the function) ?

Muhammad"??? Subscripted assignment dimension mismatch.

Error in ==> ASM_MakeShapeModel at 20

x(:,i)=[TrainingData(i).centerx

TrainingData(i).centery]';"

I am using this code for ear. I trained 10 images of ear. but I am getting this error. can any one help me plzzzz

xudong caovery good!

MofakharulHi,

Do we need to convert screen coordinates into image coordinates? If yes, then how it could be done?

Mofakhar

Iqbal NouyedDear Mr, Kroon,

Can I use this demo for Facial expression recognition? If so, could you please specify what parts need to be modified ? I am trying to train and test it with the data set given with the cootes' aam tools.

Thanks in advance.

Naved

Dirk-Jan Kroon* Zhi

Interp is part of the "Signal Processing Toolbox" of Matlab.

ZhiWhen I execute either ASM_example.m or AAM_example.m

I met an error:

??? Undefined function or method 'interp' for input arguments of type 'double'.

Error in ==> LoadDataSetNiceContour at 21

pointsx=interp(p.x,r); pointsx=pointsx(1:end-r+1);

So where is interp.m?

Dirk-Jan Kroon*ISI Purkait

The size of a dataset will not cause an error. Try to display some in between results, maybe you find the error

Greg BIs it possible to have multiple contours in a model with this program? Imagine two separate eyes or distinct image features that are not connected. If it can't do multiples, I'll just double back when drawing contour lines or attempt to add multiple contour on my own :)

Thanks for the program, I've been looking for it for a long time and it works great!

ISI PurkaitWhy this program is not working for large dataset??....I made some hand images on my own....there are 34 images ....but it's working but texture is not comming well...!!

Ashwith RegoIn the function AAM_align_data.m, you have chosen the base to always be the first shape. According to Procrustes analysis, isn't the base supposed to be the mean of the current set of aligned shapes? Am I missing something in your code or are you using some sort of modified Procrustes analysis which aligns all shapes to the first shape? If it is the latter how much difference would it make in the result?

Ashwith RegoI figured it out. Took me some time to realize what exactly you meant. Thanks a ton again! :-)

Ashwith RegoThanks for your reply.

How do you convert between screen coordinates and image coordinates?

Dirk-Jan Kroon* Ashwith ,

The x and y are indeed the row and column indexes, but if you click the mouse the coordinates are converted from screen coordinates to image coordinates, which gives the .1234 numbers, and also of course the linear interpolation between the landmarks.

The Matrix I, is the training image.

The vector t, specifies if a point is a major well defined landmark (like the top of a finger), or a minor point along an edge.

Ashwith RegoCould you tell me how one selects the landmark points. And how do you set the coordinates of these points? Till now I was under the impression that the coordinates are the row and column indexes of the pixel in the image matrix. I saw x and y having values like 216.8761?

Secondly, for the database of training images, what are vector t and matrix I for? I understand x and y give the coordinates of each point. What are t and I?

This is my first project in image processing so I really have no clue.

Thanks in advance!

M Laddermanthanks