Image Processing: Counting Lines in a Range of Angles
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I'm working on a problem right now that involves a method to automate scanning drill core data from a mining property and identifying volume of vein and the angle at which the vein crosses the core axis.
With help from this forum and online, I've gone from the original image to the cleaned image. The cleaned image identifies the veins in the photo quite well.
If possible, it would be great if I could remove the rectangular sample tags and mini whiteboard. This step isn't completely necessary.
The main thing that I now need to do is somehow measure the angle of the veins to horizontal. I need to fit these objects with a line then identify lines between say 15 and 75 degrees (I don't want horizontal or vertical lines). Once they're identified, I need to record the angle to horizontal and count the number of them.
I'm trying to use the hough transform, houghpeaks and houghlines functions but it seems to be only grabbing the long, horizontal lines.
Thanks
0 件のコメント
採用された回答
Amir
2014 年 8 月 14 日
編集済み: Amir
2014 年 8 月 14 日
Hi Cole. Please try this code. I hope it can give you some ideas
clc
clear all
close all
[filename, pathname] = uigetfile('*','File Selector');
I = imread(strcat(pathname,'\',filename)); % for example FileName='MyImage.jpg'
I=im2bw(I);
BW = edge(I,'canny',0.1);
[bw, loc2]= imfill(BW,'holes');
% http://www.mathworks.co.uk/help/images/ref/regionprops.html
rp = regionprops(bw,'All'); % you can specify the parameters which you need
ObjOrient=zeros(size(rp,1),1);
CenterX=zeros(size(rp,1),1);
CenterY=zeros(size(rp,1),1);
for i=1:size(rp,1)
ObjOrient(i)=rp(i).Orientation;
CenterX (i)= rp(i).Centroid(1);
CenterY (i)= rp(i).Centroid(2);
% you can other properties (for example area, perimeter etc here)
end
Final=[ObjOrient CenterX CenterY];
imshow(I);
hold on
for i=1:size(Final,1)
text(Final(i,2),Final(i,3),num2str(Final(i,1)),...
'HorizontalAlignment' , 'center',...
'VerticalAlignment' , 'middle');
end
title('Coordination of Particles - between -90 and +90');
figure
hist(Final(:,1));
title('Histogram');
xlabel('Angle - Degree');
ylabel('Number of objects');
4 件のコメント
Amir
2014 年 8 月 21 日
編集済み: Amir
2014 年 8 月 21 日
Hi Cole Sorry for delay. I wanted to think about this and write a code (if I can) for you. But these days I am very busy and couldn't find any free time to think about this. I think you need to combine object detection (code above) with the colour detection. i.e. for those objects which have -5<orientation <5 (horizontal)find the colour histogram of ORIGINAL image and if white colour is dominant then you can say most likely that object is a label. Hope this helps.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Computer Vision with Simulink についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!