![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175399/image.png)
Image Processing: Detect Quartz Veins in Photos
1 view (last 30 days)
Show older comments
Hi,
I was hoping to get some help. I'm trying to automate a procedure to detect quartz veins in core photos from a mining database. I've converted the images to binary using a variety of gray theshold values. The problem is that it detects too much of the wooden box, tags etc.
If I manually crop out just the rock, the results are much better. This is unrealistic through because I need a way to batch process.
Here is the original photo and a binary version. As you can see, too much of the box is selected and a bunch of other stuff. I need to select only the white quartz veins that cut through the gray rock.
I'm quite new to image processing so I apologize if this is a fairly simple problem.
Thanks for your help!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/145098/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/145099/image.jpeg)
0 Comments
Accepted Answer
Image Analyst
on 14 Aug 2014
It's not a simple problem. On the face of it, it might look simple but I can foresee all kinds of possible problems. What I would start off with is doing color segmentation - basically find the brown pixels. See my File Exchange for examples. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
But there might be cases where the "white" marble is very close in color to the light brown wood. Have you looked at the 3D color inspector to see the full 3D color gamut? As you can see below, there is quite a bit of overlap/blending between the colors. It's not like you have 3 very well separated colors.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175399/image.png)
1 Comment
Image Analyst
on 14 Aug 2014
You might try some type of edge/ridge/line finding operations to get hte wood shelves. You might need to combine that with the color info to get better spatial masking of stone and wood regions. Maybe something like edge(), hough(), houghlines() or anisotropic diffusion (demo attached).
For stone color I'd probably first try segmenting for
hsv = rgb2hsv(rgbImage);
h = hsv(:,:,1);
s = hsv(:,:,2);
v = hsv(:,:,3);
stone = v < 0.2 | s < 0.3;
imshow(stone);
Adjust the thresholds to improve segmentation.
More Answers (2)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!