title: Find out which blob has the pixel location [x,y]?
body: <p>I have a labelled blob image using bwlabel, I want to find a blob which has the pixel location [x,y] and display it by removing the rest of blobs.
  Here is the code I wrote, but it doesn't give correct answer, please fix this</p>
  
  <pre><code>[y, x] = ginput(1);
  x = round(x);
  y = round(y); % here x and y is a location of blob i want to keep
  
      BW = bwlabel(newImgg,4) ; % labelled image contains several blobs
  %     figure, imshow(BW, [])
      props = regionprops(logical(BW),'all');
      while(1)
          for k = 2:length(props)
              if ismember([x,y],props(k,1).PixelList) == [1, 1];
                  keeperIndex = k;
                  break
              end
          end
          break
      end
  
      keeperBlobsImage = ismember(BW, keeperIndex);
      keeperBlobsImage = imfill(keeperBlobsImage,'holes');
      figure, imshow(keeperBlobsImage,[])
  </code></pre>
  
  <p>Thanks,</p>
  
  <p>Gopi</p>