Is it possible to count the bolts in this image?

6 visualizaciones (últimos 30 días)
Nathan Hughes
Nathan Hughes el 29 de Mzo. de 2017
Comentada: androidguy el 29 de Mzo. de 2017
Hello,
I've been practicing my segmentation on a number of different challenges, this one I've been having a lot of problems with and was hoping I could get a pointer in the right direction. I'm confident it's fairly simple, my methods are just the wrong ones.
Any help is greatly appreciated!
  2 comentarios
Matt J
Matt J el 29 de Mzo. de 2017
What's the method that hasn't worked?
androidguy
androidguy el 29 de Mzo. de 2017
Try this?
clear variables
clc
close all
warning off
I1 = imread('screws.png');
figure, imshow(I1), title('original image');
I = rgb2gray(I1);
figure, imshow(I), title('original image');
[~, threshold] = edge(I, 'sobel');
fudgeFactor = .8;
BWs = edge(I,'sobel', threshold * fudgeFactor);
figure, imshow(BWs), title('binary gradient mask');
se90 = strel('line', 3, 90);
se0 = strel('line', 3, 0);
BWsdil = imdilate(BWs, [se90 se0]);
figure, imshow(BWsdil), title('dilated gradient mask');
BWdfill = imfill(BWsdil, 'holes');
figure, imshow(BWdfill);
title('binary image with filled holes');
BWnobord = imclearborder(BWdfill, 4);
figure, imshow(BWnobord), title('cleared border image');
seD = strel('diamond',1);
BWfinal = imerode(BWnobord,seD);
BWfinal = imerode(BWfinal,seD);
figure, imshow(BWfinal), title('segmented image');
BWoutline = bwperim(BWfinal);
Segout = I;
Segout(BWoutline) = 255;
figure, imshow(Segout), title('outlined original image');

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Image Filtering and Enhancement en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by