calling a sequence of images for processing

1 visualización (últimos 30 días)
Harry
Harry el 15 de Jul. de 2013
I have a part of my code shown below which allocates the file name of a sequence of images so that it can be read with the imread command but for some reason it adds a space inside the file name so the name is invalid:
if k ~= 1
if k < 10
num = k - 1;
file_num = strcat('0',num,'.')
else
file_num = strcat(num,'.');
end
image_file_name = strcat(file, image_name, file_num,'jpg');
M = imread(image_file_name);
else
file_num = '00';
end
And it gives me the error:
Error using imread (line 350)
File "C:\Users\bostock_h\Documents\Images\i130614_075_large\i130614_074-1000 .jpg" does not exist.
Error in image_processing_project4 (line 61)
M = imread(image_file_name);
So as you can see there is a break after the file number with a space. But I don't know where it's coming from??

Respuesta aceptada

Matt J
Matt J el 15 de Jul. de 2013
Perhaps you meant
num = num2str(k - 1);

Más respuestas (0)

Categorías

Más información sobre Read, Write, and Modify Image 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