我想要深度复制图像。 哪个性能更好?
cv::Mat new_img(old_img, true);(这第一个不完全正确,检查我的答案)或
cv::Mat new_img = old_img.clone();(我问它,因为第二个对我来说更具吸引力,但是我不确定我的情况有多糟糕。也许我甚至会定义一个常数CV_CLONE = true ...以防第一个更好。)
I want to deep copy an image. Which is better for performance?
cv::Mat new_img(old_img, true);(this first one is not entirely correct, check my answer) or
cv::Mat new_img = old_img.clone();(Im asking it because the second one is more appealing for me in terms of being to the point, but Im not sure how much worse off I am. Maybe I would even define a constant CV_CLONE = true... in case the first one is better.)
最满意答案
通过查看源代码,您可以准确地看到每个人做了什么。 构造函数是00172,clone是00346.两者都调用相同的内部函数copyTo,所以我认为它们在性能方面基本相同。
You can see exactly what each does by looking at the source code. The constructor is 00172, clone is 00346. Both call the same internal function copyTo so I would imagine they are essentially the same in terms of performance.
更多推荐
发布评论