These days very painful to learn the next use of Matlab to deal with the image, in fact, those algorithms I think it is not difficult to understand, but Matlab this anti-human grammar (may be for me, after all, familiar with C + +/Java syntax for a time difficult to turn over) tortured me for a long time.
Some days ago, I saw a picture on the Internet:
Want PO on the circle of friends, but also feel that the bottom right corner of the watermark is not very good, so I would like to use just learn the little of the Matlab knowledge to remove the watermark? Show your My Low code:
First, read the picture:
>> I = imread ('d:\ course file \ image processing \image\beizi.jpg');
Then, visual water printed in the original image of the approximate location, to extract it:
>> t = I (490:544):1:3);
Imshow (t) show up and look, it's like this:
The RGB 3 components of T are then extracted separately:
1 ); >> Figure , imshow (t1); 2 ); >> Figure , Imshow (T2); 3 ); >> figure, Imshow (T3);
The difference is this:
Because T2 and T3 are similar, and black-and-white, directly look at the contents of the two matrix, found that the text part is really different from the gray value of the dark part, so no matter 3,721, direct violence to cut off those parts of whites, that is, text:
[M,n] = size (T2)for1: M for1: n if20 6; End EndEnd
Do the same with T3, then the two sub-graphs are as follows:
for 1 : M for 1 : N if - 6; End EndEnd
Next to T1, because the gray value of the white text is very close to the background color, so you need to be very careful to find a good boundary value:
for 1 : M for 1 : N if About ; End endendimshow (t1);
The effect is as follows: (feeling can also ~)
Then it is to merge the 3 sub-graphs that are handled well:
for 1 : M for 1 : N T (i,j,1) = T1 (i,j); T (i,j,2) = T2 (i,j); T (i,j,3) = t3 (i,j); Endendfigure, Imshow (t);
The combination of good picture effect is as follows: (hehe, the feeling of the coming success ~)
Finally, put the corner of the processed artwork back into the original image:
for 1: 1:161489439 1 :31:3); Endendfigure, Imshow (I);
The final figure is as follows:
Although you can see the faint traces, but the first time to get this, it feels like this O (* ̄▽ ̄*) o
Hope that the master can teach the next ~ ~
A preliminary examination of Matlab watermark removal