Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Size classification (IMAQ Vision with VB)

Dear Sir/Madam ,
I'm developing a size of object classification system. I'm writing software with VB6 and IMAQ Vision OCX . The objects is put on a conveyer and every objects has different size. Now I can
- capture the image of the object.
- Calculate a histogram
- do a threshold .Background is black and object is
white color
- calculate object size by count number of white pixel(object) over the black color(background)
My problem is if there is a dirty on the object , then do a threshold , the dirty things are become black colr on the object(white),so the size calculation will be wrong.
My idea to solve this problem is
- find the edge of the object
- find number of pixel inside the object (don't care

whether black or white )

My question is
- What method or property to find the edge of the object ?
- What method or property to find or count number of pixel inside the edge ?

Best regards,
0 Kudos
Message 1 of 3
(3,135 Views)
The simplest method would be to use Fill Holes to fill all the holes after you threshold. Another tool that might be useful is Convex, which fills in any concave surfaces on the edge of your object. This will only work with convex objects, though.

After using these routines, just use Quantify or Particle Analysis to get the area of the object. I would probably use Particle Analysis and search for the largest object to eliminate any small particles stuck to your background.

Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 3
(3,135 Views)
Thanks a lots.
0 Kudos
Message 3 of 3
(3,135 Views)