function dist = getEMDValue(im1, im2)
SF=1/30;
threshold= 10;
alpha_color= 1/2;
coordinates_tranSFormation= 2;
extra_mass_penalty= -1;
flowType= 3;
im1= imresize(im1, SF);
im2= imresize(im2, SF);
im1= double(im1)./255;
im2= double(im2)./255;
im1 = repmat(im1,[1 1 3]);
im2 = repmat(im2,[1 1 3]);
cform = makecform('srgb2lab');
im1_lab= applycform(im1, cform);
im2_lab= applycform(im2, cform);

im1_Y= size(im1,1);
im1_X= size(im1,2);
im1_N= im1_Y*im1_X;
im2_Y= size(im2,1);
im2_X= size(im2,2);
im2_N= im2_Y*im2_X;

P= [ ones(im1_N,1)  ;  zeros(im2_N,1) ];
Q= [ zeros(im1_N,1) ;  ones(im2_N,1)  ];
[ground_distance_matrix]= color_spatial_EMD_ground_distance(im1_lab,im2_lab,...
    alpha_color,threshold, ...
    coordinates_tranSFormation);
[t1 F]= emd_hat_mex(P,Q,ground_distance_matrix,extra_mass_penalty,flowType);
dist = t1;

