The Python script and the two XML files must be place in the same directory as the Images you want to crop.
Libraries Used - OpenCV Library NumPy
You can download OpenCV for Windows from https://sourceforge.net/projects/opencvlibrary/?source=typ_redirect
and for Linux or Mac from https://codeload.github.com/opencv/opencv/zip/2.4.13
Setup instructions available at http://docs.opencv.org/2.4/doc/tutorials/introduction/table_of_content_introduction/table_of_content_introduction.html#table-of-content-introduction
EDIT: http://milq.github.io/install-opencv-ubuntu-debian/ also has a nice walkthrough, if you want a black box approach
UPDATE: @AdityaVerma use this :P https://stackoverflow.com/questions/30331944/finding-red-color-in-image-using-python-opencv