how to find the euclidean distance between two images

23 ビュー (過去 30 日間)
hp
hp 2017 年 6 月 7 日
移動済み: DGM 2023 年 2 月 20 日
how to find the euclidean distance between two images... and how to compare query image with all the images in the folder. and if there is a statistical data like mean, mode, standard deviation(more than one value) how to collect and where to store, in such a way that it can useful for comparison.
  1 件のコメント
Biruk Fikadu Gizaw
Biruk Fikadu Gizaw 2018 年 5 月 14 日
移動済み: DGM 2023 年 2 月 20 日
In the following arrangement of pixels, what’s the value of the distance between the circled two points using the three distance measurements?

サインインしてコメントする。

回答 (2 件)

Jan
Jan 2017 年 6 月 7 日
編集済み: Jan 2017 年 10 月 21 日
  • Euclidean distance between two images:
Dist = sqrt(sum((image1(:) - image2(:)) .^ 2)); % [TYPO fixed, thanks Sean]
This works if the images have the same size. If now, scale one by linear of Lanczos interpolation.
  • compare query image with all the images in the folder
FileList = dir(fullfile(Folder, '*.jpg'));
Result = cell(1, numel(FileList));
for iFile = 1:numel(FileList)
File = fullfile(Folder, FileList(iFile).name);
Img = imread(File);
... Now compare the current image with the one to be checked
Result{iFile} = ...
end
  • is there is a statistical data like mean, mode, standard deviation(more than one value) how to collect and where to store, in such a way that it can useful for comparison.
This is the wrong direction. You have to determinem, what you are looking for. The forum cannot guess, what is useful for you. Perhaps you want to recognize some vegetables, or intergalactic gas clouds, perhaps colored cows or predict, what will be the fashion for umbrellas in the next year by scanning persons in Paris from a near earth orbit. What are you looking for?
  7 件のコメント
Nur Syarah Hani Ahmad Fitri
Nur Syarah Hani Ahmad Fitri 2020 年 6 月 7 日
HI JAN, i have a file of csv that have the meanPCA and its label of the image now i wanted to do recognition with new input image(going though the same process except the meanPCA of the new image is not there in the csv file yet obviously)
then how to do recognition using eucliden distance by checking the new meanPCA with the values of images that contain in the csv file .
Image Analyst
Image Analyst 2020 年 6 月 7 日
Jan is no longer monitoring this forum because he had some kind of problem with lag in his browser. I'm attaching code to do PCA on an RGB image so maybe you can adapt that. How did you get the mean PCA values in the first place? You might want to start a new question/thread.

サインインしてコメントする。


KSSV
KSSV 2017 年 6 月 7 日
You can compute standard statistics of an image using the mean2, std2, and corr2 functions. mean2 and std2 compute the mean and standard deviation of the elements of a matrix. corr2 computes the correlation coefficient between two matrices of the same size.
  4 件のコメント
Jan
Jan 2017 年 6 月 7 日
std2(images(i).name)
The standard deviation over the characters of the file name?
hp
hp 2017 年 6 月 7 日
編集済み: Walter Roberson 2017 年 10 月 19 日
I have below code ...
using below code , query an image... and it should return set of similar images as of query image (i am having matlab7 version)
how to do it...
function colorMoments = colorMoments(image)
% input: image to be analyzed and extract 2 first moments from each R,G,B
% output: 1x6 vector containing the 2 first color momenst from each R,G,B
% channel
[filename,pathname]=uigetfile({'*.jpg';'*.png';'*.tif';'*.bmp'},'File Selector');
image=imread([pathname,filesep,filename]);
% extract color channels
R = double(image(:, :, 1));
G = double(image(:, :, 2));
B = double(image(:, :, 3));
% compute 2 first color moments from each channel
meanR = mean( R(:) );
stdR = std( R(:) );
meanG = mean( G(:) );
stdG = std( G(:) );
meanB = mean( B(:) );
stdB = std( B(:) );
% construct output vector
colorMoments = zeros(1, 6);
colorMoments(1, :) = [meanR stdR meanG stdG meanB stdB];
% clear workspace
clear('R', 'G', 'B', 'meanR', 'stdR', 'meanG', 'stdG', 'meanB', 'stdB');
end

サインインしてコメントする。

カテゴリ

Help Center および File Exchange3-D Volumetric Image Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by