how do i compare my test image with the one in my database using euclidean distance?
1 次查看(过去 30 天)
显示 更早的评论
how do i compare my test image with the one in my database using euclidean distance?
0 个评论
回答(2 个)
Akihumi
2020-5-8
编辑:Akihumi
2020-5-8
I assume that you have RGB images.
Do you mean that you want to compute the euclidean distance of the pixes at same location on different images?
If yes, you may try the following
a = imread['image1']; % first image
b = imread['image2']; % second image
c = double(a-b); % difference of each pixel
d = sqrt(c(:,:,1)^2 + c(:,:,2)^2 + c(:,:,3)^2); % compute with formula of euclidean distance
3 个评论
Akihumi
2020-5-9
It is ok to ask here also, so others can also check my answer and suggest/comment on it
Image Analyst
2020-5-9
Try this:
theMean = mean(allArrayValues) % Take the mean of all elements in variable allArrayValues
refMean = mean(yourReferenceArray(:)) % Get mean of reference values.
minValue = min([theMean, refMean]); % Get the minimum of the values.
% No idea what "assign the character to the minimum value" means, but maybe this:
theCharacterValue = minValue; % assign the character to the minimum value
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Database Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!