added subfilter support

This commit is contained in:
lostjared
2018-06-29 08:45:25 -07:00
parent 8b3d298f0f
commit e38d3f0be2
4 changed files with 30 additions and 1 deletions

View File

@@ -136,16 +136,19 @@ void AC_MainWindow::createControls() {
btn_remove = new QPushButton(tr("Remove"), this);
btn_moveup = new QPushButton(tr("Move Up"), this);
btn_movedown = new QPushButton(tr("Move Down"), this);
btn_sub = new QPushButton(tr("Subfilter"), this);
btn_add->setGeometry(10, 215, 100, 20);
btn_remove->setGeometry(400, 215, 100, 20);
btn_moveup->setGeometry(500, 215, 100, 20);
btn_movedown->setGeometry(600, 215, 100, 20);
btn_sub->setGeometry(700, 215, 90, 20);
connect(btn_add, SIGNAL(clicked()), this, SLOT(addClicked()));
connect(btn_remove, SIGNAL(clicked()), this, SLOT(rmvClicked()));
connect(btn_moveup, SIGNAL(clicked()), this, SLOT(upClicked()));
connect(btn_movedown, SIGNAL(clicked()), this, SLOT(downClicked()));
connect(btn_sub, SIGNAL(clicked()), this, SLOT(setSub()));
QLabel *r_label = new QLabel(tr("Red: "), this);
r_label->setGeometry(10, 255, 50, 20);
@@ -432,6 +435,24 @@ void AC_MainWindow::downClicked() {
}
void AC_MainWindow::setSub() {
int row = filters->currentIndex();
if(row != -1) {
std::ostringstream stream;
//QListWidgetItem *item = filters->item(row);
QString filter_num = filters->currentText();
int value_index = filter_map[filter_num.toStdString()].first;
int filter_index = filter_map[filter_num.toStdString()].second;
if(value_index == 0) {
stream << "SubFilter set to: " << filter_num.toStdString() << "\n";
stream << "SubFilter index: " << filter_index << "\n";
playback->setSubFilter(filter_index);
QString l = stream.str().c_str();
Log(l);
}
}
}
void AC_MainWindow::Log(const QString &s) {
QString text;
text = log_text->toPlainText();

View File

@@ -22,7 +22,7 @@ public:
bool startCamera(int res, int dev, const QString &outdir, bool record, int type);
bool startVideo(const QString &filename, const QString &outdir, bool record, int type);
QListWidget /**filters,*/ *custom_filters;
QPushButton *btn_add, *btn_remove, *btn_moveup, *btn_movedown;
QPushButton *btn_add, *btn_remove, *btn_moveup, *btn_movedown, *btn_sub;
QTextEdit *log_text;
QCheckBox *chk_negate;
QComboBox *combo_rgb;
@@ -39,6 +39,7 @@ public slots:
void addClicked();
void rmvClicked();
void upClicked();
void setSub();
void downClicked();
void file_Exit();
void file_NewVideo();

View File

@@ -128,6 +128,12 @@ void Playback::setIndexChanged(std::string value) {
alpha = 1.0;
}
void Playback::setSubFilter(int index) {
mutex.lock();
ac::setSubFilter(index);
mutex.unlock();
}
void Playback::setSingleMode(bool val) {
single_mode = val;
}

View File

@@ -63,6 +63,7 @@ public:
void drawEffects(cv::Mat &frame);
void filterFade(cv::Mat &frame, std::pair<int, int> &filter1, std::pair<int, int> &filter2, double alpha);
void reset_filters();
void setSubFilter(int index);
signals:
void procImage(const QImage image);
void stopRecording();