Distinguish between lines and spots in a grayscale image

4 vues (au cours des 30 derniers jours)
Ritird
Ritird le 1 Nov 2016
Commenté : Ritird le 9 Nov 2016
Hi everyone,
I have to find a way to distinguish between lines and spots in a grayscale image like the one below, marking them with different colours (i.e. red for lines and blue for spots). My problem is that everything is mixed up and it is difficult to divide lines from everything else. Any ideas?
I would very thankful if you could help me!
Rita
Image:

Réponse acceptée

Changoleon
Changoleon le 1 Nov 2016
Hi, what are all those tiny dots around the center of the image? In the center, you clearly have some lines. You could do the following to distinguish the lines:
b = double(imread('tomo.png'))/255;
a = rgb2gray(b);
H1 = fspecial('sobel');
H2 = H1';
hor=imfilter(a,H1);
ver=imfilter(a,H2);
mag = sqrt( hor.^2 + ver.^2 );
ori = atan(ver./hor);
ang=(ori+pi).*(ori<0)+ori.*(ori>=0);
mag_pi = mag./pi;
mask1 = (mag_pi>=0.2);
lines = medfilt2(mask1,[5 5]);
imagesc(a); colormap gray;
figure
imagesc(lines); colormap gray
Well, this solution is based on edge detection. What you could also do is tho find the skeleton of those lines using skiz
  1 commentaire
Ritird
Ritird le 9 Nov 2016
Hi, the image is a tomography made on a damaged composite panel and the dots are probably delaminations.
Thank you very much for your answer, it is very useful! Could you explain me what the code does? I am not very familiar with image analysis...

Connectez-vous pour commenter.

Plus de réponses (1)

Image Analyst
Image Analyst le 2 Nov 2016
I have no idea which irregularly shaped blobs in your image you consider to be lines or spots, roundish spots I presume. I don't see either shape. All I see is a bunch or irregularly shaped white blobs plot some small black dots. What you could do is to threshold to find the bright blobs, then ask regionprops to find the Solidity and MajorAxisLength and MinorAxisLength and take the ratio of the lengths. See my Image Segmentation Tutorial for a full demo of using regionprops(). http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862

Catégories

En savoir plus sur Image Segmentation and Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by