diff --git a/Src/Config.cpp b/Src/Config.cpp index d06efff9ec5c57bdc073c6d120e6e381f51fca83..86cbb1045f07bd02b0ac231580e56ba129bdc230 100644 --- a/Src/Config.cpp +++ b/Src/Config.cpp @@ -51,18 +51,6 @@ void Config::load(QString dir, QString file) config->EnableSwap = tree.get<int>(globalPrefix+"EnableSwap",config->EnableSwap); config->EnableAdd = tree.get<int>(globalPrefix+"EnableAdd",config->EnableAdd); config->EnableRotate = tree.get<int>(globalPrefix+"EnableRotate",config->EnableRotate); - config->BinarizationThreshold = tree.get<int>(globalPrefix+"BinarizationThreshold",config->BinarizationThreshold); - config->SizeErode = tree.get<int>(globalPrefix+"SizeErode",config->SizeErode); - config->SizeDilate = tree.get<int>(globalPrefix+"SizeDilate",config->SizeDilate); - config->MinBlobSize = tree.get<int>(globalPrefix+"MinBlobSize",config->MinBlobSize); - config->MaxBlobSize = tree.get<int>(globalPrefix+"MaxBlobSize",config->MaxBlobSize); - config->Mog2History = tree.get<int>(globalPrefix+"Mog2History",config->Mog2History); - config->Mog2VarThresh = tree.get<int>(globalPrefix+"Mog2VarThresh",config->Mog2VarThresh); - config->Mog2BackgroundRatio = tree.get<double>(globalPrefix+"Mog2BackgroundRatio",config->Mog2BackgroundRatio); - config->DoNetwork = tree.get<int>(globalPrefix+"DoNetwork",config->DoNetwork); - config->NetworkPort = tree.get<int>(globalPrefix+"NetworkPort",config->NetworkPort); - config->DoBackground = tree.get<int>(globalPrefix+"DoBackground",config->DoBackground); - config->ResetBackground = tree.get<int>(globalPrefix+"ResetBackground",config->ResetBackground); } void Config::save(QString dir, QString file) @@ -79,18 +67,5 @@ void Config::save(QString dir, QString file) tree.put(globalPrefix+"EnableSwap", config->EnableSwap); tree.put(globalPrefix+"EnableAdd", config->EnableAdd); tree.put(globalPrefix+"EnableRotate", config->EnableRotate); - tree.put(globalPrefix+"BinarizationThreshold", config->BinarizationThreshold); - tree.put(globalPrefix+"SizeErode", config->SizeErode); - tree.put(globalPrefix+"SizeDilate", config->SizeDilate); - tree.put(globalPrefix+"MinBlobSize", config->MinBlobSize); - tree.put(globalPrefix+"MaxBlobSize", config->MaxBlobSize); - tree.put(globalPrefix+"Mog2History", config->Mog2History); - tree.put(globalPrefix+"Mog2VarThresh", config->Mog2VarThresh); - tree.put(globalPrefix+"Mog2BackgroundRatio", config->Mog2BackgroundRatio); - tree.put(globalPrefix+"DoNetwork", config->DoNetwork); - tree.put(globalPrefix+"NetworkPort", config->NetworkPort); - tree.put(globalPrefix+"DoBackground", config->DoBackground); - tree.put(globalPrefix+"ResetBackground", config->ResetBackground); - write_ini((dir + "/" + file).toStdString(), tree); } diff --git a/Src/Model/TrackerParameter.cpp b/Src/Model/TrackerParameter.cpp index 7ce5891341484c5f19fa37fe96e58e1985012746..54cca260905d78c8ade9151ef791b2ae4d50077b 100644 --- a/Src/Model/TrackerParameter.cpp +++ b/Src/Model/TrackerParameter.cpp @@ -4,52 +4,6 @@ TrackerParameter::TrackerParameter(QObject *parent) : IModel(parent) { - _cfg = static_cast<ControllerTrackingAlgorithm*>(parent)->getConfig(); - - - _BinarizationThreshold = _cfg->BinarizationThreshold; - _SizeErode = _cfg->SizeErode; - _SizeDilate = _cfg->SizeDilate; - _MinBlobSize = _cfg->MinBlobSize; - _MaxBlobSize = _cfg->MaxBlobSize; - - _mog2History = _cfg->Mog2History; - _mog2VarThresh = _cfg->Mog2VarThresh; - _mog2BackgroundRatio = _cfg->Mog2BackgroundRatio; - - _doNetwork = _cfg->DoNetwork; - _networkPort = _cfg->NetworkPort; - - _Threshold = 12345; - - _doBackground = true; - _sendImage = 0; //Send no image - _resetBackground = false; - Q_EMIT notifyView(); } - -void TrackerParameter::setThreshold(int x) -{ - _Threshold = x; - - Q_EMIT notifyView(); -} - -int TrackerParameter::getThreshold() -{ - return _Threshold; -} - -void TrackerParameter::setBinarizationThreshold(int x) -{ - _BinarizationThreshold = x; - _cfg->BinarizationThreshold = x; - Q_EMIT notifyView(); -} - -int TrackerParameter::getBinarizationThreshold() -{ - return _BinarizationThreshold; -} \ No newline at end of file diff --git a/Src/Model/TrackerParameter.h b/Src/Model/TrackerParameter.h index 17f874f84034a029a602763044b75e99e99b57c4..3ff95c5a493f05f17afbf2480dccc792d0a76447 100644 --- a/Src/Model/TrackerParameter.h +++ b/Src/Model/TrackerParameter.h @@ -11,145 +11,13 @@ class TrackerParameter : public IModel public: TrackerParameter(QObject *parent = 0); - void setThreshold(int x); - - int getThreshold(); - - void setBinarizationThreshold(int x); - int getBinarizationThreshold(); - - int getSizeErode() { return _SizeErode; }; - void setSizeErode(int x) { - _SizeErode = x; - Q_EMIT notifyView(); - }; - - int getSizeDilate() { return _SizeDilate; }; - void setSizeDilate(int x) { - _SizeDilate = x; - Q_EMIT notifyView(); - }; - - int getmog2History() { return _mog2History; }; - void setmog2History(int x) { - _mog2History = x; - Q_EMIT notifyView(); - }; - - int getmog2VarThresh() { return _mog2VarThresh; }; - void setmog2VarThresh(int x) { - _mog2VarThresh = x; - Q_EMIT notifyView(); - }; - - double getmog2BackgroundRatio() { return _mog2BackgroundRatio; }; - void setmog2BackgroundRatio(double x) { - _mog2BackgroundRatio = x; - Q_EMIT notifyView(); - }; - - double getMinBlobSize() { return _MinBlobSize; }; - void setMinBlobSize(double x) { - _MinBlobSize = x; - Q_EMIT notifyView(); - }; - - double getMaxBlobSize() { return _MaxBlobSize; }; - void setMaxBlobSize(double x) { - _MaxBlobSize = x; - Q_EMIT notifyView(); - }; - - bool getDoBackground() { return _doBackground; }; - void setDoBackground(bool x) { - _doBackground = x; - Q_EMIT notifyView(); - }; - - bool getDoNetwork() { return _doNetwork; }; - void setDoNetwork(bool x) { - _doNetwork = x; - Q_EMIT notifyView(); - }; - - int getSendImage() { return _sendImage; }; - void setSendImage(int x) { - _sendImage = x; - Q_EMIT notifyView(); - }; - - bool getResetBackground() { return _resetBackground; }; - void setResetBackground(bool x) { - _resetBackground = x; - Q_EMIT notifyView(); - }; - - int getNoFish() { return _noFish; }; - void setNoFish(int x) { - _noFish = x; - _cfg->NoFish = x; - Q_EMIT notifyView(); - }; - std::string getNewSelection() { return _newSelection; }; void setNewSelection(std::string x) { _newSelection = x; } - - - void setAll( - int Threshold, - int BinarizationThreshold, - int SizeErode, - int SizeDilate, - int mog2History, - int mog2VarThresh, - double mog2BackgroundRatio, - int minBlobSize, - int maxBlobSize) - { - _Threshold = Threshold; - _BinarizationThreshold = BinarizationThreshold; - _SizeErode = SizeErode; - _SizeDilate = SizeDilate; - _mog2History = mog2History; - _mog2VarThresh = mog2VarThresh; - _mog2BackgroundRatio = mog2BackgroundRatio; - _MinBlobSize = minBlobSize; - _MaxBlobSize = maxBlobSize; - _cfg->BinarizationThreshold = BinarizationThreshold; - _cfg->SizeErode = SizeErode; - _cfg->SizeDilate = SizeDilate; - _cfg->MinBlobSize = minBlobSize; - _cfg->MaxBlobSize = maxBlobSize; - _cfg->Mog2History = mog2History; - _cfg->Mog2VarThresh = mog2VarThresh; - _cfg->Mog2BackgroundRatio = mog2BackgroundRatio; - Q_EMIT notifyView(); - }; - - private: - int _Threshold; - int _BinarizationThreshold; - int _SizeErode; - int _SizeDilate; - int _mog2History; - int _mog2VarThresh; - double _mog2BackgroundRatio; - int _MinBlobSize; - int _MaxBlobSize; - - bool _doBackground; - int _sendImage; - bool _resetBackground; - int _noFish; - - int _networkPort; - bool _doNetwork; - std::string _newSelection; Config *_cfg; }; diff --git a/Src/View/TrackerParameterView.cpp b/Src/View/TrackerParameterView.cpp index c1d9a43ef89a9772a37825e960087597f0c36159..eda5891eff8351ff73fbb595dfe45e25acd8e864 100644 --- a/Src/View/TrackerParameterView.cpp +++ b/Src/View/TrackerParameterView.cpp @@ -8,17 +8,6 @@ TrackerParameterView::TrackerParameterView(QWidget *parent, IController *control _ui(new Ui::TrackerParameterView) { _ui->setupUi(this); - getNotified(); - - - QObject::connect(_ui->lineEdit_2_binThresh, SIGNAL(valueChanged(int)), this, SLOT(on_pushButton_clicked())); - QObject::connect(_ui->lineEdit_3_SizeErode, SIGNAL(valueChanged(int)), this, SLOT(on_pushButton_clicked())); - QObject::connect(_ui->lineEdit_4_SizeDilate, SIGNAL(valueChanged(int)), this, SLOT(on_pushButton_clicked())); - QObject::connect(_ui->lineEdit_8_MinBlob, SIGNAL(valueChanged(int)), this, SLOT(on_pushButton_clicked())); - QObject::connect(_ui->lineEdit_9MaxBlob, SIGNAL(valueChanged(int)), this, SLOT(on_pushButton_clicked())); - QObject::connect(_ui->lineEdit_7_MogBack, SIGNAL(valueChanged(double)), this, SLOT(on_pushButton_clicked())); - - _ui->pushButton->setVisible(false); } TrackerParameterView::~TrackerParameterView() @@ -26,55 +15,6 @@ TrackerParameterView::~TrackerParameterView() delete _ui; } -void TrackerParameterView::on_pushButtonResetBackground_clicked() { - TrackerParameter *parameter = qobject_cast<TrackerParameter *>(getModel()); - parameter->setResetBackground(true); -} - -void TrackerParameterView::on_comboBoxSendImage_currentIndexChanged(int v) { - TrackerParameter *parameter = qobject_cast<TrackerParameter *>(getModel()); - parameter->setSendImage(v); - parameter->setNewSelection(_ui->comboBoxSendImage->currentText().toStdString()); -} - - -void TrackerParameterView::on_pushButton_clicked() -{ - TrackerParameter *parameter = qobject_cast<TrackerParameter *>(getModel()); - - int setBinarizationThreshold = _ui->lineEdit_2_binThresh->text().toInt(); - int setSizeErode = _ui->lineEdit_3_SizeErode->text().toInt(); - int setSizeDilate = _ui->lineEdit_4_SizeDilate->text().toInt(); - int setMinBlobSize = _ui->lineEdit_8_MinBlob->text().toInt(); - int setMaxBlobSize = _ui->lineEdit_9MaxBlob->text().toInt(); - - double setmog2BackgroundRatio = _ui->lineEdit_7_MogBack->value(); - - parameter->setAll(0, setBinarizationThreshold, setSizeErode, setSizeDilate, 0, 0, - setmog2BackgroundRatio, setMinBlobSize, setMaxBlobSize); - - Q_EMIT parametersChanged(); -} - void TrackerParameterView::getNotified() { - TrackerParameter *parameter = qobject_cast<TrackerParameter *>(getModel()); - - int val = parameter->getBinarizationThreshold(); - _ui->lineEdit_2_binThresh->setValue(val); - - val = parameter->getSizeErode(); - _ui->lineEdit_3_SizeErode->setValue(val); - - val = parameter->getSizeDilate(); - _ui->lineEdit_4_SizeDilate->setValue(val); - - double dval = parameter->getmog2BackgroundRatio(); - _ui->lineEdit_7_MogBack->setValue(dval); - - val = parameter->getMinBlobSize(); - _ui->lineEdit_8_MinBlob->setValue(val); - - val = parameter->getMaxBlobSize(); - _ui->lineEdit_9MaxBlob->setValue(val); } diff --git a/Src/View/TrackerParameterView.h b/Src/View/TrackerParameterView.h index 7362e1b5e330b75ca269a5578a11b2da34f56edb..edf9c708a52753f2ba77d7a86f24962a23f82ecb 100644 --- a/Src/View/TrackerParameterView.h +++ b/Src/View/TrackerParameterView.h @@ -16,12 +16,6 @@ public: explicit TrackerParameterView(QWidget *parent = 0, IController *controller = 0, IModel *model = 0); ~TrackerParameterView(); -private slots: - void on_pushButton_clicked(); - void on_pushButtonResetBackground_clicked(); - void on_comboBoxSendImage_currentIndexChanged(int v); - - public: signals: void trackingAreaType(int v); @@ -32,7 +26,6 @@ private: // IViewWidget interface public slots: - void getNotified(); }; diff --git a/Src/View/TrackerParameterView.ui b/Src/View/TrackerParameterView.ui index 5fc284f23ae23b44c8ae05d39ae60924b908761e..9f810ec3fcc7e941f9197f980aaae2bf60946e72 100644 --- a/Src/View/TrackerParameterView.ui +++ b/Src/View/TrackerParameterView.ui @@ -65,351 +65,6 @@ <property name="topMargin"> <number>0</number> </property> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QFrame" name="frame"> - <property name="styleSheet"> - <string notr="true">#frame{color: #e5e5e5;}</string> - </property> - <property name="frameShape"> - <enum>QFrame::Box</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>3</number> - </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <property name="rightMargin"> - <number>5</number> - </property> - <property name="bottomMargin"> - <number>5</number> - </property> - <item> - <widget class="QWidget" name="widgetBinThr" native="true"> - <property name="toolTip"> - <string>Set the binarization threshold</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Binarization Threshold</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="lineEdit_2_binThresh"> - <property name="toolTip"> - <string>Set the binarization threshold</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Line" name="line_2"> - <property name="styleSheet"> - <string notr="true">color: #e5e5e5;</string> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QWidget" name="widgetSizeErode" native="true"> - <property name="toolTip"> - <string>Set the erosion size</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Size Erode</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="lineEdit_3_SizeErode"> - <property name="toolTip"> - <string>Set the erosion size</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Line" name="line_3"> - <property name="styleSheet"> - <string notr="true">color: #e5e5e5;</string> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QWidget" name="widgetSizeDil" native="true"> - <property name="toolTip"> - <string>Set the dilation size</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_7"> - <item> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Size Dilate</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="lineEdit_4_SizeDilate"> - <property name="toolTip"> - <string>Set the dilation size</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Line" name="line_4"> - <property name="styleSheet"> - <string notr="true">color: #e5e5e5;</string> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QWidget" name="widgetBackgroundRatio" native="true"> - <property name="toolTip"> - <string>Set the background ratio</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <item> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Background Ratio</string> - </property> - </widget> - </item> - <item> - <widget class="QDoubleSpinBox" name="lineEdit_7_MogBack"> - <property name="toolTip"> - <string>Set the background ratio</string> - </property> - <property name="decimals"> - <number>6</number> - </property> - <property name="maximum"> - <double>1.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.001000000000000</double> - </property> - <property name="value"> - <double>0.001000000000000</double> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Line" name="line_5"> - <property name="styleSheet"> - <string notr="true">color: #e5e5e5;</string> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QWidget" name="widgetMinBlob" native="true"> - <property name="toolTip"> - <string>Set the minimal blob size</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_10"> - <item> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Min Blob Size</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="lineEdit_8_MinBlob"> - <property name="toolTip"> - <string>Set the minimal blob size</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Line" name="line_6"> - <property name="styleSheet"> - <string notr="true">color: #e5e5e5;</string> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QWidget" name="widgetMaxBlob" native="true"> - <property name="toolTip"> - <string>Sets the maximum blob size</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>Max Blob Size</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="lineEdit_9MaxBlob"> - <property name="toolTip"> - <string>Sets the maximum blob size</string> - </property> - <property name="maximum"> - <number>10000</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QPushButton" name="pushButton"> - <property name="toolTip"> - <string>Set the parameters for the tracking plugin</string> - </property> - <property name="text"> - <string>Set Values</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Send Image:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="comboBoxSendImage"> - <property name="toolTip"> - <string>Choose which image to display for the next frames. Tracking must be actived.</string> - </property> - <property name="currentText"> - <string>Original</string> - </property> - <item> - <property name="text"> - <string>Original</string> - </property> - </item> - <item> - <property name="text"> - <string>Binarized</string> - </property> - </item> - <item> - <property name="text"> - <string>Eroded</string> - </property> - </item> - <item> - <property name="text"> - <string>Dilated</string> - </property> - </item> - <item> - <property name="text"> - <string>Difference</string> - </property> - </item> - <item> - <property name="text"> - <string>Background</string> - </property> - </item> - </widget> - </item> - <item> - <widget class="QPushButton" name="pushButtonResetBackground"> - <property name="toolTip"> - <string>Reset the current background</string> - </property> - <property name="text"> - <string>Reset Background</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> </layout> </widget> </widget>