How to remove a part of image?
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
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
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 Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!