ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am doing a project on Image watermarking using Discrete Wavelet Transform(DWT) and Encryption. It is carried out in the following steps
1.) Select the host image( Image in which watermark will be hided).
2.) Select the watermark.
3.) Encrypt the watermark using the following code
b= strcat(b,a); String Concatenation
c=imread(b); Image is read and stored in the variable c
[p,q,r]=size(c); %displaying the dimensions of Image
%%%%%%%%%Cipher watermark%%%%%%%%%%%%%%%%%%%%%
scrambleOrder = randperm(p*q); %this is a ranperm method which generated random values
redChannel = c(:, :, 1); %Extarction of red channel
greenChannel = c(:, :, 2); %Extarction of green channel
blueChannel = c(:, :, 3); %Extarction of blue channel
redChannel = redChannel(scrambleOrder); %Red channel will be given random values as generated above
greenChannel = greenChannel(scrambleOrder); %Green channel will be given random values as generated above
blueChannel = blueChannel(scrambleOrder); %Blue channel will be given random values as generated above
redChannel = reshape(redChannel, [p,q]); %reshaping red channel as given by (p and q)
greenChannel = reshape(greenChannel, [p,q]); %reshaping green channel as given by (p and q)
blueChannel = reshape(blueChannel, [p,q]); %reshaping blue channel as given by (p and q)
s = cat(3, redChannel, greenChannel, blueChannel); %displacing rgb channel collectively
4.) Watermarking using DWT.
5.) Recover the Encrypted watermark using recovery formula.
6.) Decryption of watermark using the following code.
recoverOrder = zeros([u*v], 2); %it will generate the 2 columns having maximum value u*v and where u and v are dimensions(width and height) of recoverd watermark from watermarked image.
recoverOrder(:, 1) = 1 : (u*v); %make the first coluns value from 1: u*v
recoverOrder(:, 2) = scrambleOrder; %make second column value od randon permutaion generated during encryption
newOrder1 = sortrows(recoverOrder, 2); %sort rows of column1 and column 2
newOrder = newOrder1(:,1); Eliminate column2
redChannel = redChannel(newOrder); %New order value into red channel
greenChannel = greenChannel(newOrder); %New order value into green channel
blueChannel = blueChannel(newOrder); %New order value into blue channel
redChannel = reshape(redChannel, [u, v]); %reshape red channel
greenChannel = reshape(greenChannel, [u, v]); %reshape green channel
blueChannel = reshape(blueChannel, [u, v]); %reshape blue channel
D = cat(3, redChannel, greenChannel, blueChannel); %cat RGB and store it in D
My Question is that I have made many attacks on Watermarked Image like Rotation, Scaling, Croping but PSNR and MSE between (Watermark and Decrypted watermark) after and before attack remain Infinity and Zero respectively.
I think During Decryption, I have used same ran permutation that I used to ENCRYPT the image. So I think, Attacks have no effect on decrypted image.
Question is how to improve my code or what suggestions you can give me.
I have uploaded 2 Images. Here all can see that even on crping or adding noise, Decrypted image is not effected.
I am trying my hard. I guess getting suggestion can help me a lot.
Last edited by Sanpreet Singh; 05-01-2015 at 03:44 PM.
First and foremost, tell people what language you are using. I'd guess MATLAB?
Secondly, use the [code][/code] tags for your code. It will preserve formatting and make it far easier to read.
Thirdly, if you have a question make it clear. This, "My Question is that I have made many attacks on Watermarked Image like Rotation, Scaling, Croping but PSNR and MSE between (Watermark and Decrypted watermark) after and before attack remain Infinity and Zero respectively", is not a question.
Ok Sir. Next time I will make care of it. I am using MATLAB
I guess this is your idea of taking care of it to make it more clear, cross post in another forum with even less information. This would be the correct forum, programming versus Newbie.
Once again, re-read LQ Rules and do not cross post.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.