summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Tracker_PT/point_extractor.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-12-14 15:24:29 +0100
committerStanislaw Halik <sthalik@misaki.pl>2013-12-14 15:24:29 +0100
commit5f3126dd862c93e3a514dcf0910d24b840f7e90c (patch)
tree48c0a7988fa5c39097df6c26041c086c06884801 /FTNoIR_Tracker_PT/point_extractor.cpp
parenta202162dec69293dd0b56ff867e3ffa708b8a6d3 (diff)
pt: don't crash since hysteresis support
Reported-by: runningman84 GitHub: issue #15
Diffstat (limited to 'FTNoIR_Tracker_PT/point_extractor.cpp')
-rw-r--r--FTNoIR_Tracker_PT/point_extractor.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/FTNoIR_Tracker_PT/point_extractor.cpp b/FTNoIR_Tracker_PT/point_extractor.cpp
index 27a14713..d9ff0a5b 100644
--- a/FTNoIR_Tracker_PT/point_extractor.cpp
+++ b/FTNoIR_Tracker_PT/point_extractor.cpp
@@ -14,9 +14,6 @@ using namespace std;
PointExtractor::PointExtractor(){
- first = true;
-
-
//if (!AllocConsole()){}
//else SetConsoleTitle("debug");
//freopen("CON", "w", stdout);
@@ -28,6 +25,10 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr
const int W = frame.cols;
const int H = frame.rows;
+ if (frame_last.cols != W || frame_last.rows != H)
+ {
+ frame_last = cv::Mat();
+ }
// clear old points
points.clear();
@@ -60,9 +61,8 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr
threshold(frame_gray, frame_bin_low,std::max(float(1), t - (t*hyst)), 255, THRESH_BINARY);
if(draw_output) frame_bin.copyTo(frame_bin_copy);
- if(first){
+ if(frame_last.empty()){
frame_bin.copyTo(frame_last);
- first = false;
}else{
// keep pixels from last if they are above lower threshold
bitwise_and(frame_last, frame_bin_low, frame_last_and_low);