问题描述
在学校项目中我想做以下步骤在matlab中制作水图像
in a school project i would like to do the following step to have a watermaked image in matlab
- 从图像中提取边缘
- 在此边缘插入标记
- 重建图像
- 提取标记
- extract the edges from an image
- insert a mark on this edge
- reconstruct the image
- extract the mark
有人可以给我一个链接,以便知道如何做或帮助我做到这一点?
提前谢谢
could some one give me a link to have a good idea how to do it or help me to do that?thank you in advance
推荐答案
您想为图像添加水印吗?为什么不覆盖整个事物。
You want to add a watermark to an image? Why not just overlay the whole thing.
如果您有图像
img = imread('myimage.jpg')
wm = imread('watermark.jpg')
你可以将水印大小调整为图像大小
You can just resize the watermark to the size of the image
wm_rs = imresize(wm, [size(img,1) size(img,2)], 'lanczos2');
img_wm(wm_rs ~= 0) = wm_rs; %This sets non-black pixels to be the watermark. (You'll have to slightly modify this for color images)
如果你想把它放在图像的边缘,你可以像这样提取它们
If you want to put it on the edges of the image, you can extract them like this
边缘=边缘(rgb2gray(img),'canny')
edges = edge(rgb2gray(img),'canny')
然后你可以设置边缘存在的像素为水印像素
Then you can set the pixels where the edges exist to be watermark pixels
img_wm = img;
img_wm(edges ~= 0) = wm_rs(edges~=0);
如果您使用混合的img和wm_rs像素值,您可以使用它来代替直接分配要透明度。
Instead of direct assignment you can play around with using a mix of the img and wm_rs pixel values if you want transparency.
您可能需要调整一些我说的彩色图像,但大多数应该是相同的。
You'll probably have to adjust some of what I said to color images, but most should be the same.
这篇关于如何在matlab中使用边缘在图像上嵌入水印?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!