Glass bottle edge detection using Matlab sofware.

14 vues (au cours des 30 derniers jours)
ahmad  aizat
ahmad aizat le 6 Mar 2015
Commenté : Image Analyst le 7 Mar 2015
Hi everyone..i have problem on how to detect the glass bottle by using edge detection method.
As a result..i cant get clear line of the glass bottle mouth and body.. can someone help by checking my code?
this is my code:
I=imread('red5.jpg');
figure, imshow(I);
threshold = graythresh(I);
bw1 = im2bw(I,threshold);
figure, imshow(bw1);
bw2 = bwareaopen(bw1,30);
se = strel('disk',4);
bw3 = imtophat(bw2,se);
figure, imshow(bw3);
d = edge(bw3,'sobel');
figure, imshow(d);
i still new with matlab..any very greatful for those who are helping me..

Réponse acceptée

Image Analyst
Image Analyst le 6 Mar 2015
First of all your lighting is horrible. You shouldn't even think about doing anything until you fix your image capture situation . Use lighting that will eliminate shadows and give a nice high contrast edge. After that, it's just simple thresholding.
And I'm not sure what that algorithm is intended to do but it looks like just a bunch of random functions thrown together in random order - not something designed to "detect the glass bottle" like you asked for. I wouldn't do anything like that. I ought to know, since I've been working on image analysis of glasses and bottles for over 20 years (as part of my job).
  2 commentaires
ahmad  aizat
ahmad aizat le 7 Mar 2015
thanks for your comment sir..ill try to improve my lightning for image capture soon. actually what im trying to do is to change the image capture using edge detection method like sobel,prewit or robert. for the lightning position on the glass bottle..it should be on the top or in 45 degree? and what do you mean by simple thresholding?
Image Analyst
Image Analyst le 7 Mar 2015
Once you have the proper lighting you won't need edge detection. Simple thresholding will work:
binaryImage = grayImage < 128; % Or whatever value works.
You should have the sample be in a white light booth, like an integrating sphere, with light bouncing all around and coming at the bottle from every possible angle. Like a white cylinder or box painted white on the inside with the camera overhead (like you have it already).

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by