diff options
author | Patrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb> | 2012-09-21 14:00:34 +0000 |
---|---|---|
committer | Patrick Ruoff <c14-radioactive@19e81ba0-9b1a-49c3-bd6c-561e1906d5fb> | 2012-09-21 14:00:34 +0000 |
commit | ab0d60becc2d1b89c812193c179892d6acd4912f (patch) | |
tree | 2dae7d2c10e1cc3a5bd73ee8ae2ee609c69a1b7b /FTNoIR_Tracker_PT | |
parent | ddc63cdda186fe31435fde839c3d5b68040a0d0f (diff) |
RAII-style dll management 1: Replaced autoptr and release with virtual destructors
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@155 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Tracker_PT')
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp | 2 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp | 11 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h | 1 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp | 2 | ||||
-rw-r--r-- | FTNoIR_Tracker_PT/point_extractor.cpp | 80 |
5 files changed, 52 insertions, 44 deletions
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp index 6301ddd0..f6682c58 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.cpp @@ -198,7 +198,7 @@ void Tracker::CenterTracker() //-----------------------------------------------------------------------------
#pragma comment(linker, "/export:GetTracker=_GetTracker@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERHANDLE __stdcall GetTracker()
+FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker()
{
return new Tracker;
}
\ No newline at end of file diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp index e13ed94a..a76a33d9 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.cpp @@ -14,6 +14,8 @@ TrackerDialog::TrackerDialog()
: settings_dirty(false), tracker(NULL), timer(this), trans_calib_running(false)
{
+ setAttribute(Qt::WA_DeleteOnClose, false);
+
ui.setupUi( this );
settings.load_ini();
@@ -68,6 +70,11 @@ TrackerDialog::TrackerDialog() timer.start(100);
}
+TrackerDialog::~TrackerDialog()
+{
+ qDebug()<<"TrackerDialog::~TrackerDialog";
+}
+
void TrackerDialog::startstop_trans_calib(bool start)
{
if (start)
@@ -93,7 +100,7 @@ void TrackerDialog::trans_calib_step() tracker->get_pose(&X_CM);
trans_calib.update(X_CM.R, X_CM.t);
cv::Vec3f t_MH = trans_calib.get_estimate();
- qDebug()<<"TrackerDialog:: current translation estimate: "<<t_MH[0]<<t_MH[1]<<t_MH[2];
+ //qDebug()<<"TrackerDialog:: current translation estimate: "<<t_MH[0]<<t_MH[1]<<t_MH[2];
ui.tx_spin->setValue(t_MH[0]);
ui.ty_spin->setValue(t_MH[1]);
ui.tz_spin->setValue(t_MH[2]);
@@ -209,7 +216,7 @@ void TrackerDialog::unRegisterTracker() //-----------------------------------------------------------------------------
#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERDIALOGHANDLE __stdcall GetTrackerDialog( )
+FTNOIR_TRACKER_BASE_EXPORT ITrackerDialogPtr __stdcall GetTrackerDialog( )
{
return new TrackerDialog;
}
\ No newline at end of file diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h index 09bbb839..81f6fc83 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dialog.h @@ -22,6 +22,7 @@ class TrackerDialog : public QWidget, Ui::UICPTClientControls, public ITrackerDi Q_OBJECT
public:
TrackerDialog();
+ ~TrackerDialog();
// ITrackerDialog interface
void Initialize(QWidget *parent);
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp index a9df65ac..3210a027 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.cpp @@ -34,7 +34,7 @@ void TrackerDll::getIcon(QIcon *icon) //-----------------------------------------------------------------------------
#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0")
-FTNOIR_TRACKER_BASE_EXPORT TRACKERDLLHANDLE __stdcall GetTrackerDll()
+FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll()
{
return new TrackerDll;
}
diff --git a/FTNoIR_Tracker_PT/point_extractor.cpp b/FTNoIR_Tracker_PT/point_extractor.cpp index a415f24e..b26f7068 100644 --- a/FTNoIR_Tracker_PT/point_extractor.cpp +++ b/FTNoIR_Tracker_PT/point_extractor.cpp @@ -66,44 +66,44 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr }
//*/
- // Method 2: floodfill - /* - // extract blobs - struct BlobInfo - { - BlobInfo() : m00(0), m10(0), m01(0) {} - long m00; - long m10; - long m01; - }; - vector<BlobInfo> blobs; - int blob_count = 1; - - for (int y=0; y < frame_bw.rows; y++) { - for (int x=0; x < frame_bw.cols; x++) { - if (frame_bw.at<unsigned char>(y,x) != 255) continue; - Rect rect; - floodFill(frame_bw, Point(x,y), Scalar(blob_count), &rect, Scalar(0), Scalar(0), 4); - BlobInfo blob; - for (int i=rect.y; i < (rect.y+rect.height); i++) { - for (int j=rect.x; j < (rect.x+rect.width); j++) { - if (frame_bw.at<unsigned char>(i,j) != blob_count) continue; - blob.m00++; - blob.m01+=i; - blob.m10+=j; - } - } - blobs.push_back(blob); - blob_count++; - if (blob_count >= 255) break; - } - } - - // extract points - Vec2f c; - points.clear(); - float m00_min = 3.14*min_size*min_size; - float m00_max = 3.14*max_size*max_size; + // Method 2: floodfill
+ /*
+ // extract blobs
+ struct BlobInfo
+ {
+ BlobInfo() : m00(0), m10(0), m01(0) {}
+ long m00;
+ long m10;
+ long m01;
+ };
+ vector<BlobInfo> blobs;
+ int blob_count = 1;
+
+ for (int y=0; y < frame_bw.rows; y++) {
+ for (int x=0; x < frame_bw.cols; x++) {
+ if (frame_bw.at<unsigned char>(y,x) != 255) continue;
+ Rect rect;
+ floodFill(frame_bw, Point(x,y), Scalar(blob_count), &rect, Scalar(0), Scalar(0), 4);
+ BlobInfo blob;
+ for (int i=rect.y; i < (rect.y+rect.height); i++) {
+ for (int j=rect.x; j < (rect.x+rect.width); j++) {
+ if (frame_bw.at<unsigned char>(i,j) != blob_count) continue;
+ blob.m00++;
+ blob.m01+=i;
+ blob.m10+=j;
+ }
+ }
+ blobs.push_back(blob);
+ blob_count++;
+ if (blob_count >= 255) break;
+ }
+ }
+
+ // extract points
+ Vec2f c;
+ points.clear();
+ float m00_min = 3.14*min_size*min_size;
+ float m00_max = 3.14*max_size*max_size;
for (vector<BlobInfo>::iterator iter = blobs.begin();
iter!= blobs.end();
++iter)
@@ -114,8 +114,8 @@ const vector<Vec2f>& PointExtractor::extract_points(Mat frame, float dt, bool dr c[0] = (m.m10/float(m.m00) - frame.cols/2)/frame.cols;
c[1] = -(m.m01/float(m.m00) - frame.rows/2)/frame.cols;
points.push_back(c);
- } - */ + }
+ */
// draw output image
if (draw_output)
|