深度复制cv :: Mat替代品,哪个更好?(Deep copying cv::Mat alternatives, which is better?)

编程入门 行业动态 更新时间:2024-10-26 13:25:56
深度复制cv :: Mat替代品,哪个更好?(Deep copying cv::Mat alternatives, which is better?)

我想要深度复制图像。 哪个性能更好?

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.

更多推荐

本文发布于:2023-08-03 13:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1392018.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:替代品   深度   cv   alternatives   Mat

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!