At http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_geometric_transformations/py_geometric_transformations.html I have seen how to geometric transform an image. Depending on the transformation, the resulting image does not fit into a rectangle. How can I crop the image in such a way that I don't have any black background (or in other words, it fits into a rectangle) in such a way that the cropped image is as large as possible? Is there a function for that in openCV?
My question is similar to Rotate image and crop out black borders. Difference is though that I am not just interested in rotated images, but any arbitrary geometric transformation.