关键点检测器的
我们可以从背景减影图像中提取关键点吗?我从视频中提取关键点,首先减去它的背景,但它显示了运行时错误
if (! previous_frame.empty()) {
subtract(current_frame, previous_frame, predict_img);
detector.detect(predict_img, keypoint2);
if (keypoint2.size > 20) // Error
{
RetainBestKeypoints(keypoint2, 20);
}
else
{
//Want to ignore the frame , but how ?
}
代码中提到了错误,
detect()
方法输出关键点的std::vector
。因此,您应该调用keypoint2.size()
而不是不带括号的size
。
除此之外,并且假设差异的类型与关键点检测器兼容,是的,您可以(计算差异图像或背景图像上的关键点)。