fitting image blocks
Afficher commentaires plus anciens
now i am doing a project for image hiding
and the steps involved are
1. divide the host image into blocks 2.divide the secret image into blocks i have taken 128X128 image and the block size is 32 hence i get 8 X 8 host image blocks and secret image blocks
3. i find the standard deviation and mean of each blocks of both the host and secret image 4 i sort the image blocks of host and secret image based on the average standard deviation of each block
5 map the blocks of the secret and host images in one to one manner and reorder the blocks based on the indices of the secret block 6 fit the secret image block to target image block
*i don't know how to map reorder and fit the secret image blocks to target image blocks * this is my code
clc;
clear all;
target=imread('D:\10mcs010\imagedb\flowerpottargetsmall.png');
figure,imshow(target);
bs=32;
[row,col,n]=size(target);
tarbk = mat2cell(target,ones(row/bs,1)*bs,ones(col/bs,1)*bs,3);
[r,c,n]=size(tarbk);
for i=1:r
for j=1:c
% figure,imshow(tarbk{i,j})
% tarbkseg{i,j}=tarbk{i,j};
% tarbkred(i,j)=tarbk(i,j,:);
% tarbkm(:)=cell2mat(tarbk(i,j));
red(:,:,i,j)=tarbk{i,j}(:,:,1);
green(:,:,i,j)=tarbk{i,j}(:,:,2);
blue(:,:,i,j)=tarbk{i,j}(:,:,3);
end
end
%
for i=1:r
for j=1:c
redmean(:,:,i,j)=mean2(red(:,:,i,j));
greenmean(:,:,i,j)=mean2(green(:,:,i,j));
bluemean(:,:,i,j)=mean2(blue(:,:,i,j));
end
end
for i=1:r
for j=1:c
stdred(:,:,i,j)=std2(red(:,:,i,j));
stdgreen(:,:,i,j)=std2(green(:,:,i,j));
stdblue(:,:,i,j)=std2(blue(:,:,i,j));
avgtar(:,:,i,j)=(stdred(:,:,i,j)+stdgreen(:,:,i,j)+stdblue(:,:,i,j))/3;
end
end
[value,index]=sort(avgtar);
%
secret= imread('D:\10mcs010\imagedb\flowerpotsmall.png');
figure,imshow(secret);
bs =32 ; % size of the block
[row,col,n]=size(secret);
secbk = mat2cell(secret,ones(row/bs,1)*bs,ones(col/bs,1)*bs,3);
[r,c]=size(secbk);
for i=1:r
for j=1:c
% figure,imshow(out{i,j})
secred(:,:,i,j)=secbk{i,j}(:,:,1);
secgreen(:,:,i,j)=secbk{i,j}(:,:,2);
secblue(:,:,i,j)=secbk{i,j}(:,:,3);
end
end
for i=1:r
for j=1:c
secredmean(:,:,i,j)=mean2(secred(:,:,i,j));
secgreenmean(:,:,i,j)=mean2(secgreen(:,:,i,j));
secbluemean(:,:,i,j)=mean2(secblue(:,:,i,j));
end
end
%
for i=1:r
for j=1:c
secstdred(:,:,i,j)=std2(secred(:,:,i,j));
secstdgreen(:,:,i,j)=std2(secgreen(:,:,i,j));
secstdblue(:,:,i,j)=std2(secblue(:,:,i,j));
avgsec(:,:,i,j)=(secstdred(:,:,i,j)+secstdgreen(:,:,i,j)+secstdblue(:,:,i,j))/3;
end
end
[values,indexs]=sort(avgsec);
Réponses (0)
Catégories
En savoir plus sur Neighborhood and Block Processing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!