How to remove a part of image?

3 ビュー (過去 30 日間)
quest
quest 2015 年 4 月 13 日
編集済み: Ananthu Jayan 2018 年 1 月 8 日
Hello,
I want to work with an image, but the problem is - how to remove a part of it? Is there any way to remove (or replace with black color) a rectangular place from image? I tried imcrop a rectangle, but I don't know how to use the rest of image (I only know how to edit the rectangle).
Thanks a lot.

採用された回答

Thomas Koelen
Thomas Koelen 2015 年 4 月 13 日
編集済み: Thomas Koelen 2015 年 4 月 13 日
testimage=imread('pout.tif');
imshow(testimage)
H=imrect(gca);
pos=wait(H);
close all
testimage(pos(1,2):pos(1,2)+pos(1,4),pos(1,1):pos(1,1)+pos(1,3))=0;
imshow(testimage);
run this, it will let you create a draggable square, select the part of the image that you want to make black and then double click on the square, it will save your updated image to testimage. you can also set the 0 to something like mean2(testimage) so it's not completely black.
  1 件のコメント
Ananthu Jayan
Ananthu Jayan 2018 年 1 月 8 日
編集済み: Ananthu Jayan 2018 年 1 月 8 日
Error in masking (line 11)
testimage(pos(1,2):pos(1,2)+pos(1,4),pos(1,1):pos(1,1)+pos(1,3))=0;
I am getting an error like this. kindly help me with the value of positions.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by