From: Abdulhakeem Othman on
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
From: ImageAnalyst on
I didn't try it but the code looks right.

You can do many edge filters and sharpening filters with convolution,
conv2(). Just set up your kernel properly, for example a high-boost
filter would simply be a convolution (or imfilter) with the kernel [-1
-1 -1;-1 17 -1; -1 -1 -1].

One linear edge filter (Laplacian kernel) would be [-1 -1 -1;-1 8 -1;
-1 -1 -1]. You can construct others linear filters like this. Non-
linear filters (e.g. median) can't be constructed from convolution.
The kernel window size (and size of filter contained within that
window) has a dramatic effect on the appearance of the output image.