manually ```new / delete``` is not exception-safe. I suggest to replace it by ```std::vector``` or ```cv::AutoBuffer```