I think you simply neglected to trace the full boundary of the shape. Though I traced very quickly and unneatly, the result I get below shows what you should be getting when you trace the full boundary.
Yes I used imfreehand and upon your suggestion of tracing the boundary, i tried to find the bwboundaries of the mask. Do i need to use B = bwtraceboundary(BW,P,fstep) for tracing the boundaries? How can i automatically feed the coordinates of the end points to be removed.
The below code, i use to crop the image with closed option and the create a mask of the cropped region.
Hi Matt, Thanks for the reply. I have so many such structures in a image, I want to manually crop these structures and find the edges as shown in the depicted output.
Hi Image Analyst, Thanks for the reply. I have so many such structures in a image, I want to manually crop these structures and find the edges as shown in the depicted output.
But why? If you need to crop each (which may not even be necessary) and can do it automatically by using regionprops() to get the bounding box and imcrop to get a subimage, why would you want to do it manually.
See my image segmentation tutorial in my File Exchange to see how to crop automatically.
See my attached imfreehand() demo to do it manually.
And please explain why you want the edges. Because many, many times novices think the first step in any image analysis algorithm is edge detection when it rarely is, and can be analyzed better without doing edge detection.
OK, no explanation for why you need edges - I guess it's proprietary or something.
However my masking demo will allow you to mask freehand-drawn regions with optional cropping into a subimage if you want. Does it not do what you want? You can still detect edges if you feel that is definitely the best approach.
Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.
Translated by
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.