0
$\begingroup$

I have images for 99 person for each person i have 5 images . i have this function

[similarity] = ssim(img1, img2, K, window, L);where K,window ,L are previously determined with their values.

now , i need to use this function to measure intra-class similarities and inter-class similarities .

i mean i need to measure the similaity within and outside the class and put the results in 2 matrices , one contains the results of similarities within the same classes , and the other contains the results of similarities among the determined class and all other classes.

i wrote this in matlab :

%%%%for intraclass 

K = [0.05 0.05];
window = ones(8);
L = 100;
img1=imread('E:\matlab\images\0001hv1.bmp');
img2=imread('E:\matlab\images\0001hv2.bmp');
img3=imread('E:\matlab\images\0001hv3.bmp');
img4=imread('E:\matlab\images\0001hv4.bmp');
img5=imread('E:\matlab\images\0001hv5.bmp');
[s1] = ssim(img1, img2, K, window, L);
[s2] = ssim(img1, img3, K, window, L);
[s2] = ssim(img1, img4, K, window, L);
[s3] = ssim(img1, img4, K, window, L);
[s4] = ssim(img1, img5, K, window, L);
intra_class=[s1 s2 s3 s4];
histintra_class=hist(intra_class);
plot(histintra_class);title('intra_class');



%%%%for interclass 


K = [0.05 0.05];
window = ones(8);
L = 100;
img1=imread('E:\matlab\images\0001hv1.bmp');
img2=imread('E:\matlab\images\0002hv1.bmp');
img3=imread('E:\matlab\images\0003hv1.bmp');
img4=imread('E:\matlab\images\0004hv1.bmp');
img5=imread('E:\matlab\images\0005hv1.bmp');
[s1] = ssim(img1, img2, K, window, L);
[s2] = ssim(img1, img3, K, window, L);
[s3] = ssim(img1, img4, K, window, L);
[s4] = ssim(img1, img5, K, window, L);
inter_class=[s1 s2 s3 s4];
histinter_class=hist(inter_class);
plot(histinter_class);title)'interclass');

now how can i implement this on all my images automatically , i mean how can i read all images and finding intra and inter class similarities and get automatically the 2 matrices which are inter class and intra class

regards

$\endgroup$
5
  • 2
    $\begingroup$ What's the question? Which part are you having trouble with? Is the function provided to you or do you need to create it? Do you already know which images are in each class? Applying a function to a bunch of inputs and putting the outputs in a table seems straightforward enough. $\endgroup$
    – endolith
    Commented Apr 6, 2012 at 13:34
  • $\begingroup$ @endolith.pleas can you see my edition? thanks a lot. $\endgroup$
    – ruaa
    Commented Apr 6, 2012 at 14:41
  • $\begingroup$ If this is just a matter of "how do I read filenames with a matlab script", it's probably a better fit on stackoverflow.com $\endgroup$
    – endolith
    Commented Apr 6, 2012 at 15:43
  • $\begingroup$ how can i transfer it to stackoverflow.com , and how i can know that this question must be posted at stackoverflow.com??.thanks $\endgroup$
    – ruaa
    Commented Apr 6, 2012 at 23:50
  • $\begingroup$ Is this your final year project perhaps? $\endgroup$
    – user24145
    Commented Oct 12, 2016 at 15:19

1 Answer 1

1
$\begingroup$

From a general perspective, you are trying to take SSIM - which is image difference measure. But it is probably a bad idea if you are looking for measure the intraclass, distance.

You can look at distance measures like Euclidean distance, Mahalonbis distance (if you have co-variance metrics) or others.

As a very simple example : To compute Euclidean distance $L_2$, which is computed between the centroid of the Clusters - as $ Distance = \sqrt{(x_a- x_b)^2 + (y_a- y_b)^2 }$

NOTE: here the dimension are NOT image dimension but are rather the dimension of the feature vector.

I WILL EXPAND THIS ANSWER WITH YOUR SPECIFIC NEEDS.

$\endgroup$
1
  • $\begingroup$ thanks a lot @Dipan.i calculated ecuildean but my goal is to create two functions,the first must calculate similarities among all images for the same person , the second must calculate similarities among all images for the different persons . $\endgroup$
    – ruaa
    Commented Apr 9, 2012 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.