c++ - opencv: Mat constructor from rect -
i attempting generate subimage opencv matrix data structure follows:
cv::rect sub_image = cv::rect(10, 10, 200, 200); cv::mat submat = original_image(sub_image);
my question if have low level memcpy operations , use submat.data source, pointing correct subimage? guess not documentation seems allude points same dataset.
if so, how can use construct
cv::mat submat = original_image(sub_image);
to copy data well?
use
cv::mat submat = original_image(sub_image).clone();
this deep-copy data of original_image new (probably continuous) matrix.
you use original_image(sub_image).copyto(submat);
reach same, .clone() leads shorter code.
Comments
Post a Comment