it's bad practice to use references as class members. pointers or simply Mat's are better (I use pointers). Then the hidden copy constructor could be removed too.