保存各种角点检测算法在变换下的角点坐标

function Result=savedetecttxt()
 close all
 clc
 tic

Result=[];
methodfilename='hedetecttxt';
for cnt =5:21
cnt
% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Rotation
% %rotation transformation,from -90°to 90°,at 10° apart,excluding 0°
% 
for angle=0
    commonpath=strcat(num2str(cnt),'_r_',num2str(angle));
    picpathname=strcat('changeimages8904/', commonpath,'.jpg')
    f=imread( picpathname);
%     imshow(f);
    f=rgb2gray(f);
        [corners]=bhe(f);
     fid=fopen(strcat(methodfilename,'/', commonpath,'.txt'),'wt'); %写入的文件名
     [m,n]=size(corners);
      for i=1:1:m
      for j=1:1:n
       if j==n
       fprintf(fid,'%g\n',corners(i,j));
       else
       fprintf(fid,'%g\t',corners(i,j));
       end
      end
      end
    fclose(fid);

end
% 
for angle=-90:10:-10
      commonpath=strcat(num2str(cnt),'_r_',num2str(angle));
    picpathname=strcat('changeimages8904/', commonpath,'.jpg')
    f=imread( picpathname);
%     imshow(f);
    f=rgb2gray(f);
        [corners]=bhe(f);
     fid=fopen(strcat(methodfilename,'/', commonpath,'.txt'),'wt'); %写入的文件名
     [m,n]=size(corners);
      for i=1:1:m
      for j=1:1:n
       if j==n
       fprintf(fid,'%g\n',corners(i,j));
       else
       fprintf(fid,'%g\t',corners(i,j));
       end
      end
      end
    fclose(fid);

end


for angle=10:10:90
      commonpath=strcat(num2str(cnt),'_r_',num2str(angle));
    picpathname=strcat('changeimages8904/', commonpath,'.jpg');
    f=imread( picpathname);
    imshow(f);
    f=rgb2gray(f);
        [corners]=bhe(f);
     fid=fopen(strcat(methodfilename,'/', commonpath,'.txt'),'wt'); %写入的文件名
     [m,n]=size(corners);
      for i=1:1:m
      for j=1:1:n
       if j==n
       fprintf(fid,'%g\n',corners(i,j));
       else
       fprintf(fid,'%g\t',corners(i,j));
       end
      end
      end
    fclose(fid);

end
% % 
% % 
% % %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% scaling
% % %%uniform and nonuniform scaling transformation,x from 0.5 to 2.0,at 0.1 apart,y from 0.5 
% % %%to 2.0,at 0.1 apart,excluding x=y
% % 
% % 
for scale_x=0.5:0.1:2.0
    for scale_y=0.5:0.1:2.0
            if scale_x~=1 ||scale_y~=1 
                
           commonpath=strcat(num2str(cnt),'_s_',num2str(scale_x),'_',num2str(scale_y));
           picpathname=strcat('changeimages8904/', commonpath,'.jpg');
        f=imread( picpathname);
%         imshow(f);
        f=rgb2gray(f);
        corners=bhe(f);
        fid=fopen(strcat(methodfilename,'/', commonpath,'.txt'),'wt'); %写入的文件名
     [m,n]=size(corners);
      for i=1:1:m
      for j=1:1:n
       if j==n
       fprintf(fid,'%g\n',corners(i,j));
       else
       fprintf(fid,'%g\t',corners(i,j));
       end
      end
      end
     fclose(fid);
                                
            end
    end
end
% 
% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    Affine
% %combined(affine) transformation,angles range form -30°to -30°;x,y from 
% %0.8 to 1.2,at 0.1 apart,y from 0.8 to 1.2,at 0.1 apart,excluding x=y
angle_array=[-30 -20 -10 10 20 30 ];
for i=1:6
    angle=angle_array(i);
    for scale_x=0.8:0.1:1.2
        for scale_y=0.8:0.1:1.2
            if abs(scale_x-scale_y)>1e-3
                if scale_x~=1 ||scale_y~=1 
                     commonpath=strcat(num2str(cnt),'_a_',num2str(angle),'_',num2str(scale_x),'_',num2str(scale_y));
           picpathname=strcat('changeimages8904/', commonpath,'.jpg');
        f=imread( picpathname);
%         imshow(f);
        f=rgb2gray(f);
        [corners]=bhe(f);
        fid=fopen(strcat(methodfilename,'/', commonpath,'.txt'),'wt'); %写入的文件名
     [m,n]=size(corners);
      for i=1:1:m
      for j=1:1:n
       if j==n
       fprintf(fid,'%g\n',corners(i,j));
       else
       fprintf(fid,'%g\t',corners(i,j));
       end
      end
      end
     fclose(fid);
                    
                end
            end
        end
    end
end
% 
% 
% 
% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Jpeg
% %%Jpeg lossy compression ,quality factors range from 5 to 100,at 5 apart
% 
% 
for quality_factor=5:5:100
      commonpath=strcat(num2str(cnt),'_j_',num2str(quality_factor));
           picpathname=strcat('changeimages8904/', commonpath,'.jpg');
        f=imread( picpathname);
        f=rgb2gray(f);
        [corners]=bhe(f);
        fid=fopen(strcat(methodfilename,'/', commonpath,'.txt'),'wt'); %写入的文件名
     [m,n]=size(corners);
      for i=1:1:m
      for j=1:1:n
       if j==n
       fprintf(fid,'%g\n',corners(i,j));
       else
       fprintf(fid,'%g\t',corners(i,j));
       end
      end
      end
     fclose(fid);
end
% 
% 
% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   Gaussian
% %gaussian white noise, range from0.005 to 0.05,at 0.005 apart
% 
for noise=0.005:0.005:0.05
          commonpath=strcat(num2str(cnt),'_n_',num2str(noise));
           picpathname=strcat('changeimages8904/', commonpath,'.jpg');
        f=imread( picpathname);
%         imshow(f);
        f=rgb2gray(f);
        [corners]=bhe(f);
        fid=fopen(strcat(methodfilename,'/', commonpath,'.txt'),'wt'); %写入的文件名
     [m,n]=size(corners);
      for i=1:1:m
      for j=1:1:n
       if j==n
       fprintf(fid,'%g\n',corners(i,j));
       else
       fprintf(fid,'%g\t',corners(i,j));
       end
      end
      end
     fclose(fid);
    
end

end
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值