Simple shape recognition
Hi guys!
I'm doing a simple game project for university. The tricky part is the input: The game has to be controlled via WebCam (the player is waving around a blue postcard in front of the cam).
Now here's the problem: How can I find the position and rotation of the postcard from the captured image? I already post-processed the image a little to make it Black and white. Take a look at the pictures below:
First one shows the post processed image (256x256), the second one what I would like to have (the four corners).
So for the human eye it's very easy to find the rectangle in this picture...but for my PC?
I actually don't have the slightest clue how to approach this...
Can you help me out?
Suggestion #1:
1) "morphological open" to reduce noise
2) apply edge detector, e.g. Canny
3) hough transform, extract 4 highest peaks (assuming you know the target is always a quadrilateral)
4) intersect lines to find corner points
Suggestion #2:
1) edge-preserving smooth filter (e.g. bilateral)
2) segment the image using boundary representation of regions
3) calculate min-area oriented bounding box
Both will probably do well, it's just a question of convenience depending on what libraries you have available - more low-level image processing, or rather geometric tools.
1) "morphological open" to reduce noise
2) apply edge detector, e.g. Canny
3) hough transform, extract 4 highest peaks (assuming you know the target is always a quadrilateral)
4) intersect lines to find corner points
Suggestion #2:
1) edge-preserving smooth filter (e.g. bilateral)
2) segment the image using boundary representation of regions
3) calculate min-area oriented bounding box
Both will probably do well, it's just a question of convenience depending on what libraries you have available - more low-level image processing, or rather geometric tools.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement