MATLAB Answers

0

how to crop an image

Asked by Martin Zima on 12 Mar 2014
Latest activity Answered by Dishant Arora on 12 Mar 2014
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');
  • ....

  0 Comments

Sign in to comment.

Products

2 Answers

Answer by Doug Hull on 12 Mar 2014

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)

  0 Comments

Sign in to comment.


Answer by Dishant Arora on 12 Mar 2014

[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);

  0 Comments

Sign in to comment.