renaming the image after matching the image with other folder in matlab
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
annmaria
am 12 Jul. 2015
Kommentiert: annmaria
am 13 Jul. 2015
I have two folders, In the first folder connected components are present like alphabets and some other components, each are named with 1,2....In the second folder 26 alphabets are present and are named with 1,2,...26. Using pca each elements in the first folder is matched with the second folder. If it does not matched i want to remove it from the folder. If the first element matched with the first element in the second folder then i want to rename the element in the first folder with alphabet A. If it matched with second then rename it as B and so on Is it possible? can anyone give some example for that pls..thanks in advance the code for matching the images is given below
clear all
clc
close all
% You can customize and fix initial directory paths
TrainDatabasePath = uigetdir('D:\Program Files\MATLAB\R2006a\work', 'Select training database path' );
TestDatabasePath = uigetdir('D:\Program Files\MATLAB\R2006a\work', 'Select test database path');
prompt = {'Enter test image name (a number between 1 to 10):'};
dlg_title = 'Input of PCA-Based Face Recognition System';
num_lines= 1;
def = {'1'};
TestImage = inputdlg(prompt,dlg_title,num_lines,def);
TestImage = strcat(TestDatabasePath,'\',char(TestImage),'.bmp');
im = imread(TestImage);
T = CreateDatabase(TrainDatabasePath);
[m, A, Eigenfaces] = EigenfaceCore(T);
OutputName = Recognition(TestImage, m, A, Eigenfaces);
Z=OutputName;
SelectedImage = strcat(TrainDatabasePath,'\',OutputName);
SelectedImage = imread(SelectedImage);
imshow(im)
title('Test Image');
figure,imshow(SelectedImage);
title('Equivalent Image');
str = strcat('Matched image is : ',OutputName);
disp(str)
imshow(im) title('Test Image'); figure,imshow(SelectedImage); title('Equivalent Image');
str = strcat('Matched image is : ',OutputName); disp(str)
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 12 Jul. 2015
Which variable gives the number of the letter/image that it matched? Anyway, you can use movefile() to rename image files . You might also find sprintf() and fullfile() useful.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!