Different operations with matrix in Opencv