I'm totally stuck on an issue regarding the segmentation of glassy objects. I need to get the object as precise as possible. My approaches were different. At first I tried to remove the background, so that only some sharp contours are left. But that only works for objects which have sharp edges / gradients. Otherwise the object itself is also removed. I posted two different images.
I tried to remove the background via morphological operations, like grayscale dilatation and a divison on it. but it didnt help much. after it, I tried a k-means with k=3 for getting the modified background separated from the gray and black values of the glass. That wasn't successfull in some cases, but not overall/in average. I also tried to make a canny edge detection with an overall blured filter, but that lead to weaker results in form of open contours, a lot of noise, etc. pp.
Canny with automatic threshold results:
testimg = imread('https://i.stack.imgur.com/Y6YO0.png');
imshow(testimg)
imedges = edge(testimg,'canny');
imshow(imedges);
Same goes for the second image.
As you can see, there is a lot of noise inside and outside and doubled edges from the glas border. Even there are gaps in the edges.
So, I need your advices for getting a general approach for dealing with this problem of half-transparent materials, not for just these two images.
1) Other ideas for removing the background without damaging the object?
2) Other segmentation methods for getting the object separated from the background?
If it's possible, then with Matlab, IPT or statistical toolbox hints. Any other hints are also welcome!
Thank you for your answer in advance. Sincerely