labeling a montage image using folder's name
조회 수: 4 (최근 30일)
이전 댓글 표시
i created an imageDataStore with folder's name as label source then i retrieved the best match image for an image that i chose . i want to know how can i write ,in the title, the name of the folder from where the best match image was retrieved.i hope u get the idea and thanks for the help.
the code :
digitDatasetPath = fullfile('c:','users','isbinfos','Desktop','camera');
imds = imageDatastore(digitDatasetPath, ... 'IncludeSubfolders',true,'LabelSource','foldernames');
imageIndex = indexImages(imds);
queryDir = fullfile('c:','users','isbinfos','Desktop','test',filesep);
queryImage = imread([queryDir 'poischiche.jpg']);
imageIDs = retrieveImages(queryImage,imageIndex);
bestMatch = imageIDs(1);
bestImage = imread(imageIndex.ImageLocation{bestMatch});
figure imshowpair(queryImage,bestImage,'montage')
댓글 수: 0
답변 (1개)
KALYAN ACHARJYA
2025년 1월 5일
digitDatasetPath = fullfile('c:', 'users', 'isbinfos', 'Desktop', 'camera');
imds = imageDatastore(digitDatasetPath, ...
'IncludeSubfolders', true, 'LabelSource', 'foldernames');
imageIndex = indexImages(imds);
queryDir = fullfile('c:', 'users', 'isbinfos', 'Desktop', 'test', filesep);
queryImage = imread([queryDir, 'poischiche.jpg']);
imageIDs = retrieveImages(queryImage, imageIndex);
bestMatch = imageIDs(1);
bestImage = imread(imageIndex.ImageLocation{bestMatch});
bestMatchLabel = imds.Labels(bestMatch);
figure; imshowpair(queryImage, bestImage, 'montage');
title(['Best Match Folder:', char(bestMatchLabel)]);
Try it?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!