Detecting real world objects and comparing it to a shape outline
I'm working on an android app that requires the user to capture a real world object with the same shape as the given outline (app gives circle outline, user finds a circle shaped object and capture it using the camera then app will compare if it is indeed same shape real time).
I'm currently using canny edge detection for detecting the object's contours and outline and matchShape() for the comparison.
My problem is that whenever I capture an object in an uncontrolled environment (to many shapes in the background, bad lighting, object's color blends with background etc), there are a lot of noise around the object and the app automatically mismatch the current object even if it fits.
Is there any way to capture an image inside an outline? And is there a better way of comparing objects and edges aside from getting their contours and use the matchShape function?
I'm hoping for an answer, thanks in advance!