How to call a directory so that the function is applied on images in all folders and sub folders.
Show older comments
Dear Team ,
I thought of implementing my search algorithm in my own system for searching a particular image from a drive. My D:/PHOTOS contains many folders and sub-folders all JPEG images.
I go by this - I extract the features of query image and search for similar images in My D:/PHOTOS drive. I've calculated the features of query image by calling a function 'rgbfeature'. Before searching i need to create a feature database. I'm facing trouble here, How would i call my function 'rgbfeature' so that it could extract the image features of all images in D:/PHOTOS which contains many folders and subfolders.
My piece of code where i'm facing issues
cd(fileparts(which(mfilename)));
start_path = cd;
topLevelFolder = uigetdir(start_path);
if topLevelFolder == 0
return;
end
allSubFolders = genpath(topLevelFolder);
remain = allSubFolders;
listOfFolderNames = {};
while true
[singleSubFolder, remain] = strtok(remain, ';');
if isempty(singleSubFolder), break; end
listOfFolderNames = [listOfFolderNames singleSubFolder];
end
NF = length(listOfFolderNames);
images = cell(NF,1);
for k = 1 : NF
images{i} = imread(fullfile(listOfFolderNames{k}, topLevelFolder(i).name));
B16{i} = rgbplaneavg(images{i});
end
end
end
My error Message:
??? Improper index matrix reference.
Error in ==> searchsubfolder at 72
images{i} = imread(fullfile(listOfFolderNames{k}, topLevelFolder(i).name));
Kindly request you to guide me .
Regards, Malini
Accepted Answer
More Answers (0)
Categories
Find more on Search Path in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!