MATLAB Answers


medical image watermarking and cryptography system

Asked by Mohammad
on 3 Dec 2012
Latest activity Commented on by DAVID KING
on 17 Jan 2016

i'm working on digital watermarking and cryptography , i'm trying to insert a set of data, containing the signature of the original image, the data specific to the patient and his diagnostic and then it will be shared in a network.

which technique or algorithm to embed that information without affecting the image quality as this may cause misdiagnosis.

any help or advice will be appreciated

[Merged information from duplicate question]

hi everybody,

i am working on a project on digital watermark for medical image based on IRO (region of interest).

the first step in this project is to separate ROI using roipoly or imfreehand or any other interactively way, and then considering RONI(reigon of non interest) and applying 3 level DWT using "Haar" wevelt. WHERE only RONI will be used for watermark embedding.

please if any one can help with matlab code for separation of ROI out of cover medical image and prepare the RONI for other steps:

many thanks in advance.


What image types must be supported as output? Is this strictly DICOM? Is it acceptable to alter only the headers and meta-information for the information, or is it required to alter the image itself? Is the output image only for human viewing or is it also to be used for software analysis?

If u have any query thn regarding ur project either mail at or,


No products are associated with this question.

7 Answers

Answer by Mohammad
on 4 Dec 2012

thank you Mr Walter for your concern, Yes it must be DICOM image. the embeded information must not affect the image quality as this may cause misdiagnosis. output image will be sent to the doctor to his PC and then he can extract the information out of the DICOM image.

  1 Comment

So to check, embedding meta-information would be acceptable?

If so, then usually this would not be called watermarking, as it could easily be stripped off by deleting that header. Unless, that is, it was acceptable to modify the existing headers and try to do so in a way that did not change their meaning, and it would have to involve essentially "mandatory" headers to prevent it from just being thrown away. Tricky.

Watermarking of images is usually done on the images themselves, it then becomes part of what is inherent about the image, not possible to take it away at all easily. But in the case of medical images, you need how the image will be processed in order to make judgements about what can be safely disturbed. Tricky.

Answer by Mohammad
on 10 Dec 2012
Edited by Walter Roberson
on 10 Dec 2012

i did some research , the watermark will be based on ROI(region of Interest) and i will insert additional data into RONI (region of non interst) using 3 level DWT.

please help me in the first step which is how to separate ROI interactively from cover medical image. in a way, that i can apply 3 level DWT on RONI. i have this code :

close all;
[r c]=ginput(5);
BW = roipoly(a,r,c);
figure, imshow(BW)
[R C]=size(BW);
for i=1:R
    for j=1:C
        if BW(i,j)==1
imshow(Out,[]);title('output image');

  1 Comment

I would like to agree as stronlgy as I possibly can with Walter on this: If the image format allows header/meta-data then the obvious place to put the additional (encrypted) data there - I would not want an increased risk of misdiagnosing because some unfortunate feature appears in the "RONI" by accident. When meddling with the data is not needed don't meddle with the data.

Answer by Mohammad
on 10 Dec 2012

correction: image format does not allow header. and there will be no misdiagnosing as long as we will not play around with ROI that is as i read in some papers.also watermarking will protect image during transmission through mobile or network. please if u can help me with code for separation process it will be great help. thanks in advance


If the image format does not allow a header, then you are not using DICOM or JPEG or TIFF or GIF images. What image format are you using?

Back when I was a network security person, I would have had to turn myself in to the regulators if I had allowed our patient images to be transmitted unencrypted through cellular telephone.

The way to protect images during transmission is not watermarking: it is encrypting the file as a whole and transmitting with layers of error correction and detection mechanisms.

Answer by Mohammad
on 10 Dec 2012

thanks Mr. Walter And let us forget about medical image. how can i separate ROI from cover image and then embed watermark in RONI. if there is code it will be gr8 help. thank u in advance

  1 Comment

"Don't worry, this isn't a medical image, it's just a picture of an image, and for my own amusement I just happened to choose something that resembled a medical image."

Answer by Walter Roberson
on 10 Dec 2012

You opened another copy of the same question, in which it was again clear that your intention is to apply this to medical images. And that is a problem.

Suppose I told you a method, suppose I even gave exact code -- and suppose that there was something I overlooked or I had a mistake in what I said. Now, if the result of this was that diagnostically useful information did go missing, then how do I explain to the patient's heirs and surviving family that I was just answering a question and that I have no responsibility for what was done with my answer? How do I explain that to myself, to my conscience for the rest of my life?

You need to figure out what benefits would arise out of what you are proposing to do, and you need to find other ways to achieve the benefits.

I suspect you are doing this as part of an assignment or final year project. If so then please remember that part of what you should be learning is when not to do something. If you are studying some kind of engineering, then Professional Ethics is likely a mandatory course, and this is an example of applying those professional ethics.


Answer by Mohammad
on 11 Dec 2012

Don't worry Mr walter, this why we do research, if there is no problem there willb e no research, am i right? and thank any way.


Answer by Jeevitha lakshmi M on 20 Feb 2015

i need the full code of the topic


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!