clc;
clear;
rdir='.\result_08\';
Struct_image_dir='E:\研究生数据\结构光\30ml_4_256_struct\30ml_4_256_struct_';%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%装载激光区域提取结果,及没幅图像中激光线条数及每条激光线编号
load([rdir 'Shumu_bianhao_Laser_image.mat']); %%每幅图像中激光线数目及对应编号,Shumu_bianhao_Laser_image(:,1):激光线数目;(:,2):第一条光线编号;(:,3):第二条激光线编。。。。
load([rdir 'Stuct_light_zero.mat']);
rdir=Struct_image_dir;
Reg_Laser_zero=Stuct_light_zero;
Shumu_bianhao=Shumu_bianhao_Laser_image;
for i=1:64;%%%%图像第几幅
ima_laser = imread([rdir num2str(i) '.tif']);
a=rgb2gray(ima_laser);
back=mat2gray(a);
start=1419;
last=1669;
mub=back(1269:1519,start:last);
% figure,imshow(mub);
% imwrite(mub,'mub.tif');
back=zeros(2336,3504);
back(1269:1519,start:last)=mub;
for j=1:Shumu_bianhao(i,1)%%%%第一条 1~28幅为-3,29~54幅为-4,55~64为-3
Bianhao_laser=Shumu_bianhao(i,j+1);
if (abs(Reg_Laser_zero(Bianhao_laser,2)-1419)<=100) || (abs(Reg_Laser_zero(Bianhao_laser,3)-1669)<=100) %%%%定位目标物体区域
mub1=back(1269:1519,Reg_Laser_zero(Bianhao_laser,2):Reg_Laser_zero(Bianhao_laser,3));
% h = fspecial('gaussian',5,3);
% mub1 = imfilter(mub1,h);
% mub1=mat2gray(mub1);
% figure,imshow(mub1);title('I');
imwrite(mub1,['.\光条\30\I',num2str(Bianhao_laser),'.tif']);
end
end
end