Ask Your Question

Creating ROI from defined point

asked 2013-06-12 02:14:12 -0600

NAYOSO gravatar image

Hello I want to detect a sheet of paper and I already achieve it by detecting edges and find the largest square possible but the result isn't always good. I want to try another solution even I'm unsure this approach will be better or not. My new approach is to create a kind of marker in every corner of the paper (this will be printed manually on the paper) and detect the location of the marker after that draw a line between every marker then creating a perfect rectangle around the paper. So what's in my mind is to use template matching to detect the marker, and then detect the position of every marker, my question is is there any better method to achieve this approach (using marker)?

Thank You

edit retag flag offensive close merge delete


hmm, template matching will not work, if your paper sheet is rotated

berak gravatar imageberak ( 2013-06-12 02:40:32 -0600 )edit

@berak hmmm how about feature matching?actually I just want to be sure of the location of the corner of the paper

NAYOSO gravatar imageNAYOSO ( 2013-06-12 02:47:00 -0600 )edit

@berak Shouldn't it work if the markers are round and in one solid color?

Guanta gravatar imageGuanta ( 2013-06-12 02:51:22 -0600 )edit

@Guanta oh, probably yes. could only think of crosses, personally

berak gravatar imageberak ( 2013-06-12 02:53:19 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-06-12 03:58:51 -0600

Template matching is not good when your object is rotated or scaled.

features2d methods to extract keypoints

FAST is simple and fast but doesn't keep information about angle of points of interest. SURF and SIFT are slower, but their information about points of interests are bigger (angles). SIFT and SURF allow you to find scale-invariant matches. If you want scale invariant: BRISK, paper brisk

(FAST, STAR, SIFT, SURF, ORB, BRISK,... are supported in OPENCV: FeatureDectectors)


I did (some time ago) something similar to recognize some sheets. The steps are:

  1. Find keypoints of your sheet
  2. Extract descriptors from those keypoints
  3. Find keypoints of your scene image
  4. Extract descriptors from keypoints
  5. Match descriptors by matcher

In order to extract descriptors, see DescriptorExtractors

Match descriptors by matcher: DescriptorMatcher

Here are to good tutorials:

  1. Find a known object
  2. Guide using SURF feature detector

image description image description

edit flag offensive delete link more


Thank you for your response! I think this one will work. I'll try it first then I'll accept your answer then thank you :)

NAYOSO gravatar imageNAYOSO ( 2013-06-12 07:04:22 -0600 )edit

Question Tools


Asked: 2013-06-12 02:14:12 -0600

Seen: 722 times

Last updated: Jun 12 '13