Filter löschen
Filter löschen

get path to all files in a folder of images

49 Ansichten (letzte 30 Tage)
RuiQi
RuiQi am 17 Jan. 2017
Beantwortet: Walter Roberson am 17 Jan. 2017
how do i get the path to my image in a folder ?
% Directory
directory = 'C:\Datasets\nyu\train\';
% Filenames
image_rgb_filenames = dir(strcat(directory,'image_02\','*.jpg'));
image_depth_filenames = dir(strcat(directory,'depth\','*.png'));
Because image_rgb_filenames(1).name returns me the name of the file, not the path to it with the name of the file.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 17 Jan. 2017
% Directory
directory = 'C:\Datasets\nyu\train\';
img_dir = fullfile(directory, 'image_02');
depth_dir = fullfile(directory, 'depth');
image_rgb_info = dir( fullfile(img_dir, '*.jpg'));
image_rgb_filenames = fullfile(img_dir, {image_rgb_info.name} );
image_depth_info = dir( fullfile(depth_dir, '*.png'));
image_depth_filenames = fullfile(depth_dir, {image_depth_info.name} );

Weitere Antworten (0)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by