title: Corner points from an image to redraw the outline it in Matlab or Python
body: <p>I have one image. I want to get the coordinates in order so that the image can be redrawn. The image may be complex. I want to get sampled corner coordinates to redraw the outline of the image. <br/></p>
  
  <p><strong>Attempt 1: <code>corner</code> function</strong></p>
  
  <p>I tried to detect the corner using <code>corner()</code> in matlab but it is not giving exact point. The corners are lying outside. The original image is attached below.</p>
  
  <p><img src="https://i.stack.imgur.com/tNuX9.jpg" alt="asd"></p>
  
  <p>My code for corner detection is:</p>
  
  <pre><code>It=rgb2gray(I);
  Itt=im2bw(It);
  Itt1=corner(Itt);
  imshow(Itt);
  hold on
  plot(Itt1(:,1), Itt2(:,2), 'r*');
  </code></pre>
  
  <p>The output of corner detection is attached below:<br/></p>
  
  <p><img src="https://i.stack.imgur.com/yz7O9.jpg" alt=""></p>
  
  <p><strong>Problem with <code>corner</code>:</strong> If you zoom the image, you will find that the some corners don't lie on boundaries. So, please suggest some efficient and good working method.</p>
  
  <p><strong>Attempt 2: <code>bwtraceboundaries</code></strong></p>
  
  <p>I also tried using <code>bwtraceboundaries</code> and corners to order the corner in terms of <code>bwtraceboundaries</code> output but the corner is not being exactly detected. </p>
  
  <p><strong>Question:</strong> Can you please suggest how can I detect the corner or is there any other method to extract the sampled corner points from the image so that the outline can be redrawn?</p>