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 (2020). Watermark DCT (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (29)

hein thet

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

Please give me the link of the paper?

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. ???

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.

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

dqsd dqsdq

thank you !

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!


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

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

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



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

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,,

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