File Exchange

image thumbnail

Active Shape Model (ASM) and Active Appearance Model (AAM)

version 1.5 (15.1 MB) by

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

4.61364
53 Ratings

194 Downloads

Updated

View License

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.

Comments and Ratings (138)

Sana khan

Hello 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 khan

HI
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 Shi

Is this the source code for the Tom algorithm?

yamei

yamei (view profile)

fang fang

d

Igor Oliveira

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

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

Yihao Xia

I 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 zhu

Hi,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 zhu

Nina

Nina (view profile)

Hi, 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 Wang

Thank 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 Hassan

i have the same question as below: How can i use this code to train my own dataset?
Thanks a lot!

Beulah A

How 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 Peng

Hey, 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!

kamel

kamel (view profile)

How 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 Wognum

Update 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

imad ouloul

houh I can get the shape parametre?

Julian Wesley

Hi 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 ZHANG

Thanks 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 change

Silvia Wognum

When 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

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

Hi, 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.

Hi,

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?

Error 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 khan

whenever i m running ASM_3D_Train_example is giving linking error.'unable to connect '
max32 error
Plz help me out

Richa Sharma

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

simin as

Hi
.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);

dpappu

dpappu (view profile)

Ines

Ines (view profile)

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

zhixiang

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

subha

subha (view profile)

Hi
    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 P

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

Anum

Anum (view profile)

Hello 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 ?

 

Anum

Anum (view profile)

Hello 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 Hongyu

Thank 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 wei

si wei (view profile)

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

Lianli

Lianli (view profile)

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

Harley

Harley (view profile)

Harley

Harley (view profile)

Luca

Luca (view profile)

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

Taoufik

I 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!

Hello 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?

nguyen

nguyen (view profile)

Tang

Tang (view profile)

thanks 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 Vai

Hi 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 Agustin

Hi, 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 golk

I 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

fatemeh

Hi 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?

moha

moha (view profile)

Laura

Laura (view profile)

I 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

WONG

WONG (view profile)

hello,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

Yiping (view profile)

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

Ardeal

Ardeal (view profile)

Hi, 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 Hien

Ming Jin

goodwork, thanks

liao lulu

how can i use the ASM_2D_example.m to train my own shapes? my email : 378483809@qq.com
thanks a lot!

Zuying Wo

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

Isabel

Isabel (view profile)

Jack Sparrow

Hi
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)

Hi
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 WEIHUA

huang

huang (view profile)

ainleuh-89

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

Ana

Ana (view profile)

Dear all,

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

Lacey

Lacey (view profile)

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

Ming

Ming (view profile)

Very Good

Hi
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

shweta

shweta (view profile)

Hi 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

shweta

shweta (view profile)

Manoj Murali

See 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 Murali

Friends 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

Long (view profile)

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

amany

amany (view profile)

hi 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

R

R (view profile)

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

R

R (view profile)

example=training dataset

researcher

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

robert

robert (view profile)

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

Chen

Chen (view profile)

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

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

Filka Yaneva

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

Thank you very much,
Filka

Dear 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

Dear 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

Ray

Ray (view profile)

alps jia

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

marshmallow

I 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!

Sriraj

Sriraj (view profile)

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

divya

divya (view profile)

hello
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

yayun

yayun (view profile)

Thanks!

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!!!

Hello,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 Qiu

Jiahao 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 Qiu

Dear 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 dop

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

fpuspitasari

hi, 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 dop

first 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

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

samia dop

When 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);

Zheng

Zheng (view profile)

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

Zheng

Zheng (view profile)

The 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 Ahmad

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

sdu

sdu (view profile)

Hi,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 Ahmad

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

sdu

sdu (view profile)

With my training data,It works,Thank you!

Joy King

I'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.

Saidani

thesis a good work
can i use this work for face base
if yes how
please help me

mirs

mirs (view profile)

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

Agnieszka

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

mirs

mirs (view profile)

Thanks 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

Manuel

Manuel (view profile)

Green_Apple

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

Thanks and best regards!

Fettah Light

Hello,

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

Nslakshmi

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

Weiyuan

Very good.

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

Aakash

Aakash (view profile)

kickass

Qiang Li

Excellent!
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.Rahim

Dear 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 cao

very good!

Mofakharul

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

Mofakhar

Iqbal Nouyed

Dear 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

Dirk-Jan Kroon (view profile)

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

Zhi

Zhi (view profile)

When 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

Dirk-Jan Kroon (view profile)

*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 B

Greg B (view profile)

Is 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 Purkait

Why 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 Rego

In 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 Rego

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

Ashwith Rego

Thanks for your reply.
How do you convert between screen coordinates and image coordinates?

Dirk-Jan Kroon

Dirk-Jan Kroon (view profile)

* 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 Rego

Could 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 Ladderman

thanks

Updates

1.5

Many bugfixes and ASM and AAM optimizations

1.4

Added 3D examples.
Added LinearWarp function

1.3

Added Color support, new edge finding method in ASM, and contour starting point GUI.

1.2

Added the Active Appearance Model

1.1

PCA bug fix.

MATLAB Release
MATLAB 7.10 (R2010a)
Acknowledgements

Inspired: Shape Model Builder

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

AAM Functions/

ASM Functions/

Functions/

InterpFast_version1/

PatchNormals_version1/

PieceWiseLinearWarp_version2/

PieceWiseLinearWarp_version2/functions/

polygon2voxel_version1j/