How can access vector <cv::Mat> data by using ptr or data method?
How can access vector <cv::mat> data by using ptr or data method?
I used at method for access vector <cv::mat> data.
This Method is so slow, so I would like to change ptr or data method.
This is my code. How can I change?
vector<Mat> conc_img;
vector<Mat> loss_img(conc_img);
for (int iter = r_start; iter < r_start + h_size; iter++) {
for (int nframe = 0; nframe < conc_img.size(); nframe++) {
part_x[nframe][cnt][0] = loss_img[nframe].at<float>(iter, ref_p[0]);
part_x[nframe][cnt][1] = loss_img[nframe].at<float>(iter, ref_p[1]);
part_x[nframe][cnt][2] = loss_img[nframe].at<float>(iter, ref_p[2]);
part_x[nframe][cnt][3] = loss_img[nframe].at<float>(iter, ref_p[3]);
}
}
there is alot of context missing. what are you trying to achieve here ?
Hi, thank you for your attetnion from my problem.
I used part_x[nframe][cnt][0] = loss_img[nframe].at<float>(iter, ref_p[0]); I know about <at> for accessing Mat. However, I did not know using about ptr or Data for accessing Mat.
How can I use ptr or Data for accessing Mat? Can you change the sentence?
as long as you're traversing rows, you don't have consecutive memory.
but why are you doing it that way ? we can't help without further information/context