These changes are added to simplify porting to UMat.