Exemplo n.º 1
0
/*----------------------------- get_next_scan -------------------------------*/
int get_next_scan( int nscan)
  {

  if ( nscan != 1)
    {              // we don't need to fit and save at the begining 
    fit_thresh(nscan-1);
    save_hist(nscan-1);
    print_scan_result(nscan-1);
    HDELET(0);
    }
  init_hist (nscan);
  return 0;
  }
Exemplo n.º 2
0
void DetectWithOF5::detect(cv::Mat &origin, std::vector<cv::Rect> &targets, int &flipped_index)
{
	origin_ = origin;
	curr_ = now();
	++frame_idx_;

	// 保存历史
	save_hist(origin);

#if 0
	// FIXME: 从最后的diff历史中,找可能的目标位置
	//	在积分图中搜索 ...
	cv::Mat bin_diff = hist_.rget_diff(0);
	std::vector<cv::Rect> ts = find_diff_clusters(bin_diff);
	for (int i = 0; i < ts.size(); i++) {
		cv::rectangle(origin_, ts[i], cv::Scalar(255, 255, 255), 2);
	}
#endif

	// 从最新的diff中,查找轮廓, 合并轮廓..
	CONTOURS regions;
	find_contours(regions);
	cv::drawContours(origin, regions, -1, cv::Scalar(0, 255, 255), 1);

	// 合并轮廓到“活动区域”
	merge_motions(regions);
	draw_motions();

	// 对 motion 进行跟踪 ...
	tracking_motions();
	draw_tracking();

	// 稠密光流
	sum_motions_dense_of();
	draw_motions_dense_of();

	// 返回
}