Borrar filtros
Borrar filtros

Add a xlsx file as target to an image

3 visualizaciones (últimos 30 días)
Gianluigi Mazzaglia
Gianluigi Mazzaglia el 29 de Jul. de 2022
Respondida: Saffan el 14 de Sept. de 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 comentarios
Gianluigi Mazzaglia
Gianluigi Mazzaglia el 29 de Jul. de 2022
the goal is to train a model which will learn what are the points associated to that images
Image Analyst
Image Analyst el 29 de Jul. de 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:

Iniciar sesión para comentar.

Respuestas (1)

Saffan
Saffan el 14 de Sept. de 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!

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by