'How do I perform row arithmetic in OpenCVSharp?
In c++ I can perform row arithmetic on a matrix:
Mat pPrime = Mat::ones(Size(3, 3), CV_64F);
pPrime.row(0) = pPrime.row(0) / pPrime.row(2);
Is it possible to perform row arithmetic with OpenCVSharp? Trying to duplicate the c++ code results in the error The left-hand side of an assignment must be a variable, property or indexer
Mat pPrime = Mat.Ones(new Size(3, 3), MatType.CV_64F).ToMat();
pPrime.Row(0) = pPrime.Row(0) / pPrime.Row(1);
Solution 1:[1]
I know this is old, but I was looking for the answer to this and found the answer in the opencvsharp repo here
Your example would translate to this:
Mat pPrime = Mat.Ones(new Size(3, 3), MatType.CV_64F).ToMat();
using var pPrimeRow0 = pPrime.Row(0);
using var pPrimeRowDevided = pPrime.Row(0) / pPrime.Row(1);
pPrimeRowDevided.CopyTo(pPrimeRow0);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | krjw |