This buffer  is used in some other structures in the code bellow, so cv::Ptr is not useful here.