I need help to identify the border and compare the images with the original image. I need guidance on How can I achieve this through processing or matlab or anything for beginne
If you want to detect your object in an environment more complex (rotation, deformation, scaling, perspective), you need a detection method more efficient. I suggest you to see what is called a "cascade classifier for Haar features" OpenCv can propose you a lot of function to do this method rapidly. See this useful page
Or even by matlab you can see this example