필터 지우기
필터 지우기

Cut/crop out region of image

조회 수: 3 (최근 30일)
Andre Munoz
Andre Munoz 2017년 5월 24일
댓글: Andre Munoz 2017년 5월 24일
Hi
I am trying to cut/crop out the centre region of an image using coordinates, so that I am left with a blank region. I.e, something similar to the opposite of imcrop. Or even change the values to zero.
An example image has been provided where I would like to remove the square white signal in the centre and keep the remaining image.
Thank you,

채택된 답변

KSSV
KSSV 2017년 5월 24일
How about this?
I = imread('Original.jpg') ;
[nx,ny] = size(I) ;
% h = imdistline ;
dx = 50 ; % calulated from imdistline
idx = round([(nx/2-dx) (nx/2+dx)]) ;
idy = round([(ny/2-dx) (ny/2+dx)]) ;
I0 = I ;
I(idx(1):idx(2),idy(1):idy(2)) = 0 ;
imshow(I)
  댓글 수: 1
Andre Munoz
Andre Munoz 2017년 5월 24일
That is excellent.
Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Build Interactive Tools에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by