Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how is b=a.clone() different than a.copyTo(b)? which is faster?

For an image processing demo I need to squeeze every bit of optimization out of my code to get a higher frame rate, but I'm familiar with hardware programming (VHDL) and not so much with CPU programming languages. So it's not clear to me how much faster code can run by moving statements such as variable declarations outside of loops and functions, i.e., does encountering a type declaration millions of times actually slow down execution? To this end, there also seem to be different methods to performing the same OpenCV array tasks on Mat types. My big question at this time is whether I should use clone or copyTo if I simply want to make a copy of an existing Mat array. Does it matter if the dst array has already been declared with the same size as the src? Thanks.