@krodyush Please, use CV_32FC1 for type of the matrix.