how to cut an area of image ?

조회 수: 28 (최근 30일)
Zineb EL MORCHID
Zineb EL MORCHID 2016년 3월 9일
댓글: Zineb EL MORCHID 2016년 3월 9일
I want to cut the center area of an image , and save it as another image that ill work on it later . how can I do so , I do know a function " imcrop() " but I dont know how to detect the center of the image . heres an exemple of what I want :

채택된 답변

Image Analyst
Image Analyst 2016년 3월 9일
Try this:
[rows, columns, numberOfColorChannels] = size(yourImage);
left = columns/2 - width/2;
top = rows/2 - height/2;
croppedImage = imcrop(yourImage, [left, top, width, height]);
imshow(croppedImage);
You need to define width and height in pixels for the size of the box you want to crop out.
  댓글 수: 1
Zineb EL MORCHID
Zineb EL MORCHID 2016년 3월 9일
Thanks , I appreciate it :)

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by