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
保存各种角点检测算法在变换下的角点坐标
最新推荐文章于 2024-07-18 22:41:15 发布