how to crop an image

3 ビュー (過去 30 日間)
Martin Zima
Martin Zima 2014 年 3 月 12 日
回答済み: Dishant Arora 2014 年 3 月 12 日
Hallo , im new here and i would like to know, how to crop an image on all sides by 10 percent ???
  • a=imread('image1.jpg');
  • ....

回答 (2 件)

Doug Hull
Doug Hull 2014 年 3 月 12 日
im = imread('pout.tif')
[r,c] = size(im)
per = 0.1
left = round(per*c);
right = c-left;
top = round(per*r);
bottom = r-top
newIM = im(top:bottom, left:right);
imshow(newIM)

Dishant Arora
Dishant Arora 2014 年 3 月 12 日
[rows cols planes] = size(imageArray);
rect = [fix(cols*0.10) , fix(row*0.10) , fix(cols*0.80) , fix(rows*0.80)];
croppedImage = imcrop(imageArray , rect);

製品

Community Treasure Hunt

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

Start Hunting!

Translated by