Azzera filtri
Azzera filtri

How can I highlight a bounded region of an image when the user clicks inside that boundary?

1 visualizzazione (ultimi 30 giorni)
Is there a method to return the image of just one cell and make rest of the image white? I need to highlight a cell using a mouse click and show just the cell, it is surrounded by a boundary. Should I use bwperim?
This is the cell. it is surrounded by white pixels. I need to click on a seed point and return the cell image within the white boundary and discard the rest of the image to white. I have used ginput for the mouse click.
  2 Commenti
Cedric
Cedric il 3 Mag 2013
Modificato: Cedric il 3 Mag 2013
This wasn't your smartest move .. and it is likely that the question will be restored.
Randy Souza
Randy Souza il 16 Mag 2013
I have restored the original text of this question.
@Ralph: this question has a clear subject and an accepted answer, so it may be valuable to someone else in the future. If you have a good reason why it should be removed from MATLAB Answers, please flag the question, explain why it should be deleted, and an administrator or high-reputation contributor will consider deleting the question. Please do not simply edit your question away.

Accedi per commentare.

Risposta accettata

Image Analyst
Image Analyst il 26 Apr 2013
There are lots of ways. Probably the easiest is to label your binary image (the one you used to create the perimeter from). Then from ginput(), get the label at that point and use ismember(labeledImage, labelNumber) to extract that particular blob from the binary image of all the blobs. Then you can do whatever you want to do, such as measure that blob only, or use that blob as a mask to blacken the original gray scale image outside the blob, or whatever else you want to do. Your request to "return the cell image within the white boundary" is not detailed enough to know what you mean - it's ambiguous, and there are several things that that could mean. See if you can do it yourself. Here are the steps for you do complete:
  1. call bwlabel on the binary image
  2. ginput on the labeled image
  3. turn x,y into row,column integers
  4. get value of the labeled image at that row, column.
  5. extract blob with that value from labeledImage using ismember
  6. binarize that and multiply it by the original image.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by