clc;
clear all;
close all;
start_time = cputime; %Starting Time of Execution
I = imread('lena.jpg');
[r, c]=size(I);
bs=8; % Block Size (8x8)
nob=(r/bs)*(c/bs); % Total number of 8x8 Blocks
% Dividing the Cover image into 8x8 Blocks
for i=1:(r/bs)
for j=1:(c/bs)
dctimg(:,:,kk+j)=dct2(I((bs*(i-1)+1:bs*(i-1)+bs),(bs*(j-1)+1:bs*(j-1)+bs)));
end
kk=kk+(r/bs);
end
size(dctimg) = 8 8 4096.
How can I get size(dctimg) = 512 X 512;
Please Help. thanks in advance.
doc reshape
but why not just use blkproc to do the whole thing for you?
doc blkproc
or even cell2mat->cellfun->mat2cell
?
Let me add my wild guessing also:
> > size(dctimg) = 8 8 4096.
> > How can I get size(dctimg) = 512 X 512;
% D = [8 x 8 x 4096]
D = reshape(D, 8, 8, 64, 64);
E = permute(D, [1, 3, 2, 4]);
F = reshape(D, 512, 512);
Perhaps, or perhaps not. Jan
2. then perform DCT on each block and find quantized DCT values..
3. modify the non zero DCT quantized values coefficients (we get only 6-9 coeff out of 64 coefficients) with secret message.
4. After modifying, perform IDCT to get the stego image.
If I use blkproc I get dct for the entire image and cannot access individual 8 X 8 blocks
please help me how to proceed with the 8x8 block.
> > > clc;
> > > clear all;
> > > close all;
> > >
> > > start_time = cputime; %Starting Time of Execution
> > >
> > > I = imread('lena.jpg');
> > >
> > > [r, c]=size(I);
> > > bs=8; % Block Size (8x8)
> > > nob=(r/bs)*(c/bs); % Total number of 8x8 Blocks
> > >
> > > % Dividing the Cover image into 8x8 Blocks
> > > for i=1:(r/bs)
> > > for j=1:(c/bs)
> > > dctimg(:,:,kk+j)=dct2(I((bs*(i-1)+1:bs*(i-1)+bs),(bs*(j-1)+1:bs*(j-1)+bs)));
> > > end
> > > kk=kk+(r/bs);
> > > end
> > > size(dctimg) = 8 8 4096.
> > > How can I get size(dctimg) = 512 X 512;
> My aim is to
HI, CAN I GET THE SOLUTION FOR DIVIDING THE 512X512 IMAGE INTO 8X8 BLOCK