|
Hello ........
I have an rgb watermarked image ,I need to do these attacks to the image:
1-filtering
a-Gaussian lowpass (3x3)
b-Median filtering (2x2)
2-Image enhancement
a-Edge sharppen
b-Gaussian blurring
c-Moving blurring
3-Image Mosaic (4x4)
I do some of them :
1)a)-Gaussian lowpass
%****************
%GaussianLowpass Filter
%Read an Original RGB Image
Original=imread('lena.bmp');
%Read an RGB Watermarked Image
Host=imread('watermark.bmp');
[O1 O2]=size(Host)
subplot(3,4,1);
imshow(Host);title('Watermarked Image');
%**************
%Convert The RGB Watermarked Image to Ycbcr space
YCBCR=rgb2ycbcr(Host);
subplot(3,4,2);
imshow(YCBCR);title('Ycbcr Image');
Y=YCBCR(:,:,1);
CB=YCBCR(:,:,2);
CR=YCBCR(:,:,3);
subplot(3,4,3);
imshow(Y);title('Y luminance');
%***************
%***************
%That is the Gaussian lowpass (3x3)
H=fspecial('gaussian',[3 3]);
Filter= imfilter(Y,H);
subplot(3,4,4);
imshow(Filter);title(' LowPass Y luminance');
%*************
%concatenate the luminance (Y) ,CBand CR
concatenate=cat(3,Filter,CB,CR);
subplot(3,4,5);
imshow(concatenate);title('concatenation Ycbcr');
%**************
%Convert to RGB space
RGB=ycbcr2rgb(concatenate);
subplot(3,4,6);
imshow(RGB);title('Recovered RGB Image');
imwrite(RGB,'QaussianFilter.bmp');
%***************
%Calculate the PSNR (for Color Image)
mseImage = (double(Original) - double(RGB)) .^ 2;
mse = sum(sum(mseImage)) ;
summse=0;
for i=1:3
summse=summse+mse(:,:,i);
end
k=(O1*O2);
summse=summse/ k;
PSNR = 10 * log10( 255^2 /summse)
%**************************
1)b) We do the same read original and watermarked images convert the RGB image to YCBCR then do a mdian filter:
%Add noise to Y luminance
Noise=imnoise(Y,'salt & pepper',0.02);
subplot(3,4,4);
imshow(Noise);title('Noised Y luminance');
%*******************
% Do the median Filter
Filter=medfilt2(Noise,[2 2]);
subplot(3,4,5);
imshow(Filter);title('Filter Y luminance');
%********************
The code is true but I'm not sure if it is 100% true about Gaussian lowpass and median filter.
The other I can not do it .
Can anyone help me please about the others (gaussian blur ,Edge sharpen...)
Best regards
|