Ask Your Question

Revision history [back]

Since your image contains black pixels there is no simple and safe way to distinguish where are black pixels from background and where -- from you image. You'd better create rectangle mask for every source image and then transform every mask the same way you transform every source images for stitching. Then you will have a very precise and correct mask.

If you want just to crop it use Rect to create submatrix from matrix:

UMat crop = src(Rect(left, up, width, height));