How can I remove unwanted edges and link those one wanted?

I am working on a yoyo classifier and one of my descriptors will be a mask of the round shape and the cord. Therefore, I have to segment this from the background. So, I've done canny edge detection after an unsharp mask but I obtain the background edges too and my edges of the yoyo aren't all of them connected. So how could I remove the unwanted background edges and link the yoyo's ones. Then I will be able to segment the yoyo region and apply imfill and regionprops.
This im my code:
I = imread('249_0019.jpg'); [rows columns RGB] = size(I); if RGB > 1 I = I(:,:,2); end I = im2double(I); h = fspecial('unsharp'); I = imfilter(I,h,'replicate'); I = edge(I,'canny',[0.05 0.2]); I = bwareaopen(I,90);
I've tried some morphological operations but I get link all the edges (both background and foreground).

Risposte (0)

Richiesto:

il 5 Mag 2016

Community Treasure Hunt

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

Start Hunting!

Translated by