Here is the reference Image
Here is the test image.
I wanted to know which algorithm can help me in mapping test image shape to the reference image shape, so that both of them overlap perfectly.
OpenCv Python.
Here is the reference Image
Here is the test image.
I wanted to know which algorithm can help me in mapping test image shape to the reference image shape, so that both of them overlap perfectly.
OpenCv Python.
You can find out keypoints in one of your images using any of the keypoint detection methods available in openCV(harris, FAST. e.t.c). You can then track those points in your other image and then compute rotation translation using 'findessentialmatrix' and 'recoverPose' openCV functions. Once you get your rotations and translation you can rotate your first image with those values to excatly map them on top of each other.
here are the functions you can call one after other ( check for inputs and dependencies from opencv page):
1) FAST for keypoint detection
2) Lukas kanade for keypoint tracking
3) findEssentialMatrix
4) recoverPose
A similar case with step by code and a walk through is given in the OpenCV tutorials here.
It wont work for the simple example you show because there is no unique mapping. Your blue square is uniform and thus there is no way to know if it has been rotated by 45, 135, 225, or 315 degrees. So you will either need to make your images non-rotationally symmetrical or give them texture rather than a uniform colour.