Link to home
Start Free TrialLog in
Avatar of rigor_mortis
rigor_mortis

asked on

Shape recognition in VB

Hi yall,

i'm looking in to a project where we need to develop a program (preferably in VB.NET) that scans an image and recognizes contours of several similar chapes. After the contours have been recognized i need to compute the measures of each shape and compute those numbers around a bit more.

I've been looking around on the net for libraries and example code of things that can do that, mostly the shape recognition and contour assignment, but i havent been very succesfull. So my question is, firstly is it actually possible to program this (i think it is, but hey i could be wrong), and secondly where could i find more information, libraries / controlles i would need and perhaps even same sample code on the subject?

Any help is appreciated!!
Kind regards,
rigor mortis
Avatar of Mikal613
Mikal613
Flag of United States of America image

Good luck! ;)
Avatar of rigor_mortis
rigor_mortis

ASKER

hehe, i dont hope you want points for that remark ;)
Cute:

An idea though popped up perhaps you can read each pixel and get its color and based on the Color change you can determine what shape it is (same color shapes pending though)
As I can remember (from the Image Processing course that I followed years ago) the shape recognition is usually made of the following steps:

1) contour extraction (usually made by a convolution mask applied on the image)

2) Removal of isolated pixels (and small groups of pixels too)

3)Recognition of the borders (previously extracted and cleaned) you have to find coordinates of segments that best fit with the contour pixels

I think that VB NET could be a little slow for this purpose but I don't know other problems
Do your shapes have some similarity that can simplify your work? Or are you trying to do a more general program?
Make sure the image doesn't use too many colors.
16 colors would be a good idea.
Then make the the difference between background and foreground flexible so you can try to see which value works best.
Should then be fairly easy to write code to trace the image, then choose waypoints every 100 pixels or so to more clearly define the shape.

Good luck, and I hope this isn't homework.

bukko
mmusante,

yeah those are the steps i was thinking of as well (sounds like we had the same course :)), the thing just is that i can hardly find any information on how to program that, or where to purchase function libraries that support those steps, and dont even get me started on sample sources on the matter...

So that's really my problem, finding function libraries that incorporate functions to take those steps and some sample code on how to best implement them...

thanks for the help so far guys...
Bukko,

the supplied image will come from a b/w camera (perhaps with an infrared lamp connected for pictures taken at night), so it's all greyscale.

Well i was thinking of applying a threshold and making it a 2-bit picture, i hope the pictures will be 'clear' enough to make a certain range in the colors 1 and converting the rest to 0. Then cleaning up the picture (removal of isolated pixels as mmusante put it so elequently) and then computing the remaining contours.

I will get some sample pictures on monday, so hopefully i can make an education judgment on whether or not they are usuable...

and no it's not homework :) it's a project for a customer, so well, perhaps you might interpret that as homework :)
Oh btw, if anybody knows of a good book on the subject, they're welcome to recommend something...
Hi I'm back :)

have a look here ... (http://omni.isr.ist.utl.pt/~alex/resources.html)

mostly C and C++ things but two ActiveX too ...

I hope it can help you
ASKER CERTIFIED SOLUTION
Avatar of mmusante
mmusante

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey guys,

sorry for my abscence, was on holiday last couple of weeks. I'll check out the links asap and get back to you lot.
sorry for the delay, the project is still on hold because we haven't sorted out the camera problem yet, i.e. getting decent, workable, feed to the computer... i'll accept mmusante's answers because he put in the most effort and because his links will prove helpfull once the thing finally gets from the ground...

kind regards,
rigor mortis
Thanks!