How to Fill a segmented image
Show older comments
Im trying to segment a photo and the program only segmentates a part of it, what do i have to add to segment the whole photo. Im trying to fill the segmented image but it fills a part, not the complete photo, this is the code that im using:
clear all clc
IO=imread('FotoJuan.jpg'); IOG=rgb2gray(IO);
[~, threshold] = edge(IOG, 'sobel'); fudgeFactor = .5; BWs = edge(IOG,'sobel', threshold * fudgeFactor);
se90 = strel('line', 2, 90); se0 = strel('line', 3, 0); BWsdil = imdilate(BWs, [se90 se0]);
BWdfill = imfill(BWsdil, 'holes');
% BWnobord = imclearborder(BWdfill, 4); % % seD = strel('line', 1, 90); % BWfinal = imerode(BWnobord,seD); % BWfinal = imerode(BWfinal,seD);
etiqueta = bwlabel(BWdfill, 4); numObjetos = max(max(etiqueta)); numObjetos
subplot(2,2,1); imshow(IO); title('Imagen Original');
subplot(2,2,2); imshow(IOG); title('Imagen en escala de grises');
subplot(2,2,3); imshow(BWdfill); title('Dilated Gradient Mask');
Im going to attach the original photo and the one who shows how is segmented, Hope you can help me :)
Accepted Answer
More Answers (0)
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!