我目前正在实施 SIFT 以从图像中提取特征点,并注意到在获取描述符时出现内存泄漏。无论如何我可以释放课堂上可能附加的内存吗?
编辑 向代码块添加了更多详细信息
cv::SiftFeatureDetector* features = new cv::SiftFeatureDetector();
cv::SiftDescriptorExtractor* extractor = new cv::SiftDescriptorExtractor();
std::vector<cv::KeyPoint> KeyPoints;
cv::Mat Descriptors;
// Turn the image into a Mat
cv::Mat mImage = cv::Mat(iplImage);
printf("Searching for keypoints in: %s.\n", szName.c_str());
// Detect keypoints
features->detect(mImage, KeyPoints);
printf("Found %d keypoints.\n", KeyPoints.size());
// Extract descriptors
extractor->compute(mImage, KeyPoints, Descriptors);
printf("Found %d descriptors.\n\n", Descriptors.rows);
// Let my memory go!
delete extractor;
delete features;
任何意见是极大的赞赏。谢谢。