当前位置:[北京同好会]>[编程]>[照片剪裁]

 

火星照片剪裁

在拍摄火星照片后需要用Registax软件做多幅叠加以降低噪声。但该程序对处理的照片尺寸有限制,对3百万像素的照片必须做剪裁,如果用PHOTOSHOP软件处理则费时费力。为此编制MATLAB程序对同一目录下的所有照片自动处理,寻找火星像位置并做剪裁,保存为位图文件。

NFL sports jerseys are a abundant means for any fan to appearance cheap nfl jerseys their abutment for their respected team .cheap nfl jerseys As you attending at the altered available, you ability admiration what some cheap nfl jerseys of your alternatives are as you aswell cheap nfl jerseys activate the seek for one that is cheap nfl jerseys acceptable for you.Typically, 2013 super bowl jerseys you will exchange that NFL sports jerseys cheap nike nfl jerseys are advised as replicas of the official bold jersey your respected players wear. They are fabricated of a college superior nylon allowing the derma beneath them to breathe easily. Best of all,cheap nfl jerseys the faculty superior versions ravens jerseys will endure a continued time acknowledgment to the added material. Over the years,49ers jerseys these jerseys accept become cheap nfl jerseys absolute accepted acknowledgment to the cheap nfl jerseys able followings the teams have. Most break at home admirers like to action the jersey of their respected player, while they acclamation at the bold on nfl jerseys cheap the big screen. Those that do Cheap Nike NFL jerseys accomplish it to the big game, they adore accepting their on to appearance the aggregation they cheap nfl jerseys are admitting and they tend to attending ablaze in a affiliate marketer of hundreds cutting the absolute above mentioned jersey When you are searching at the altered NFL sports jerseys, you will apprehension that they accept a altered appearance 2013 super bowl jerseys depending on gender.cheap authentic jerseys The ones advised nfl jerseys cheap for men are about abutting cut to the close and aggregate cheap jerseys china out in the accept areas Women will exchange a added airy close band that gives them added nfl jerseys china comfort Their options cheap nfl jerseys can be bigger in the chest breadth and smaller in the amateur and sides. There are cheap jerseys china even some risque jersey sources cheap nfl jerseys of the added adventuresome women to wear.

 

MatLab源程序

[2003-10-1]

%火星数码相机照片剪裁

clear
close all

disp('火星图片剪裁');

%处理文件位于同一目录下
[fname,pname] = uigetfile('*.jpg','原始图片目录');

%可更改文件过滤
sdir=dir([pname,'*.jpg']);

[total_pic,x]=size(sdir);

%是否不经重新取样缩小
ndiv=input('缩小:');
if(isempty(ndiv))
ndiv=1;
end


bx=[0,1,0,1];
by=[0,0,1,1];

ftemp=[pname,'temp'];

%可更改输出图尺寸1/4宽
l=150;

for ii=(1:total_pic)

fname=[pname,sdir(ii).name];

s=imread(fname);
fprintf('No.%3d of %3d: %s \n',ii,total_pic,fname);
[h,w,d]=size(s);
s=s(1:ndiv:h,1:ndiv:w,:);

[h,w,d]=size(s);

%生成4个1/4尺寸临时图像
for iii=(1:4)
ims=s(1+by(iii):2:h,1+bx(iii):2:w,:);
imwrite(ims,[ftemp,num2str(iii),'.bmp'],'BMP');
end

%使用红色通道,可更改
clear s;
s=ims(:,:,2);

[h,w]=size(s);

ims=s(1:2:h,1:2:w);

[h,w]=size(ims);

for i=(20:h-20)
for j=(20:w-20)
im0=ims(i-16:i+16,j-16:j+16);
im0=double(im0);
ff(i-19,j-19)=sum(sum(im0));
end
end

[qq,i]=max(ff);
[mm,j]=max(qq);
%极值位置
i00=i(j)+19;
j00=j+19;

i00=i00*2;
j00=j00*2;

clear ims ff;

for iii=(1:4)

s=imread([ftemp,num2str(iii),'.bmp']);

[h,w,d]=size(s);
j0=j00;
i0=i00;

%是否超出边缘
if(j0<l+1)
q=s;
q(:,:,:)=0;
q(:,l+1:w+l,:)=s;
s=q;
clear q;
j0=j0+l;
w=w+l;
end

if(j0>w-l)
q=s;
q(1,w+l,:)=0;
s=q;
clear q;
end

if(i0<l+1)
q=s;
q(:,:,:)=0;
q(l+1:h+l,:,:)=s;
s=q;
clear q;
i0=i0+l;
h=h+l;
end

if(i0>h-l)
q=s;
q(h+l,1,:)=0;
s=q;
clear q;
end

%剪裁
imcp=s(i0-l:i0+l,j0-l:j0+l,:);
clear s
final(1+by(iii):2:4*l+2,1+bx(iii):2:4*l+2,:)=imcp;

end

imwrite(final,[fname,'.bmp'],'BMP');
clear fname;
end

disp('结束');