how to cut an area of image ?
19 views (last 30 days)
Show older comments
Zineb EL MORCHID
on 9 Mar 2016
Commented: Zineb EL MORCHID
on 9 Mar 2016
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 :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/157255/image.png)
0 Comments
Accepted Answer
Image Analyst
on 9 Mar 2016
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.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!