File Exchange

image thumbnail

Watermark DCT

version (41.3 KB) by Suraj Kamya
Watermarking in frequency domain using DCT


Updated 05 Jun 2014

View License

% wtmark function performs watermarking in DCT domain
% it processes the image into 8x8 blocks.
% im = Input Image
% wt = Watermark
% embimg = Output Embedded image
% p = PSNR of Embedded image

Cite As

Suraj Kamya (2021). Watermark DCT (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (30)

marie lasz

For those who are asking about 35, this is the alpha value which is constant and you can take any value but this implemntation is wrong. The reason is alpha value should lies between 0-1, but this code is not working with alpha values under 5. In this algo, he added alpha value to get the pattern or sequence of watermark bits in the extraction phase.

hein thet

Can I change the function @dct2 to fft2 to become watermarking in fft2?

Please give me the link of the paper?

Prabhakaran M

how to run this code


overall code is nice and perfectly run. but, can we select alternate DCT blocks to insert the bit which may increase some security. Becoz, here, sequentially blocks are used to to insert the bit which may simple. any one please give me solution about that. ???

shital shinde

please, explain to me how the watermark bit is embedded into DCT coefficients. How actually embedding and extraction process is done. And why that 35 is added and subtracted in it. Please provide me a solution for this.

shital shinde

KIndly upload the algorithm for fruitful flow o understanding. For both extracting and embedding

dqsd dqsdq

thank you !

Vaidhyanathan C

Ria Paul


Suraj Kamya

Hey! everyone Sorry for delayed response.

Actually I have added and subtracted the value 35 ( its empirical founding or it can be any value). So that it can be easily distinguished while taking DCT and aging back to IDCT to identify the watermark bit was 0 or 1. :)

Hope you get it. I still not feel free to ask more questions.

Hoang Duong

for i=1:8 % To address row of block
for j=1:8 % To adress column of block
if (i==8) && (j==8) && (w<=welem) % Eligiblity condition to insert watremark
% i=1 and j=1 - means embedding element in first bit of every block
if wmrk(w)==0
elseif wmrk(w)==1
I don't understand it. Help me pls

Elaine guo

I can't understand these code!


vishal vekaria

vishal vekaria

can anybody explain me that gui code which comprises of 1493 lines

abhishek kumar

tell the steps......which file run first

Sayak Roychowdhry

KIndly upload the algorithm for fruitful flow o understanding.For bothe extracting and embedding


Sayak Roychowdhry

Sayak Roychowdhry




If u have any query regarding ur project either mail at or, Kindly Spread it to Help Others.

Kshipra Charpe

hello sir, i can't understand why the value of 63rd coefficient in each block in dct image is added or subtracted by 35 only?

Hermawan -

Hello sir,, my name hermawan,, I am student of diponegoro university (Semarang, Indonesia), I need a code of your image watermarking with DCT method for my final project sir. I really hope you assistance for my project, I need your help sir. I thank you sir,,
best regards.. hermawan,

Sorry for my bad english,,

mohammad moosa

Babak Dayyani

It was a great code, easy to understand and easy to use.


how i can download this file?

Suraj Kamya


MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!