Skip to content
Snippets Groups Projects
Commit 884f854b authored by Angel Santamaria-Navarro's avatar Angel Santamaria-Navarro
Browse files

small changes

parent fdecfec2
No related branches found
No related tags found
No related merge requests found
......@@ -152,8 +152,8 @@ void AlgorithmACTIVESEARCH::detectNewFeatures(FramePtr& _frame, const DetectorBa
if (pickEmptyRoi(roi))
{
// draw ROI
if (params_ptr_->draw_results)
drawRoi(image_draw_, roi, getName(), cv::Scalar(255,255,255));
// if (params_ptr_->draw_results)
// drawRoi(image_draw_, roi, getName(), cv::Scalar(255,255,255));
// Detect features in ROI
kps = _det_ptr->detect(_frame->image, roi);
......@@ -229,9 +229,9 @@ void AlgorithmACTIVESEARCH::trackFrame(const FramePtr& _frame_old, FramePtr& _tr
// Set ROI
cv::Rect roi = setRoi(target_feature->kp.pt.x,target_feature->kp.pt.y, cell_size_(0), cell_size_(1));
// draw ROI
if (params_ptr_->draw_results)
drawRoi(image_draw_, roi, getName(), cv::Scalar(0,255,255));
// // draw ROI
// if (params_ptr_->draw_results)
// drawRoi(image_draw_, roi, getName(), cv::Scalar(0,255,255));
// Detect features in ROI
KeyPointVector kps = _det_ptr->detect(_tracked_frame->image, roi);
......@@ -266,12 +266,14 @@ void AlgorithmACTIVESEARCH::trackFrame(const FramePtr& _frame_old, FramePtr& _tr
// If not enough tracked features, add new ones
if (_tracked_frame->features.size() < params_ptr_->min_feat_track)
detectNewFeatures(_tracked_frame, _det_ptr, _des_ptr, params_ptr_->max_new_features - _tracked_frame->features.size());
if (params_ptr_->draw_results)
{
cv::imshow(getName(), image_draw_);
cv::waitKey(1);
}
else
{
if (params_ptr_->draw_results)
{
cv::imshow(getName(), image_draw_);
cv::waitKey(1);
}
}
// Get computation time
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
......
......@@ -111,7 +111,6 @@ void AlgorithmOPTFLOWPYRLK::trackFrame(const FramePtr& _frame_old, FramePtr& _tr
PointVector pts_matched_in_prev;
PointVector pts_prev = _frame_old->getPoints();
// Compute optical flow
if (pts_prev.size() > 0)
cv::calcOpticalFlowPyrLK(frame_gray_prev_, img_gray, pts_prev, pts_matched_in_frame, kpt_is_found, err, params_ptr_->win_size, params_ptr_->max_level, params_ptr_->criteria, params_ptr_->flags, params_ptr_->min_eig_threshold);
......@@ -136,13 +135,15 @@ void AlgorithmOPTFLOWPYRLK::trackFrame(const FramePtr& _frame_old, FramePtr& _tr
// If not enough tracked features, add new ones
if (_tracked_frame->features.size() < params_ptr_->min_feat_track)
detectNewFeatures(_tracked_frame, _det_ptr);
// Draw
if (params_ptr_->draw_results)
{
cv::imshow(getName(), image_draw_);
cv::waitKey(1);
}
else
{
// Draw
if (params_ptr_->draw_results)
{
cv::imshow(getName(), image_draw_);
cv::waitKey(1);
}
}
frame_gray_prev_ = img_gray.clone();
......
......@@ -96,9 +96,9 @@ void AlgorithmTRACKFEATURES::trackFrame(const FramePtr& _frame_old, FramePtr& _t
// Set a candidate ROI around the target feature
cv::Rect roi = setRoi(target_feature->kp.pt.x,target_feature->kp.pt.y, params_ptr_->roi_width, params_ptr_->roi_height);
// draw ROI
if (params_ptr_->draw_results)
drawRoi(image_draw_, roi, getName(), cv::Scalar(0,255,255));
// // draw ROI
// if (params_ptr_->draw_results)
// drawRoi(image_draw_, roi, getName(), cv::Scalar(0,255,255));
// Detect features in ROI
KeyPointVector kps = _det_ptr->detect(_tracked_frame->image, roi);
......@@ -133,12 +133,14 @@ void AlgorithmTRACKFEATURES::trackFrame(const FramePtr& _frame_old, FramePtr& _t
// If not enough tracked features, add new ones
if (_tracked_frame->features.size() < params_ptr_->min_feat_track)
detectNewFeatures(_tracked_frame, _det_ptr, _des_ptr);
if (params_ptr_->draw_results)
{
cv::imshow(getName(), image_draw_);
cv::waitKey(1);
}
else
{
if (params_ptr_->draw_results)
{
cv::imshow(getName(), image_draw_);
cv::waitKey(1);
}
}
// Get computation time
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
......
......@@ -2,15 +2,20 @@ sensor:
type: "USB_CAM"
detector:
type: "FAST"
threshold: 10
nonmaxSuppression: true
neighbor type: 0 #enum { TYPE_9_16=0, TYPE_7_12=1, TYPE_5_8=2 };
type: "ORB"
nfeatures: 100
scale factor: 1.2
nlevels: 8
edge threshold: 8 # 16
first level: 0
WTA_K: 2 # See: http://docs.opencv.org/trunk/db/d95/classcv_1_1ORB.html#a180ae17d3300cf2c619aa240d9b607e5
score type: 1 #enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 };
patch size: 15 # 31
descriptor:
type: "ORB"
nfeatures: 100
scale factor: 1
scale factor: 1.2
nlevels: 8
edge threshold: 8 # 16
first level: 0
......@@ -28,7 +33,7 @@ algorithm:
grid horiz cells: 10
grid vert cells: 10
margin: 0
separation: 2
separation: 5
min features to track: 20
max new features: 100
min response new features: 80
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment