How can i draw lines over my image lines?I want to do it to find how many repeating line structures are present in my image.Also I want to separate the line plots and oval shapes.How can i do that?

 Accepted Answer

See attached demos for drawing.
To distinguish between round blobs and non-round blobs, compute the circularity
circularity = 4*pi*Area / Perimeter^2
You can get area and perimeter from regionprops() like my Image Segmentation Tutorial shows

8 Comments

Hello ,Image Analyst
I used that code to draw horizontal line by selecting the data points,But when I tried to draw line vertically by using the same concept I am getting again the horizontal line.How can I draw vertical line by using that'insert shape' command?.
I = imread('repeated2.jpg');
l = rgb2gray(I); d=edge(l,'sobel') %figure; %imshow(d)
%g=strel('disk',7) bw=imclose(d,g) %figure; %imshow(bw) u=double(bw)
image_size=size(bw)
RGB = insertShape(u, 'line', [242,262, 1650,246;220,532,1614,508;216,694,1624,678;202,878,1646,862;272,86,1562,104], 'LineWidth', 10);
figure;
imshow(RGB)
Thanks in advance
I didn't use the insertShape command because I don't have that toolbox.
Hello, Image Analyst
I am facing problem to separate the blobs from other parts . I want to separate the blobs from the image and want to represent other blobs by different colors which area are less than 600.I tried to separate them by representing the blobs center by different color,but I failed. Here is my code and image that i got from the last part of my code --------------------------------------------------------------------------------------------
I = imread('repeated
2.jpg');
l = rgb2gray(I); d=edge(l,'sobel')
g=strel('disk',7) bw=imclose(d,g)
u=double(bw)
image_size=size(bw)
RGB = insertShape(u, 'line', [242,262, 1650,246;220,532,1614,508;216,694,1624,678;202,878,1646,862;272,86,1562,104;184,976,278,26;426,994,482,16;646,990,662,16;852,976,830,22;1047,970,980,16;1226,960,1162,24;1288,924,1274,44;1450,900,1370,24;1654,906,1544,16], 'LineWidth', 10);
figure;
imshow(RGB)
labeledImage = bwlabel(bw,8);
coloredLabels = label2rgb (labeledImage, 'hsv', 'k', 'shuffle');
figure imshow(coloredLabels);
blobMeasurements = regionprops(labeledImage,'perimeter','Area','FilledArea' ,'Centroid');
numberOfBlobs = size(blobMeasurements, 1);
textFontSize = 14; labelShiftX = -7;
for k = 1 : numberOfBlobs blobArea = blobMeasurements(k).Area; blobCentroid = blobMeasurements(k).Centroid; fprintf(1,'#%2d %17.1f %11.1f %8.1f %8.1f %8.1f % 8.1f\n', k, blobArea, blobPerimeter, blobCentroid); text(blobCentroid(1) + labelShiftX, blobCentroid(2), num2str(k), 'FontSize', textFontSize, 'FontWeight', 'Bold'); end
allBlobAreas = [blobMeasurements.Area];
keeperIndexes = find( allBlobAreas > 600); ;
keeperBlobsImage = ismember(labeledImage, keeperIndexes);
labeledDimeImage = bwlabel(keeperBlobsImage, 8); figure imshow(labeledDimeImage, []);
Here is the image that i got by using center of blobs
i only want to get the circular type objects not the line objects Please help me
The area and the area-to-perimeter square ratio should be enough to discriminate between the two.
There is a new function called bwpropfilt() that lets you extract blobs based on standard measurements, but not computer ones like area-to-perimeter squared.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!