Reputation: 103
I have a cv::Mat src (type: CV_32F) with size 11000x1085.
Get a row data
cv::Mat dst = src.row();
If I want to get data from column 4 to 1085, I do this way.
for(int i = 0; i < 11000; i++)
for(int j = 3; j < 1085; j++)
dst.at<double>(i,j-3) = src.at<double>(i,j);
Is there another way to do that faster?
Upvotes: 1
Views: 2407
Reputation: 2454
It depends if you want to make a deep copy of the data or not. You may want to construct a region of interest (ROI) as described on this helpful tutorial, which describes other methods to work with the cv::Mat to structure your data:
To create a region of interest (ROI) for a rectangle:
Mat Dst (src, Rect(3, 0, 11000, 1085) );
If you want copy the data:
Mat Clone = Dst.clone();
Upvotes: 2