Borrar filtros
Borrar filtros

Cut/crop out region of image

3 visualizaciones (últimos 30 días)
Andre Munoz
Andre Munoz el 24 de Mayo de 2017
Comentada: Andre Munoz el 24 de Mayo de 2017
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,

Respuesta aceptada

KSSV
KSSV el 24 de Mayo de 2017
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 comentario
Andre Munoz
Andre Munoz el 24 de Mayo de 2017
That is excellent.
Thank you.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by