Added license header, using cv::Ptr, small fixes.