• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Detecting Polygons and/or Circles in a clear image?(with standard c/c++ libs)

Status
Not open for further replies.
Level 12
Joined
Feb 22, 2010
Messages
1,115
Assuming following things,

-Image file is known(lets say jpg), including file format
-2d image(can be painted or photographed from air)
-Color of the area inside shapes may be same or not with background color(in case it is, border of shape has a distinct color)
-Background may have different colors
-No shape collide with each other

Attachment is an example.(4 shapes there)

It is asked to implement this with lowest amount of memory(well, just means additional libraries are not allowed, no need to sacrifice any readability)And I am completely lost here.Also there is a black and white image with 3 shapes, if it makes a difference can someone guide me about what to do from there?
 

Attachments

  • shapedetection.jpg
    shapedetection.jpg
    18.6 KB · Views: 148
  • shapedetectionsimple.jpg
    shapedetectionsimple.jpg
    15.9 KB · Views: 108

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
If I recall the process flow goes something like this.
1. Library construction.
2. Object recognition.

1. Is where you set up your standard library for your object recognition. You perform object recognition on "perfect shape" images, each with exactly 1 shape and no feature noise. You then add these to the match library keeping track of which shape is which.
3. You run the matcher on the input image. If a shape has a lot of good matches then it is that shape. If it has a lot of poor matches then chances are it is not the shape. You can also get the position and rotation of the shape to some extent (with matching error).

For object recognition I would recommend something like SIFT however that is quite resource intensive. SURF is an alternative which produces similar results using less processing resources. These libraries perform the basic object recognition process, something you do not want to program yourself.

Edge detection might help due to the distinct colour of shapes (thus they are surrounded by a strong edge). I am not sure where to go beyond that by itself however (might be useful for generating more distinct features for matching).
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Well, thanks for your response and sorry for my late one.

I searched for these SURF/SIFT things and I couldn't find a standalone version, instead I found things like implementing SURF via opencv and things like that which makes me use additional library.Maybe I can't find right things.

Is there a simpler(well I mean, simpler when compared to complex objects) algorithm I can use for basic geometric shapes?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
Here you go...
SIFT (well it was a link from the wiki).

The Wikipedia page also lists all kinds of detection algorithms. I would recommend reading through them to find the one which bests suits your problem. I only mentioned SIFT because that was one I had experience using in matlab.
 
Status
Not open for further replies.
Top