MATLAB Answers

how to embed a watermark in a color image

36 views (last 30 days)
shafaq innam
shafaq innam on 14 Apr 2013
Answered: cui on 13 Sep 2021
i=imread('golf.jpg'); imshow(i); j=rgb2gray(i); imshow(j); n=imread('copy.jpg'); l=imresize(n,0.5); m=rgb2gray(l); imshow(m); [r,c]=size(j); startrow=1; startcol=1; j(startrow:startrow+size(m,1)-1,startcol:startcol+size(m,2)-1) = m; imshow(j); i used this code for watermarking a grayscale image and i can embed the watermark anywhere by replacing the values but it doesnot work for color images how can i watermark a color image?

Answers (2)

Image Analyst
Image Analyst on 14 Apr 2013
You can do that same thing in every color channel.
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Now put in watermark, then recombine
newRGBImage = cat(3,watermarkedRed, watermarkedGreen, watermarkedBlue);
  4 Comments
Image Analyst
Image Analyst on 26 Jul 2019
But you didn't answer my two questions. And I'd have to research it just like you would, but since it's your project, not mine, and it will probably take more than about 5 minutes, I can't afford to donate that much time to you. Sorry. I'm sure you'd do just as good a job of delving into the intricate details as I could.

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!