use const cv::Mat& instead of shared_pointer