I would like to use matchShapes() function to find an object inside a query image.
Let’s say I have a model image of a book, i want to extract its shape and then try to find this book (its shape) inside another image.
I have googled a lot but couldn’t find any real example on how to use matchShapes to achive this. The documentation lacks. Can someoen make a little example in C++ ?
Thanks a lot! (Note I know I can use SIFT/ORB etc, but i want to use matchShapes())
Step 1: Detect contour of book and store it in
vector<Point>.Step 2: Detect contours on another image.
Step 3: Iterate over detected contours and match shape detected in Step 1 with each contour detected on another image. You have detected
vector<vector<Point> >contours. Iterating over them you pass modelvector<Point>from Step 1 andvector<Point>from contours tomatchShape()function. See my answer here how to usematchShape()function.Note that book must have the same shape on another image as on model image. It can only be rotated, displaced or scaled.