find the most similar vector from 10 vectors

2 views (last 30 days)
talayeh ghodsi
talayeh ghodsi on 30 Jun 2019
Edited: Stephen23 on 30 Jun 2019
hello every one.
I have one echo image and 10 ct images. i have extract Local binary pattern of them, and i have calculated the squared error between lbp of echo and lbp of each of the 10 ct images. now could anyone answer me how can i find the most similar ct image to echo image from 10 squared errors?
ct124=rgb2gray(imread('4-chamber view124_croped.jpg'));
ct125=rgb2gray(imread('4-chamber view125_croped.jpg'));
ct126=rgb2gray(imread('4-chamber view126_croped.jpg'));
ct127=rgb2gray(imread('4-chamber view127_croped.jpg'));
ct128=rgb2gray(imread('4-chamber view128_croped.jpg'));
ct129=rgb2gray(imread('4-chamber view129_croped.jpg'));
ct130=rgb2gray(imread('4-chamber view130_croped.jpg'));
ct131=rgb2gray(imread('4-chamber view131_croped.jpg'));
ct132=rgb2gray(imread('4-chamber view132_croped.jpg'));
ct133=rgb2gray(imread('4-chamber view133_croped.jpg'));
ct134=rgb2gray(imread('4-chamber view134_croped.jpg'));
ct135=rgb2gray(imread('4-chamber view135_croped.jpg'));
ct136=rgb2gray(imread('4-chamber view136_croped.jpg'));
ct137=rgb2gray(imread('4-chamber view137_croped.jpg'));
ct138=rgb2gray(imread('4-chamber view138_croped.jpg'));
echo=rgb2gray(imread('echo.jpg'));
lbpct124 = extractLBPFeatures(ct124,'Upright',false);
lbpct125 = extractLBPFeatures(ct125,'Upright',false);
lbpct126 = extractLBPFeatures(ct126,'Upright',false);
lbpct127 = extractLBPFeatures(ct127,'Upright',false);
lbpct128 = extractLBPFeatures(ct128,'Upright',false);
lbpct129 = extractLBPFeatures(ct129,'Upright',false);
lbpct130 = extractLBPFeatures(ct130,'Upright',false);
lbpct131 = extractLBPFeatures(ct131,'Upright',false);
lbpct132 = extractLBPFeatures(ct132,'Upright',false);
lbpct133 = extractLBPFeatures(ct133,'Upright',false);
lbpct134 = extractLBPFeatures(ct134,'Upright',false);
lbpct135 = extractLBPFeatures(ct135,'Upright',false);
lbpct136 = extractLBPFeatures(ct136,'Upright',false);
lbpct137 = extractLBPFeatures(ct137,'Upright',false);
lbpct138 = extractLBPFeatures(ct138,'Upright',false);
lbpecho = extractLBPFeatures(echo,'Upright',false);
echoVsct124 = (lbpecho - lbpct124).^2;
echoVsct125 = (lbpecho - lbpct125).^2;
echoVsct126 = (lbpecho - lbpct126).^2;
echoVsct127 = (lbpecho - lbpct127).^2;
echoVsct128 = (lbpecho - lbpct128).^2;
echoVsct129 = (lbpecho - lbpct129).^2;
echoVsct130 = (lbpecho - lbpct130).^2;
echoVsct131 = (lbpecho - lbpct131).^2;
echoVsct132 = (lbpecho - lbpct132).^2;
echoVsct133 = (lbpecho - lbpct133).^2;
echoVsct134 = (lbpecho - lbpct134).^2;
echoVsct135 = (lbpecho - lbpct135).^2;
echoVsct136 = (lbpecho - lbpct136).^2;
echoVsct137 = (lbpecho - lbpct137).^2;
echoVsct138 = (lbpecho - lbpct138).^2;
figure
bar([echoVsct124; echoVsct125; echoVsct126; echoVsct127; echoVsct128; echoVsct129; echoVsct130; echoVsct131; echoVsct132; echoVsct133; echoVsct134; echoVsct135; echoVsct136; echoVsct137; echoVsct138]','grouped')
title('Squared Error of LBP Histograms')
xlabel('LBP Histogram Bins')
legend('echo vs ct124','echo vs ct125','echo vs ct126','echo vs ct127','echo vs ct128','echo vs ct129','echo vs ct130','echo vs ct131','echo vs ct132','echo vs ct133','echo vs ct134','echo vs ct135','echo vs ct136','echo vs ct137','echo vs ct138')
  2 Comments
Stephen23
Stephen23 on 30 Jun 2019
Edited: Stephen23 on 30 Jun 2019
Note that copy-and-pasting code is a sign that you are doing something wrong.
Note that using numbered variables is a sign that you are doing something wrong.
You would be much better of using indexing, exactly as shown in the MATLAB documentation:
talayeh ghodsi
talayeh ghodsi on 30 Jun 2019
is it possible for you to tell me how? could you please rewrite my code in simple way? sorry i am a beginner in matlab

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 30 Jun 2019
Have you tried similarity metrics such as ssim(), immse(), and psnr()?
  1 Comment
talayeh ghodsi
talayeh ghodsi on 30 Jun 2019
sorry but the images are multimodal, i have extract features of images (LBP) and now i want to find the best match features
i have 1 vector of feature from calss A,which is 1*10 against 10 vector of features from calss B each is 1*10
i want to find the best feature vector from class B to be the most similar to feature vector of class A

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!