How to remove the camera printed name by manufacturer in images using matlab?

4 次查看(过去 30 天)
Can anyone help me in getting to know the code for removing the camera printed name from manufacturer in any images?
  3 个评论
ezhil K
ezhil K 2018-12-19
编辑:Image Analyst 2018-12-19
I just want the code for removing these unwanted words from image. In this image the words like "Shot on one plus" has to be removed. So I need matlab code for removing these unwanted words in images.
1502388520041.jpg

请先登录,再进行评论。

采纳的回答

KSSV
KSSV 2018-12-20
This is one of the naive suggestion (may be). Off course Image Analyst's would be the best.
I = imread('1502388520041.jpg') ;
txt = ocr(I) ;
R = txt.WordBoundingBoxes ;
imshow(I)
for i = 1:size(R,1)-1
C = [9 118 183]/255 ;
rectangle('position',R(i+1,:),'Facecolor',C,'EdgeColor','none')
end
YOu need to play around with R, to mkae it more perfect.

更多回答(1 个)

Image Analyst
Image Analyst 2018-12-19
The watermark will always be in exactly the same place. So you simply have to make a mask, like I did below:
camera_mask.png
and use it together with regionfill() to fill in the mask area with the surrounding color. Easy, but let us know if you have any problems you cannot solve.
  3 个评论
Walter Roberson
Walter Roberson 2018-12-20
The mask that Image Analyst created shows the places that need to be replaced. You can create a mask from the camera_mask image file that Image Analyst provides, and then you can use that mask with regionfill() on one of your existing color images so that MATLAB fills those locations only.
Image Analyst
Image Analyst 2018-12-20
I'm sure you've looked up the regionfill() documentation to see the one-liner MATLAB code (maybe not though, since you're asking about it), but looks like you've accepted KSSV's answer and so it looks like you've found a solution that's good enough. Keep in mind though that it fills in the whole bounding box with a constant color so you are going to have edge effects with varying background, and it only works for that particular blue color. If the color is anything else, you'll have to determine a new C but you'll still have basically a uniform box on the image. But anyway, glad he was able to provide a solution that works for you. Though I would have done
newImage = regionfill(originalImage, mask);
instead. For a color image, you'll have to regionfill each color channel individually and recombine into the final RGB image.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by