How to get a ROI / submat of a larger matrix by-reference in Kotlin


I have a large matrix and want to access a submatrix using a ROI. However, the “normal” syntax does not work in Kotlin:

val mat = Mat(1000, 1000)
val submat = mat(10, 10) //<-- fails

I tried using val submat = mat.submat(10,10) but there changes to submat are not shown in mat. Same goes for val submat = Mat(mat, Rect(0, 0, 10, 10)).

Any recommendations?

how do you expect this to work with 2 coords only ?,org.opencv.core.Range)

Just a typo in the example given above, it’s val submat = mat.submat(0, 10, 0, 10)