Image Processing: Counting Lines in a Range of Angles

7 views (last 30 days)
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

Accepted Answer

Amir
Amir on 14 Aug 2014
Edited: Amir on 14 Aug 2014
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 Comments
Cole
Cole on 14 Aug 2014
Hi Amir,
If I can get this to work well enough, I have over 20,000 images to analyse :)
This is a side project as part of my MSc thesis work. I'm using a discrete fracture network to model quartz vein data. One of the hardest parts is getting accurate veining information. The dataset that I'm using for a case study has information on intensity but not very good information on distributions of angles and thickness.
If I can automate this well enough to work, I can process photos of 200,000 meters of drill core and generate vein volume plus angle and thickness distributions which I need for the fracture simulation.
This is my first foray into image processing. It's very interesting though!
Cole
Amir
Amir on 21 Aug 2014
Edited: Amir on 21 Aug 2014
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.

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!