Add a xlsx file as target to an image
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi all, my goal is to find a way to merge a list of images in which i want to associate as a label a xlsx file (made by 2 columns of numerical values), is there any way to do this? Thanks in advance
2 Kommentare
Image Analyst
am 29 Jul. 2022
A small example would help explain this to us.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Antworten (1)
Saffan
am 14 Sep. 2023
Hi Gianluigi,
I understand that you have an XLSX file for each image, with the file name being the same as the image file name. To associate each image with its relevant data, you can create a structure that includes the image file location and the coordinates data extracted from the corresponding XLSX file, as shown in the following code snippet:
% Get a list of image files
imageFiles = dir('Z:/images/*.jpg');
% Get a list of XLSX files
xlsxFiles = dir('Z:/data/*.xlsx');
data = struct(); % Initialize the struct to store image location and coordinates
for i = 1:numel(imageFiles)
imageLocation = fullfile(imageFiles(i).folder, imageFiles(i).name);
xlsxLocation = fullfile(xlsxFiles(i).folder, xlsxFiles(i).name);
coordinates = readmatrix(xlsxLocation);
data(i).imageLocation = imageLocation;
data(i).coordinates = coordinates;
end
You can also consider creating an image datastore to read the images and a custom datastore to read the coordinates from the associated XLSX files. This approach allows for efficient handling of large datasets. Please refer to the following documentation for more information:
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Spreadsheets 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!