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?
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
Accepted Answer
Image Analyst
on 25 Jan 2016
Edited: Image Analyst
on 25 Jan 2016
See attached demos for drawing.
To distinguish between round blobs and non-round blobs, compute the circularity
circularity = 4*pi*Area / Perimeter^2
8 Comments
Samia Sanjari
on 25 Jan 2016
Edited: Samia Sanjari
on 25 Jan 2016
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.
ok.Thanks.
What was wrong with using imline() like I showed you?
I am now trying it.
Samia Sanjari
on 27 Jan 2016
Edited: Samia Sanjari
on 27 Jan 2016
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.
ok .thanks.
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Products
Tags
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
