Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个垫子:
A: size(1,640) B: size(640,480)
我想将 A 复制到 B 的第一列,所以我使用A.copyTo(B.col(0)). 但这失败了。怎么做?
A.copyTo(B.col(0))
你在正确的轨道上!Mat:col是要使用的匹配工具:)
Mat:col
但请注意,简单地将一个列分配给另一个列不会像您预期的那样工作,因为Mat:col只是为您指定的矩阵列创建一个新的矩阵标题,并且没有数据的真实副本。
示例代码:
B.col( 0 ) = A.col( 0 ); // won't work as expected A.col( 0 ).copyTo( B.col(0) ); // that's fine