Detect sub-image(Irrespective of scale/angle) and crop that part from main image
Hi everyone,
This is the issue of matching two images, one is the smaller one and other (main) image is the larger one.
Here, i see it can be done by Template Matching, but template matching cannot be of use here because it doesn't work with scaled or rotated images.
What I want to do is to look for template/sub-image in the bigger image and if it is detected, extract/crop that part from the main (larger) image.
As I am getting main image from camera and i have to look for my template in it, due to camera frame, it can be of different scale and orientation so i need to implement maybe SURF/SIFT and i have no idea how to use it with OpenCV for Unity.
I am attaching sample images.
Kindly help if anyone knows the solution/algorithm for it.
Here it can be seen that, images can have variance in their size and color. Irrespective of these, how can we detect template and crop that colored part from main image?
Please help.
there is no "Opencv for Unity". (what are you talking about?)
Are you sure? You can search it in Unity Asset Store, there is a package for around $100 there.
Either way, is there any C# solution? I would gladly convert it in UnityScript if someone has done this kind of thing.
sorry, let me be more clear: there is no support from opencv for anything c# at all.
any wrappers you might see out there, are independant, 3rd party, might have there own warts, and the opencv devs won't take any responsibility for problems with those.
then, note, that SIFT/SURF are patented, and you'll have to get a license, if you intend to sell your software.
That's fine.
But are you talking on behalf of OpenCV itself? If not then can u kindly give the directions for the solution? I'm myself not here for exact code for it, i just needed guide lines, and i guess that is why we can ask a question here. Can you tell if we can do this with OpenCV? regardless of any platform?
then, due to one image being "textured", and the other not, you won't find many "matching" features between both.
maybe read a bit here ?
Yes you're right, but i have just seen SURF working, it maybe able to detect it even if we put colors and leave the borders.
But i want to crop that detected colored part.
I have found the half solution to it.
I can run a SURF algorithm and draw the keypoint in a new image.
Anyone knows from here how can we crop the detected part from Main Image? Is there any API in OpenCV which can make image out of SURF's detected location in main image?
I can attach current code if required.