summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_pt
diff options
context:
space:
mode:
Diffstat (limited to 'ftnoir_tracker_pt')
-rw-r--r--ftnoir_tracker_pt/FTNoIR_PT_Controls.ui96
-rw-r--r--ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp1
-rw-r--r--ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h2
-rw-r--r--ftnoir_tracker_pt/point_extractor.cpp40
-rw-r--r--ftnoir_tracker_pt/point_extractor.h1
5 files changed, 31 insertions, 109 deletions
diff --git a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui
index 0e6048c3..39fb0686 100644
--- a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui
+++ b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui
@@ -259,19 +259,6 @@
<string>Point extraction</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
- <item row="0" column="4">
- <widget class="QSpinBox" name="mindiam_spin">
- <property name="toolTip">
- <string>Minimum point diameter</string>
- </property>
- <property name="suffix">
- <string> px</string>
- </property>
- <property name="maximum">
- <number>1024</number>
- </property>
- </widget>
- </item>
<item row="0" column="1" colspan="2">
<widget class="QSlider" name="threshold_slider">
<property name="toolTip">
@@ -297,81 +284,59 @@
</property>
</widget>
</item>
- <item row="1" column="4">
- <widget class="QSpinBox" name="maxdiam_spin">
- <property name="toolTip">
- <string>Maximum point diameter</string>
- </property>
- <property name="suffix">
- <string> px</string>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Min size</string>
</property>
- <property name="maximum">
- <number>1024</number>
+ <property name="buddy">
+ <cstring>mindiam_spin</cstring>
</property>
</widget>
</item>
- <item row="1" column="3">
- <widget class="QLabel" name="label_8">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
<property name="text">
- <string>Max size</string>
+ <string>Threshold</string>
</property>
<property name="buddy">
- <cstring>maxdiam_spin</cstring>
+ <cstring>threshold_slider</cstring>
</property>
</widget>
</item>
- <item row="1" column="1" colspan="2">
- <widget class="QSlider" name="threshold_secondary_slider">
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="mindiam_spin">
<property name="toolTip">
- <string>Per pixel hysteresis width (leave left if there is little difference between dot and non-dot, move right for increased stability against pixel noise)</string>
- </property>
- <property name="maximum">
- <number>255</number>
- </property>
- <property name="pageStep">
- <number>1</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <string>Minimum point diameter</string>
</property>
- <property name="tickPosition">
- <enum>QSlider::TicksBothSides</enum>
+ <property name="suffix">
+ <string> px</string>
</property>
- <property name="tickInterval">
- <number>25</number>
+ <property name="maximum">
+ <number>1024</number>
</property>
</widget>
</item>
- <item row="0" column="0">
- <widget class="QLabel" name="label">
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_8">
<property name="text">
- <string>Threshold</string>
+ <string>Max size</string>
</property>
<property name="buddy">
- <cstring>threshold_slider</cstring>
+ <cstring>maxdiam_spin</cstring>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_secondary">
- <property name="text">
- <string>Hysteresis</string>
- </property>
- <property name="buddy">
- <cstring>threshold_secondary_slider</cstring>
+ <item row="2" column="1">
+ <widget class="QSpinBox" name="maxdiam_spin">
+ <property name="toolTip">
+ <string>Maximum point diameter</string>
</property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>Min size</string>
+ <property name="suffix">
+ <string> px</string>
</property>
- <property name="buddy">
- <cstring>mindiam_spin</cstring>
+ <property name="maximum">
+ <number>1024</number>
</property>
</widget>
</item>
@@ -1150,9 +1115,6 @@
<tabstop>fps_spin</tabstop>
<tabstop>fov</tabstop>
<tabstop>threshold_slider</tabstop>
- <tabstop>mindiam_spin</tabstop>
- <tabstop>threshold_secondary_slider</tabstop>
- <tabstop>maxdiam_spin</tabstop>
<tabstop>model_tabs</tabstop>
<tabstop>clip_tlength_spin</tabstop>
<tabstop>clip_theight_spin</tabstop>
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp
index 86178cb3..e7f1384d 100644
--- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp
+++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp
@@ -44,7 +44,6 @@ TrackerDialog_PT::TrackerDialog_PT()
tie_setting(s.cam_res_y, ui.res_y_spin);
tie_setting(s.cam_fps, ui.fps_spin);
- tie_setting(s.threshold_secondary, ui.threshold_secondary_slider);
tie_setting(s.threshold, ui.threshold_slider);
tie_setting(s.min_point_size, ui.mindiam_spin);
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h
index 14786013..4e241bc3 100644
--- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h
+++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h
@@ -18,7 +18,6 @@ struct settings_pt : opts
cam_res_y,
cam_fps,
threshold,
- threshold_secondary,
min_point_size,
max_point_size;
@@ -41,7 +40,6 @@ struct settings_pt : opts
cam_res_y(b, "camera-res-height", 480),
cam_fps(b, "camera-fps", 30),
threshold(b, "threshold-primary", 128),
- threshold_secondary(b, "threshold-secondary", 128),
min_point_size(b, "min-point-size", 10),
max_point_size(b, "max-point-size", 50),
m01_x(b, "m_01-x", 0),
diff --git a/ftnoir_tracker_pt/point_extractor.cpp b/ftnoir_tracker_pt/point_extractor.cpp
index 5f7f6829..dab1d967 100644
--- a/ftnoir_tracker_pt/point_extractor.cpp
+++ b/ftnoir_tracker_pt/point_extractor.cpp
@@ -25,51 +25,15 @@ std::vector<Vec2f> PointExtractor::extract_points(Mat& frame)
const int W = frame.cols;
const int H = frame.rows;
- if (frame_last.cols != W || frame_last.rows != H)
- {
- frame_last = cv::Mat();
- }
-
// convert to grayscale
Mat frame_gray;
cvtColor(frame, frame_gray, cv::COLOR_RGB2GRAY);
- int secondary = s.threshold_secondary;
- int primary = s.threshold;
-
// mask for everything that passes the threshold (or: the upper threshold of the hysteresis)
Mat frame_bin;
- // only used if draw_output
- Mat frame_bin_copy;
- // mask for everything that passes
- Mat frame_bin_low;
- // mask for lower-threshold && combined result of last, needs to remain in scope until drawing, but is only used if secondary != 0
- Mat frame_last_and_low;
-
- if(secondary==0){
- threshold(frame_gray, frame_bin, primary, 255, THRESH_BINARY);
- }else{
- // we recombine a number of buffers, this might be slower than a single loop of per-pixel logic
- // but it might as well be faster if openCV makes good use of SIMD
- float t = primary;
- //float hyst = float(threshold_secondary_val)/512.;
- //threshold(frame_gray, frame_bin, (t + ((255.-t)*hyst)), 255, THRESH_BINARY);
- float hyst = float(primary)/(256.*8.);
- threshold(frame_gray, frame_bin, t, 255, THRESH_BINARY);
- threshold(frame_gray, frame_bin_low,std::max(float(1), t - (t*hyst)), 255, THRESH_BINARY);
- frame_bin.copyTo(frame_bin_copy);
- if(frame_last.empty()){
- frame_bin.copyTo(frame_last);
- }else{
- // keep pixels from last if they are above lower threshold
- bitwise_and(frame_last, frame_bin_low, frame_last_and_low);
- // union of pixels >= higher threshold and pixels >= lower threshold
- bitwise_or(frame_bin, frame_last_and_low, frame_last);
- frame_last.copyTo(frame_bin);
- }
- }
-
+ threshold(frame_gray, frame_bin, s.threshold, 255, THRESH_BINARY);
+
int min_size = s.min_point_size;
int max_size = s.max_point_size;
diff --git a/ftnoir_tracker_pt/point_extractor.h b/ftnoir_tracker_pt/point_extractor.h
index 3f6cfb72..b9368ab6 100644
--- a/ftnoir_tracker_pt/point_extractor.h
+++ b/ftnoir_tracker_pt/point_extractor.h
@@ -28,7 +28,6 @@ public:
settings_pt s;
private:
std::vector<cv::Vec2f> points;
- cv::Mat frame_last;
};
#endif //POINTEXTRACTOR_H