how to segment a tray image with regular pocket pattern ?

1 view (last 30 days)
Hello everyone,
I am working on a project which need to find how many pockets (rectangular or square shapes) in a tray image and location of those pockets.
The image is acquired by a webcam with quite uniform illumination. The pockets have same size for the same type of tray but for different tray their size are varied. Please see below link for the image:
Can anyone advise a robust way to segment those pockets out? As the color of the tray may also vary, what is the best approach to handle do such problem?
Thank you very much!
Best regards,
Di

Accepted Answer

Image Analyst
Image Analyst on 15 Aug 2013
Your illumination may be uniform but your image is not. If your illumination is uniform then you have bad vignetting (shading) due to your lens. Take a blank shot and then fit a 2D polynomial to it, then divide your images by the modeled, perfect background to "flat field" your image.
To find the pockets, simply sum your image vertically and horizontally. Then threshold to find the rows and columns that have dark stuff and bright stuff in them. Knowing the rows and columns locations you can easily find the locations of the rectangles defining the pockets, and of course the count also. Give that a try.
  6 Comments
Di
Di on 23 Aug 2013
Image Analyst, thank you for your helps! I really appreciate it.
The above link is the result of 2nd tray image. There are a few reduntant small regions. To remove them, I am thinking to
1. smooth('rloess') the x and y profile data, find all composed bw areas using a threshold of 0.9* max(profile_value); 2. based on the size of areas, use k-means clustering to segment a set of max areas as the pocket regions.
Do you think will this approach be robust?
Image Analyst
Image Analyst on 23 Aug 2013
It looks like you have serious problems getting a good image. Why can't you get a consistently good image? Anyway, it looks like the tray is in a jig (holder), so why can't you just use fixed, known positions?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!