Azzera filtri
Azzera filtri

Add a xlsx file as target to an image

3 visualizzazioni (ultimi 30 giorni)
Gianluigi Mazzaglia
Gianluigi Mazzaglia il 29 Lug 2022
Risposto: Saffan il 14 Set 2023
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 Commenti
Gianluigi Mazzaglia
Gianluigi Mazzaglia il 29 Lug 2022
the goal is to train a model which will learn what are the points associated to that images
Image Analyst
Image Analyst il 29 Lug 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:

Accedi per commentare.

Risposte (1)

Saffan
Saffan il 14 Set 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!

Categorie

Scopri di più su Convert Image Type in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by