I have an OpenCV Mat, and I would like to remove the first column. Is there a nice built-in way of removing specific columns from a matrix?
You can use Mat::col(int j)
method to get first column
Mat m;
Mat col1 = m.col(0)
Or, you can use Mat::colRange(int startCol, int endCol)
to get original matrix without the first column:
Mat noCol1 = m.colRange(1, m.cols)
Remember that the actual data is not copied, it is shared with the original matrix. to get copy of that value, you may use Mat::clone()
.
More info: Opencv 2.3 docmentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With