+ Post New Thread

Results 1 to 20 of 24

- 5th January 2007, 22:16 #1
## matlab program of dct for gray scale image

hi

i really need a program that make a watermarking in an image by any algorithm using Matlab.

- 5th January 2007, 22:16

- 8th January 2007, 21:38 #2
## matlab energy specter

there is no answer for me........

i need any algorithm?????

tx

- 16th January 2007, 12:59 #3
## reference to unknown function or variable

Originally Posted by**zzoorroo**

- 21st January 2007, 16:00 #4

- Join Date
- Jan 2007
- Posts
- 2
- Helped
- 0 / 0
- Points
- 1,058
- Level
- 7

## spatial domain watermarking schemes tutorials

Contact abhishek.vnit on this forum..............he has the code ready!

- 22nd January 2007, 20:49 #5
## image watermarking using dwt2 matlab

hi

where i can find abhishek.vnit ?

1 members found this post helpful.

- 25th January 2007, 09:00 #6

- Join Date
- Feb 2006
- Location
- Macedonia
- Posts
- 309
- Helped
- 47 / 47
- Points
- 3,789
- Level
- 14

## matlab antialiasing imresize

Here's a little hint about making a watermark in an image;

load an image

**image=imread('lena.ppm');**(grayscale color can do but you'd have to make a choice place a wattermark in all three colors or just the luminant signal)

Create a wattermark of size N it shuld be a Gaussian string with mean 0 with coeficiants in the interval [-1,1], so use matlabs function randn;

**mark=randn(100)**

type*help randn*to get all the posible switches of this function, by the by you can allso use matlabs function rand but then the string wuldn't have a zero mean.

So now you have the image and the wattermark and you need to make a choice haw are you going to insert the mark?

This is done in the frequency spectar so you need to transform your image this can be an fft or dct or even dwt transform and yes you can place the wattermark in the original space pixells but in my expirience the durability of the wattermark is stronger if it's inserted in the lower frequency!

And essentualy the best durability is achived if the transform is the discrete cossine transform DCT2 in matlab or a discrete wavelet transform DWT2 (there are a lot of possible wavelet transformations an infinete number really)

This is just a quick intro for more information check these sites:

http://www.mathworks.com/matlabcentr...oadFileList.do

http://www.mathworks.com/cgi-bin/tex...tor/search/asp

- 25th January 2007, 09:00

- 25th January 2007, 17:21 #7
## fft amplitude embed image watermarking matlab

hi

thanks for interest..

the two links didn't work!!!!!!!

i want to ask about how i can convert rows to column without using "reshape" !!!

i need this code ....

thanks again....

- 25th January 2007, 17:21

- 25th January 2007, 23:12 #8

- Join Date
- Feb 2006
- Location
- Macedonia
- Posts
- 309
- Helped
- 47 / 47
- Points
- 3,789
- Level
- 14

## matlab function reshape for watermark message

Yeap the mathworks use a protected search engine, just search wattermarking in mathworks website.

I had a project three years ago about this, don't know where my code is I'll search for it (I embeded a watermark in a digital image using the dct transformation).

About converting rows to columns, if it's a two dimensional matrix aka gray scale image why don't you just use the transpose command " the transpose of A is**A'**"

- 26th January 2007, 14:25 #9
## watermarking matlab code for spatial domain

hi

thanks for replying....

i need to convert a matrix like b=[1 2 3;4 5 6;7 8 9] to a vector like

b=[1;2;3;4;5;6;7;8;9] without using reshape because when i use this command an error appear when i write this code:

message=round(reshape(message,Mm*Nm,1)./256);

the error is:

??? Error using ==> reshape

To RESHAPE the number of elements must not change.

hope you can help me..

thanks

bye.

- 26th January 2007, 23:41 #10

- Join Date
- Feb 2006
- Location
- Macedonia
- Posts
- 309
- Helped
- 47 / 47
- Points
- 3,789
- Level
- 14

## matlab dct2

Originally Posted by**zzoorroo**

haven't done matlab in a while but try this:

A=[1 2 3

4 5 6

7 8 9]

[y x] =size(A);

a=zeros(x*y);

for i=1:y do

a[(i-1)*x+1:i*x] = A(1: x,i);

end

"or something similar this code stack's up a matrix row by row or column by column depending by the choice i=1 or 1:y. try it and change some of the coefficients as I probably have made a syntax error but the idea is solid as I've used this before.

I also included some nice tutorials about watermarking which I found usefull

- 27th January 2007, 21:05 #11
## Re: Matlab program

hi

thanks very mush for fast replying&the attachment it is very useful.....

i found in it the function 'reshape' when i use it with the watermark ('_copyright.bmp') used in this program it work well,but when i change

it with anther watermark it give me

this error again:

??? Error using ==> reshape

To RESHAPE the number of elements must not change.

the watermark i use is(61*97)

i know that there is difference in resolution.....

i need to make this program work with any(watermark&resolution) $general case$

can you help me..

thanks again for interest.

- 28th January 2007, 00:21 #12

- Join Date
- Feb 2006
- Location
- Macedonia
- Posts
- 309
- Helped
- 47 / 47
- Points
- 3,789
- Level
- 14

## Re: Matlab program

I've never used the reshape function so I can't help you there.

So you're using an image as the watermark. During my course we called it stamping. How are you embedding the watermark in the spatial domain or the frequency domain? You will need to determine a default size of your stamp compared to the image you're stamping so that the psnr would be under control. What you could do is use matlabs resize function to resize the stamp compared to the image you're stamping.

The way I use to stamp (in my project I used an pseudo random watermark witch was generated by a deterministic code) was that I used the ex-or or ex-and logical operators to merge the stamp and the random mark, the stamp was a binary black and white image where the black was represented with -1 and the white with 1, as the generated mark was a gaussian random string witch took values [-1 1], and I then embeded it in the low frequencies by using dct2.

Sorry if the previous post is a bid confusing, here's an idea. in your code compare the total amount of pixels between the image you're protecting and the watermark, from the given result resize the watermark so it complies some predetermined parameters aka 5% of the original image here you can reduce or enrage it.

Then use the resized image as the watermark, as your method uses the human eye as the detector of the watermark this shouldn't be a problem. In my project I resized, resampled it printed it and then scanned the image and the mark stood ;)

Added after 31 minutes:

My friend check this site out:

http://www.watermarker.com/forum/

it has loads of info and a lot of watermarker's on it :D

- 28th January 2007, 22:04 #13
## Re: Matlab program

hi

really.. really thank you very mush....

i put in my code the function 'imresize' so i can encode any image..

on the other hand i start to use the function 'randn' which have µ=0&δ=1

but when i want to check the output i have µ≠0 & δ≠1 i use this functions to know the o/p( a=mean(x) & b=std(x) or b=var(x) ) so

do you know how to know this????

thanks.........

- 28th January 2007, 23:17 #14

- Join Date
- Feb 2006
- Location
- Macedonia
- Posts
- 309
- Helped
- 47 / 47
- Points
- 3,789
- Level
- 14

## Re: Matlab program

My friend you will never get the same values due to the image reencoding after the mark insertion: image->dct->(insert mark->dct2->marked image;

On the other side using an image as a watermark is a relatively bad idea, if you merged the string gotten from randn witch has a mean 0, and a deviation 1 with an bw image which has a relatively high correlation the new string will never have m=0 and δ=1, this is due to the central borderline theory. My suggestion is to use a pure pn string as the watermark (I still don't know how do you insert the mark, but as the usual way is to place it in the low freq. tha mark needs to have a m=0 so it;s more difficult to detect it.

- 31st January 2007, 22:56 #15
## Re: Matlab program

hi

the reshape function used in the 'dct' program it convert the matrix to n-rows & one colomn,but in this program i don't know why we make this to the message???

the second thing is i want to know how i know the variance&the mean of any matrix after i generate it by using the function 'randn'

ex:

a=randn(3);

the mean not equal to zero& the variance not equal to one???????????????

- 1st February 2007, 00:07 #16

- Join Date
- Feb 2006
- Location
- Macedonia
- Posts
- 309
- Helped
- 47 / 47
- Points
- 3,789
- Level
- 14

## Matlab program

the mean and variance will be equal to 0 and 1 if you have a larger string, and as this is a pseudo noise it will never be quite 0 and 1 but almost equal.

And about the reshape function: a characteristic of the two dimensional dct transform is that the bulk of the images (signals) energy (the lower frequency) is placed in the upper left corner and the idea is to place the mark in these frequencies so we need to zigzag the the dct specter to a string and apply the wattermark there (this is the way jpeg compression works where after zigzagging the lower frequencies are encoded with DPCM and the higher witch have a value near zero are discarded or encoded via rle.)

The jpeg compression gave me this idea, but it's also simpler to implement a mark with a variable length.

- 1st February 2007, 15:23 #17
## Re: Matlab program

hi

why i need to zigzag the the dct specter to a string ???

i want to generate a noise by using 'randn' so:

a=randn(600);

now i want to the function which tell me that the mean equal to zero&the variance equal to one.....

- 2nd February 2007, 00:13 #18

- Join Date
- Feb 2006
- Location
- Macedonia
- Posts
- 309
- Helped
- 47 / 47
- Points
- 3,789
- Level
- 14

## Matlab program

You need to do it beacose you're embedding the mark in the lowest frequencies (by doing so you're influencing the toughest part of an image and the changes done by the mark are unnoticeable by the human eye), and the size of the mark 600 is too small, take in account that the smallest image you'd protect is 512x512=262144 pixels I'd recommend a mark's size of about 5000-10000 (the original image is uint8 or 16 so it has values 0-256 and a pseudo noise [-1,1] makes little difference);

- 2nd February 2007, 07:19 #19

- Join Date
- Feb 2006
- Location
- Macedonia
- Posts
- 309
- Helped
- 47 / 47
- Points
- 3,789
- Level
- 14

## Matlab program

Another point during my studies of digital image processing I had a project in watermarking, Becose of low popularaty of the teaching asistent There wore only faive students in that course, and we all had to implement a different watermarking algoritham. Mine was to implement one using dct of a holle image, another one wich is more closely conected to jpeg was first do split an image in 64x64 bloks and then to insert only one watermarking coeficient in the dct spectar of each block (here you don't need to implement a zigzag only one watermark koeficient goes in the dc value of the dct of the image block), a third implementation was to use fft on an image and insert the mark in the amplitude or fhase of that image, a fourth implementation was to use filterbaks aka wavelets and place the watermark in the coarser part of the image (the low frequencies)

You asked why do you need to zigzag? if you place the watermark in the mid or high frequencies then by lowpass of the image you culd damage the watermark so it culdn't be detected.

As I noticed you probobly need the size of the watermark to be 600 becose you're using an image as the watermark ake stamp, if you have to use an image use a larger one one with unleast 10000 pixels 100x100.

- 2nd February 2007, 12:16 #20
## Re: Matlab program

hi

1- i still don't know why i use 'reshape' to convert a matrix to a matrix with one column ????? (i know that i use the low freq. instead of mid freq.)

2- how i can know that the mean &the variance of the o/p of the function 'randn'

are equal to 0&1?????

i use cover image(600×800) and the watermark is (20×50)

when i change the watermark o/p to me an error:

??? Error using ==> reshape

To RESHAPE the number of elements must not change.

thanks

+ Post New Thread

Please login