title: Finding pixel location of centroid in a region
body: <p>I have an image in Matlab where I am finding the all the centroids in it. There are multiple centroids in the image and I am using 'imellipse' to seclude one of them. I am trying to find the pixel location of one of centroids. Having the location pop-up in the command window of Matlab will be good enough.
  Here is my code: </p>
  
  <pre><code>% --- Executes on button press in pushbutton15.
  function pushbutton15_Callback(hObject, eventdata, handles)
  % hObject    handle to pushbutton15 (see GCBO)
  % eventdata  reserved - to be defined in a future version of MATLAB
  % handles    structure with handles and user data (see GUIDATA)
  A = imread('PET_MRI_Brain_Tumor.jpg');
  Z = imshow(A)
  Ibw = im2bw(A);
  Ibw = imfill(Ibw,'holes');
  Ilabel = bwlabel(Ibw);
  stat = regionprops(Ilabel,'centroid');
  imshow(Z); hold on;
  for x = 1: numel(stat)
      plot(stat(x).Centroid(1),stat(x).Centroid(2),'bx');
  end
  e = imellipse(gca,[55 10 120 120])
  BW = createMask(e,Z)
  </code></pre>
  
  <p>Here is the picture where I am trying to extrapolate the pixel location of the centroid marker.
  <a href="http://imgur.com/DnSQTUi" rel="nofollow">http://imgur.com/DnSQTUi</a></p>