title: How to do circular crop using matlab?
body: <p>I usually use <code>imcrop</code> to crop rectanguler image but i wat to create circular crop. How to do it?</p>
  
  <p>I know there is another quetion about this, here the link:</p>
  
  <ol>
  <li><p><a href="https://stackoverflow.com/questions/4651778/matlab-how-do-i-crop-out-a-circle-from-an-image">MATLAB: how do I crop out a circle from an image</a></p>
  
  <pre><code>[xx,yy] = ndgrid((1:imageSize(1))-ci(1),(1:imageSize(2))-ci(2));
  mask = (xx.^2 + yy.^2)&lt;ci(3)^2;
  </code></pre>
  
  <p>and the result of <code>imshow(mask)</code> is rectangle with white background</p></li>
  <li><p><a href="https://stackoverflow.com/questions/16015287/cropping-circular-region-of-interest-around-a-point-in-matlab">Cropping Circular region of interest around a point in MATLAB</a></p>
  
  <p>error in <code>roimaskcc</code></p></li>
  <li><p><a href="http://www.mathworks.com/matlabcentral/newsreader/view_thread/242489" rel="nofollow noreferrer">http://www.mathworks.com/matlabcentral/newsreader/view_thread/242489</a></p>
  
  <pre><code>[xx,yy]=ndgrid(1:size(X,1), 1:size(X,2));
  CroppingMask= ( (xx-Xcenter).^2+(yy-Ycenter).^2&lt;=Radius^2 );
  X=X.*CroppingMask;
  </code></pre>
  
  <p>The result of <code>imshow(CroppingMask)</code> is a rectangle with black background with small white circular at the center of the rectangle. When I run line 3 it shows an error.</p></li>
  </ol>
  
  <p>Please help me, step by step because I'm a beginner.</p>
  
  <p>Here is my image: <a href="https://www.dropbox.com/s/5plqzqgyb1ej6gh/patricia.jpg" rel="nofollow noreferrer">https://www.dropbox.com/s/5plqzqgyb1ej6gh/patricia.jpg</a>. It resolution is 480x640.</p>