转载自:https://blog.csdn.net/u011344545/article/details/88530872
I=imread('heidong.jpg');
figure(10), imshow(I);
t =I(486 : 511, 505 : 625, 1 : 3);%估计水印区域
figure(1), imshow(t);
t1 = t(:,:,1);
figure(2), imshow(t1);
t2 = t(:, :, 2);
figure(3), imshow(t2);
t3 = t(:, :, 3);
figure(4), imshow(t3);
[m,n] = size(t2)%行数m,列数n
for i = 1:m
for j = 1:n
if t2(i,j) >= 50
t2(i,j) = 0;
end
end
end
figure(5), imshow(t2);
for i = 1:m
for j = 1:n
if t3(i,j) >= 50
t3(i,j) = 0;
end
end
end
figure(6), imshow(t3);
for i = 1:m
for j = 1:n
if t1(i,j) >= 50
t1(i,j) = 0;
end
end
end
figure(7),imshow(t1);
for i = 1:m
for j = 1:n
t(i,j,1) = t1(i,j);
t(i,j,2) = t2(i,j);
t(i,j,3) = t3(i,j);
end
end
figure(8), imshow(t);
for i = 1:26
for j = 1:121
I(i + 485, j + 504, 1:3)=t(i, j, 1:3);
end
end
figure(9), imshow(I);