how to find the euclidean distance between two images
Mostrar comentarios más antiguos
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 comentario
Biruk Fikadu Gizaw
el 14 de Mayo de 2018
Movida: DGM
el 20 de Feb. de 2023
In the following arrangement of pixels, what’s the value of the distance between the circled two points using the three distance measurements?
Respuestas (2)
- 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 comentarios
Sean Hendryx
el 19 de Oct. de 2017
Editada: Sean Hendryx
el 19 de Oct. de 2017
Jan Simon's code is missing a right parenthesis. Here is a working version:
distance = sqrt(sum((image1(:) - image2(:)) .^ 2));
Also, here is function that computes the pixelwise distances, returning a matrix of distances where each entry in the matrix is the distance between image1(i,j) and image2(i,j):
function distanceImage = getEucDistanceImage(image1, image2)
% returns the matrix of Euclidean distances between two images
distanceImage = sqrt(sum((double(image1) - double(image2)).^2, 3));
end
Walter Roberson
el 19 de Oct. de 2017
Euclidean distance for an image would be more like
distanceImage = sqrt( sum(double(image1(:)) - double(image2(:))).^2) )
I suspect for the original purpose, immse() would be a better function.
mohammed abdul wadood
el 2 de Abr. de 2018
Hi, if i have 3d image (rows, columns & pixel values), how can i calculate the euclidean distance between rows of image if i assume it as vectors, or c between columns if i assume it as vectors? thanx
Image Analyst
el 2 de Abr. de 2018
So, is it a regular RGB image? Or do you have an N by 5 2-D matrix of numbers with each row being [x, y, redValue, greenValue, blueValue]? Why do you want this anyway? What do you think it will do for you?
Walter Roberson
el 2 de Abr. de 2018
rowRGB = reshape(RGBImage, size(RGBImage,1), []);
dist_between_rows = pdist(rowRGB);
Nur Syarah Hani Ahmad Fitri
el 7 de Jun. de 2020
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
el 7 de Jun. de 2020
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
el 7 de Jun. de 2017
0 votos
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 comentarios
hp
el 7 de Jun. de 2017
KSSV
el 7 de Jun. de 2017
images = dir('*.jpg') ; % your extenion
N = length(images) ; % total images
iwant = cell(N,1) ;
for i = 1:N % loo for each image
% do waht you want, let iwant be std2
iwant{i} = std2(images(i).name)
end
Jan
el 7 de Jun. de 2017
std2(images(i).name)
The standard deviation over the characters of the file name?
hp
el 7 de Jun. de 2017
Editada: Walter Roberson
el 19 de Oct. de 2017
Categorías
Más información sobre Read, Write, and Modify Image en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!