The project I am doing is to detect stones in an image of a jewel, so as to get the idea of the deduction to be made in the gross weight of the jewel.
I have done image-segmentation in the HSV color space following this paper. If given a raw input like
IMAGE1 below, the method I follow is three-fold:
- using "gold" pixels threshold values I detect the gold part in the image (
- then I detect the background/foreground in the image as the background is known to be white (
- intersection of the outputs of the first 2 steps --
not GOLD && FOREGROUND => STONE(
Apart from this, I have tried using the flood-fill algorithm to flood the gold / stone pixels based on some pre-known seed points. But due to the non-uniform illumination and the fineness of the image, flood-fill didn't produce good results. Also the
up_diff values (in the OpenCV implementation) are not universally fixed and need to be changed for each query point.
I also tried using template matching in it's naive form but the complications of variance of the occurrence of the template in the query image led to that method being not applicable everytime. And if the stone type is irregular, then template matching gives erratic results.
Segmentation in the HSV color space yielded better and more generally applicable results than the previous two methods. But as visible in the results of the 4 sample images previously mentioned, that too has it's own limitations, like
- In the second image, due to poor illumination all of the background is (wrongly) detected as being foreground.
- In the first image, due to (very) slight illumination problem in the left-top corner, the detected area is blown up.
- Similar noisy issues are visible in the last 2 results.
Is there a better way of solving the problem? Can someone suggest some improvements to the current approach?
Suggestions at an altogether new approach are also welcome. Is it possible to implement a machine learning approach to the problem apart from image-processing? Can someone give any specific pointers in that direction?