【影像分割】基於四叉樹影像分割matlab
%Reversible Data hiding using Quad tree decomposition and histogrma
%shifting
%using quad tree to increase the hiding capacity
clc;
clear all;
close all;
z=1;
%--------------------reading the image------------------------
b=imread('goldhill.jpg');
I=rgb2gray(b);
figure(1);
imshow(I);
title('original image');
[m,n]=size(I);
figure(2);
imhist(I);
title('histogram of original image');
%--------------------quadtree decomposition---------------------
mindim=4;
S = qtdecomp(I,@Split,mindim,@Predicate);
%-------------------showing the block representation------------
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;
figure(3);
imshow(blocks,[]);
title('decomposed image blocks');
%-------------------showing fullimage-----------------------------------
vals1 = repmat(uint8(0),size(S));
for dim = [512 256 128 64 32 16 8 4 2 1]
[vals,r,c]=qtgetblk(I,S,dim);
numblocks = length(find(S==dim));
if (numblocks > 0)
values = repmat(uint8(1),[dim dim numblocks]);
values(2:dim,2:dim,:) = vals(2:dim,2:dim,1:numblocks) ;
vals1 = qtsetblk(vals1,S,dim,values);
end
end
figure(4);
imshow(vals1,[]);
title('decomposed image');
%----------------inputting the message/data to be hide---------------------
hide_data=input('Enter the data to be hide'); %for manual input
%cell_data=textread('myfile.txt', '%s', 'whitespace', ''); %reading data from text file
%hide_data=char(cell_data);
bin_data=convert_binary(hide_data); %calling function to convert data to binary
binary_data=bin_data';
size_binary=size(binary_data,1)*size(binary_data,2);
bin=1;
a=1;
% %-------------------embedding data in the image blocks---------------------
vals5 = repmat(uint8(0),size(S));
pd=1;
q=1;
ind=1;
rec_data(size_binary)=0;
for h=1:size_binary
rec_data(h)=0;
end
for dim = [512 256 128 64 32 16 8 4 2 1]
[vals2,r,c]=qtgetblk(I,S,dim);
numblocks = length(find(S==dim));
if (numblocks > 0)
values = repmat(uint8(1),[dim dim numblocks]);
values1 = repmat(uint8(1),[dim dim numblocks]);
full_hideimage = repmat(uint8(1),[dim dim numblocks]);
values(1:dim,1:dim,:) = vals2(1:dim,1:dim,1:numblocks) ;
%full_hideimage(1:dim,1:dim,:)=vals2(1:dim,1:dim,1:numblocks);
for i=1:size(values,3)
get_block=values(:,:,i);
newblock=values(:,:,i);
hide_image=values(:,:,i);
recover_block=values(:,:,i);
original=get_block;
l_block=length(get_block);
count(255)=0;
for h=1:255
count(h)=0;
end
for k=1:255
for l=1:l_block
for j=1:l_block
if get_block(l,j)==k
count(k)=count(k)+1;
end
end
end
end
[C,max_point]=max(count);
[C1,min_point]=min(count);
for l=1:l_block
for j=1:l_block
if (get_block(l,j)>min_point)&&(get_block(l,j)<max_point)
newblock(l,j)=get_block(l,j)+1;
elseif get_block(l,j)==(max_point+1)
newblock(l,j)=get_block(l,j)+1;
else
newblock(l,j)=get_block(l,j);
end
end
end
for l=1:l_block
for j=1:l_block
if (newblock(l,j)==max_point)
if (bin<=size_binary)
dat=binary_data(bin);
if dat==dec2bin(1)
hide_image(l,j)=newblock(l,j)+ 1;
else
hide_image(l,j)=newblock(l,j);
end
else
hide_image(l,j)=newblock(l,j);
end
bin=bin+1;
else
hide_image(l,j)=newblock(l,j);
end
end
end
full_hideimage(:,:,i)=hide_image;
end
%------------showing data hided image---------------
values(1:dim,1:dim,1:numblocks)=full_hideimage(1:dim,1:dim,1:numblocks);
vals5 = qtsetblk(vals5,S,dim,values);
end
end
figure(5);
imshow(vals5,[]);
title('data hided image');
完整程式碼新增QQ1575304183
相關文章
- 演算法影像崗-影像分類與影像分割演算法
- 基於PaddlePadlle的影像分割の新手入門
- 基於深度學習的影像分割在高德的實踐深度學習
- 數字影像處理day_12 影像分割
- 基於百度飛漿PaddlePaddle的影像分割學習心得
- 使用LabVIEW實現基於pytorch的DeepLabv3影像語義分割ViewPyTorch
- 影像語義分割資料增強——imgaug(二)
- 百度AI攻略:Paddlehub實現影像分割AI
- 如何使用Mask RCNN模型進行影像實體分割?CNN模型
- 飛槳paddlepaddle影像分割課程筆記筆記
- MATLAB——基於影像相減的紙牌識別系統Matlab
- 影像語義分割之特徵整合和結構預測特徵
- matlab求影像頻譜Matlab
- Ai影像分割模型PaddleSeg——自定義資料集處理AI模型
- 醫學影像 | DualGAN與兒科超聲心動圖分割 | MICCAIAI
- 影像分割 | Context Prior CPNet | CVPR2020Context
- 使用EasyCV Mask2Former輕鬆實現影像分割ORM
- 基於支援向量機的影像分類系統(MATLAB GUI介面版)MatlabGUI
- 【影像處理】基於OpenCV實現影像直方圖的原理OpenCV直方圖
- 體素科技:深鑽小資料下的醫學影像分割
- 影像分割中的深度學習:U-Net 體系結構深度學習
- 影像分割必備知識點 | Dice損失 理論+程式碼
- 通用影像分割任務- 使用 Mask2Former 和 OneFormerORM
- 谷歌開源最新語義影像分割模型DeepLab-v3+谷歌模型
- 谷歌釋出人體影像分割工具BodyPix 2.0,可在iPhone上流暢執行谷歌iPhone
- 標註案例分享:自動駕駛影像語義分割丨曼孚科技自動駕駛
- 百度影像分割7日打卡訓練營學習筆記筆記
- YOLOv9:在自定義資料上進行影像分割訓練YOLO
- Matlab在讀取影像時怎麼實現手動選擇影像Matlab
- 基於Opencv的簡單影像處理OpenCV
- 百度飛槳PaddlePaddle影像分割7日學習收穫
- 影像分割論文 | DRN膨脹殘差網路 | CVPR2017
- [00]數字影像處理-matlab速成Matlab
- 彩色影像二值化函式(matlab)函式Matlab
- 【Matlab 控制】模仿繪製動態影像Matlab
- Matlab | 儲存影像無白色邊框。Matlab
- Matlab影像處理常用基本函式Matlab函式
- MATLAB影像處理imadjust()函式調節影像的對比度示例Matlab函式