1 | initial version |

Hi,

I don't know if it is particularly efficient but you can do the following using repeat

```
Mat src ...; // your 3XN matrix
Mat lastRow = src.row( 2 );
Mat tmp;
repeat(lastRow, tmp, 3, 1 ); // create a tmp matrix of 3xN whose elements are repeated elements of the last row of src
src = src / tmp;
```

This is like doing

```
src = src./repmat(src(3,:), 3, 1)
```

in matlab. Otherwise another way to do it is to pass element by element and do the division

```
for(int i =0; i<src.cols; ++i )
{
// you should first check that the last element is !=0 !!!
src.at<float>(0, i) /= src.at<float>(2, i);
src.at<float>(1, i) /= src.at<float>(2, i);
}
```

and replace <float> with the correct type of your matrix.

Hope it helps.

S.

Copyright OpenCV foundation, 2012-2018. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.