Ask Your Question

Revision history [back]

In C++, the definition of NULL is 0.

When you dereference a pointer, it is your responsibility to make sure it points somewhere valid. A common solution is to set all pointers as NULL (if they don't point to anything). Then, you check for that before accessing the pointer. It is common to set them to NULL when you delete or free() them.

In opencv > 2.0 Mat::clone calls Mat::copyTo. If you don't provide a mask for copyTo() function, it's the same as clone(). So i think, it's the same idea behind cvCopy and cvCloneImage.