我已在computer.I图像文件夹中的BMP图片来自1.bmp命名它100.bmp他们的。所有尺寸为576 * 768加快节能情节人物在MATLAB
我读一个我从一百幅图像中选择矩形区域。矩形区域的像素坐标从垂直方向从182变为281,水平方向从426变为639.我保存了代表矩形中所有像素坐标中图像之间交换像素值的图形区域到另一个文件
我米文件是如下:
pixvalue=zeros(100);
j=1 ;% will represent pixel coordinate sequence
% find pizel coordinates in rectangular region
for y=182:281
for x=426:639
for i=1:100
% read images
s = sprintf('C:\\images\\%d.bmp', i);
A = imread(s);
A=double(A);
pixvalue(i)= A(y,x);
end
s2=sprintf('%d.plot', j);
f=figure('visible','off'),
plot(pixvalue);
xlabel('images');
ylabel('pixvalue');
title(s2);
s3=sprintf('C:\\registration\\%d.bmp', j);
%% save figures as 8 bit bitmap to file
print(f,'-dbmp256',s3);
j=j+1;
end
end
不幸的是,这段代码一直在工作vey vey慢!我如何加速它?
问候......
ufukgun,这里有个问题。 IMREAD返回的图像是2-D(或潜在的3-D)数组。你将不得不将它们存储在一个多维数组或单元格数组中......像这样的二维图像:A(:,:,i)= imread(s); – gnovice 2009-07-21 15:10:25
是的你是对的。但我认为它应该自动将其存储在多维数组中。 实际上,我现在没有在我的电脑上使用matlab,所以我正在回答,因为我记得.. – ufukgun 2009-07-21 15:14:50