how to implement visible watermark on image in matlab ??
Show older comments
hi , i want to algorithm to implement visible watermark in image
2 Comments
K.G Praveen Raj
on 3 Apr 2019
I want the code for adding text watermark on the image
Image Analyst
on 3 Apr 2019
What does that mean? Do you mean you want to hide text in an image, like my attached program? Or do you want to watermark an image with an image of text (like my other attached demo)?
Answers (1)
Image Analyst
on 23 Dec 2014
0 votes
Simply average the two images, or paste it in, like my attached demo shows. Let me know if you need further help.
7 Comments
Abdalla Mansour
on 23 Dec 2014
Image Analyst
on 23 Dec 2014
It still can work. See this demo code:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
image1 = imread('peppers.png');
% Get the dimensions of the image.
[rows1, columns1, numberOfColorBands] = size(image1);
subplot(2,2,1);
imshow(image1);
image2 = imread('onion.png');
% Get the dimensions of the image.
[rows2, columns2, numberOfColorBands] = size(image2);
subplot(2,2,2);
imshow(image2);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
canvass = zeros(size(image1));
canvass(1:rows2, 1:columns2, :) = image2;
% Mask the image using bsxfun() function
blendedRgbImage = (double(image1) + canvass) / 2;
subplot(2,2,3);
imshow(uint8(blendedRgbImage));
% Create the final image, where the "zero" part is not half intensity.
finalRGBImage = image1;
finalRGBImage(1:rows2, 1:columns2, :) = blendedRgbImage(1:rows2, 1:columns2, :);
subplot(2,2,4);
imshow(finalRGBImage);
Abdalla Mansour
on 24 Dec 2014
Image Analyst
on 24 Dec 2014
You're welcome. Can you then go ahead and please officially mark it as solved by clicking the "Accept this answer" link? Thanks in advance.
Gayathri Jagan
on 30 May 2016
how does imread for peppers.png and onion.png work even if they are not present in the MATLAB folder?
Image Analyst
on 30 May 2016
Edited: Image Analyst
on 25 May 2020
You'd have to specify the full path (folder plus base file name), unless it's on the search path, which you can see by typing path on the command line. For a specific file, you can find the folder it's in by using the fileparts() and which() functions:
>> folder = fileparts(which('peppers.png'))
folder =
'C:\Program Files\MATLAB\R2020a\examples\deeplearning_shared\data'
Mrutyunjaya Hiremath
on 25 May 2020
Matlab Folder is NOT only ‘Current Working Folder’.
Matlab search all paths that exist in MATLABPTH.
One can check with the Matlab command ‘path’ in the command window.
Matlab stores some images, videos and relevant data in its respective toolbox demo folders.
Like images ‘onion.png’ and ‘peppers.png’ in the below path (example). This path presents in MATLAB search path.
“Matlab Installation Folder\toolbox\images\imdemos”
Example: C:\Program Files\MATLAB\R2012a\toolbox\images\imdemos
Categories
Find more on Watermarking in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!