【发布时间】:2015-01-28 23:12:42
【问题描述】:
对不起,我是新手。我试图复制代码找到here
获得相同的结果,但它不起作用(我的错误)。我无法弄清楚saveas 如何理解必须保存的图像。我读到saveas 想要一个句柄和一个文件名作为输入,而在我在上面链接中资助的代码中,我没有看到这些论点:
saveas(sprintf('img%d.tif',num_picture))
这是我的代码的一小部分:
% Here a loop that transform aeach image inside the variable(cell array) 'immages'
for z = 1:length(immages) %images is a cell array contained the matrices of 100images
temp = immages{z}; %temp means temporary, that is the image to process
for i = 1:I % begin of cycle that process each pixel of the image(tmp)
for j = 1:J
if temp(i,j) == 0
temp(i,j) = 115;
else
temp(i,j) = 140;
end
end
end
cd(finalDest); %move into the directory whre I want to save the new image
figure;
imshow(temp);
saveas(sprintf('img%d.tif',z)); % HOW CAN I SAVE THE CURRENT IMAGE(TEMP) INSIDE 'FINALDEST'?
cd(initialDest); %return to the folder where the original images are contained
end
我遇到这个错误ERROR USING SAVEAS, line55: Requires handle to Figure or block diagram and filename.
非常感谢。
【问题讨论】:
标签: image matlab image-manipulation