利用函数qtdecomp将图像的H分量进行四叉树分解,为什么改变qtdecomp参数中的0.27,图像分块效果一点都没变
clc;%清屏closeall;clearall;%%START----------------函数内部测试-----------------------STARTw0=...
clc;%清屏
close all;clear all;
%% START----------------函数内部测试-----------------------START
w0=0.8;t0=0.1;
figure,whitebg(1,'k');
set(gcf,'MenuBar','none');
set(gcf,'units','normalized','position',[0,0,1,1]);%全屏显示
set(gcf,'NumberTitle','off','Name','基于暗原色的单一图像去雾技术');
im_fog=imread('fog_1.bmp');
im_fog1=imresize(im_fog,[256 256]);
subplot(2,2,1),imshow(im_fog1) ;title('原始图像');
%% START----------------把图像进行四叉树分解-----------------------START
img_HSI=rgb2hsi(im_fog1); %RGB转化为HSI
img_H=img_HSI(:, :, 1); %取H分量
S = qtdecomp(img_H,.27); %四叉树分解
S = qtdecomp(img_H); %四叉树分解
blocks = repmat(uint8(0),size(S));
for dim = [512 256 128 64 32 16 8 4 2 1];
numblocks = length(find(S==dim));
if (numblocks > 0)
values = repmat(uint8(1),[dim dim numblocks]);
values(2:dim,2:dim,:) = 0;
blocks = qtsetblk(blocks,S,dim,values);
end
end
blocks(end,1:end) = 1;blocks(1:end,end) = 1;
subplot(2,2,2),imshow(blocks,[]) ;title('四叉树分割图像') 展开
close all;clear all;
%% START----------------函数内部测试-----------------------START
w0=0.8;t0=0.1;
figure,whitebg(1,'k');
set(gcf,'MenuBar','none');
set(gcf,'units','normalized','position',[0,0,1,1]);%全屏显示
set(gcf,'NumberTitle','off','Name','基于暗原色的单一图像去雾技术');
im_fog=imread('fog_1.bmp');
im_fog1=imresize(im_fog,[256 256]);
subplot(2,2,1),imshow(im_fog1) ;title('原始图像');
%% START----------------把图像进行四叉树分解-----------------------START
img_HSI=rgb2hsi(im_fog1); %RGB转化为HSI
img_H=img_HSI(:, :, 1); %取H分量
S = qtdecomp(img_H,.27); %四叉树分解
S = qtdecomp(img_H); %四叉树分解
blocks = repmat(uint8(0),size(S));
for dim = [512 256 128 64 32 16 8 4 2 1];
numblocks = length(find(S==dim));
if (numblocks > 0)
values = repmat(uint8(1),[dim dim numblocks]);
values(2:dim,2:dim,:) = 0;
blocks = qtsetblk(blocks,S,dim,values);
end
end
blocks(end,1:end) = 1;blocks(1:end,end) = 1;
subplot(2,2,2),imshow(blocks,[]) ;title('四叉树分割图像') 展开
1个回答
展开全部
clc;%清屏
close all;clear all;
%% START----------------函数内部测试-----------------------START
w0=0.8;t0=0.1;
figure,whitebg(1,'k');
set(gcf,'MenuBar','none');
set(gcf,'units','normalized','position',[0,0,1,1]);%全屏显示
set(gcf,'NumberTitle','off','Name','基于暗原色的单一图像去雾技术');
im_fog=imread('fog_1.bmp');
im_fog1=imresize(im_fog,[256 256]);
subplot(2,2,1),imshow(im_fog1) ;title('原始图像');
%% START----------------把图像进行四叉树分解-----------------------START
img_HSI=rgb2hsi(im_fog1); %RGB转化为HSI
img_H=img_HSI(:, :, 1); %取H分量
S = qtdecomp(img_H,.27); %四叉树分解
S = qtdecomp(img_H); %四叉树分解
blocks = repmat(uint8(0),size(S));
for dim = [512 256 128 64 32 16 8 4 2 1];
numblocks = length(find(S==dim));
if (numblocks > 0)
values = repmat(uint8(1),[dim dim numblocks]);
values(2:dim,2:dim,:) = 0;
blocks = qtsetblk(blocks,S,dim,values);
end
end
blocks(end,1:end) = 1;blocks(1:end,end) = 1;
subplot(2,2,2),imshow(blocks,[]) ;title('四叉树分割图像'
close all;clear all;
%% START----------------函数内部测试-----------------------START
w0=0.8;t0=0.1;
figure,whitebg(1,'k');
set(gcf,'MenuBar','none');
set(gcf,'units','normalized','position',[0,0,1,1]);%全屏显示
set(gcf,'NumberTitle','off','Name','基于暗原色的单一图像去雾技术');
im_fog=imread('fog_1.bmp');
im_fog1=imresize(im_fog,[256 256]);
subplot(2,2,1),imshow(im_fog1) ;title('原始图像');
%% START----------------把图像进行四叉树分解-----------------------START
img_HSI=rgb2hsi(im_fog1); %RGB转化为HSI
img_H=img_HSI(:, :, 1); %取H分量
S = qtdecomp(img_H,.27); %四叉树分解
S = qtdecomp(img_H); %四叉树分解
blocks = repmat(uint8(0),size(S));
for dim = [512 256 128 64 32 16 8 4 2 1];
numblocks = length(find(S==dim));
if (numblocks > 0)
values = repmat(uint8(1),[dim dim numblocks]);
values(2:dim,2:dim,:) = 0;
blocks = qtsetblk(blocks,S,dim,values);
end
end
blocks(end,1:end) = 1;blocks(1:end,end) = 1;
subplot(2,2,2),imshow(blocks,[]) ;title('四叉树分割图像'
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询