calling a sequence of images for processing

조회 수: 1 (최근 30일)
Harry
Harry 2013년 7월 15일
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??

채택된 답변

Matt J
Matt J 2013년 7월 15일
Perhaps you meant
num = num2str(k - 1);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by