mirror of
https://github.com/lostjared/Acid.Cam.v2.Qt.git
synced 2025-12-17 04:10:01 +01:00
new options
This commit is contained in:
@@ -77,6 +77,7 @@ AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
|
|||||||
QObject::connect(playback, SIGNAL(procImage(QImage)), this, SLOT(updateFrame(QImage)));
|
QObject::connect(playback, SIGNAL(procImage(QImage)), this, SLOT(updateFrame(QImage)));
|
||||||
QObject::connect(playback, SIGNAL(stopRecording()), this, SLOT(stopRecording()));
|
QObject::connect(playback, SIGNAL(stopRecording()), this, SLOT(stopRecording()));
|
||||||
QObject::connect(playback, SIGNAL(frameIncrement()), this, SLOT(frameInc()));
|
QObject::connect(playback, SIGNAL(frameIncrement()), this, SLOT(frameInc()));
|
||||||
|
QObject::connect(playback, SIGNAL(resetIndex()), this, SLOT(resetIndex()));
|
||||||
|
|
||||||
for(unsigned int i = 0; i < plugins.plugin_list.size(); ++i) {
|
for(unsigned int i = 0; i < plugins.plugin_list.size(); ++i) {
|
||||||
QString text;
|
QString text;
|
||||||
@@ -310,7 +311,6 @@ void AC_MainWindow::createMenu() {
|
|||||||
speed_action_items[i]->setCheckable(true);
|
speed_action_items[i]->setCheckable(true);
|
||||||
speed_menu->addAction(speed_action_items[i]);
|
speed_menu->addAction(speed_action_items[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
image_menu = options->addMenu(tr("Image"));
|
image_menu = options->addMenu(tr("Image"));
|
||||||
noflip = new QAction(tr("Normal"), this);
|
noflip = new QAction(tr("Normal"), this);
|
||||||
noflip->setCheckable(true);
|
noflip->setCheckable(true);
|
||||||
@@ -332,9 +332,14 @@ void AC_MainWindow::createMenu() {
|
|||||||
clear_sub = new QAction(tr("Clear SubFilter"), this);
|
clear_sub = new QAction(tr("Clear SubFilter"), this);
|
||||||
options->addAction(clear_sub);
|
options->addAction(clear_sub);
|
||||||
clear_sub->setShortcut(tr("Ctrl+F"));
|
clear_sub->setShortcut(tr("Ctrl+F"));
|
||||||
|
|
||||||
clear_image = new QAction(tr("Clear Image"), this);
|
clear_image = new QAction(tr("Clear Image"), this);
|
||||||
options->addAction(clear_image);
|
options->addAction(clear_image);
|
||||||
|
options->addSeparator();
|
||||||
|
repeat_v = new QAction(tr("Repeat"), this);
|
||||||
|
repeat_v->setCheckable(true);
|
||||||
|
repeat_v->setChecked(false);
|
||||||
|
options->addAction(repeat_v);
|
||||||
|
connect(repeat_v, SIGNAL(triggered()), this, SLOT(repeat_vid()));
|
||||||
connect(clear_image, SIGNAL(triggered()), this, SLOT(clear_img()));
|
connect(clear_image, SIGNAL(triggered()), this, SLOT(clear_img()));
|
||||||
connect(clear_sub, SIGNAL(triggered()), this, SLOT(clear_subfilter()));
|
connect(clear_sub, SIGNAL(triggered()), this, SLOT(clear_subfilter()));
|
||||||
connect(flip1, SIGNAL(triggered()), this, SLOT(flip1_action()));
|
connect(flip1, SIGNAL(triggered()), this, SLOT(flip1_action()));
|
||||||
@@ -352,52 +357,36 @@ void AC_MainWindow::createMenu() {
|
|||||||
connect(file_new_capture, SIGNAL(triggered()), this, SLOT(file_NewCamera()));
|
connect(file_new_capture, SIGNAL(triggered()), this, SLOT(file_NewCamera()));
|
||||||
connect(file_new_video, SIGNAL(triggered()), this, SLOT(file_NewVideo()));
|
connect(file_new_video, SIGNAL(triggered()), this, SLOT(file_NewVideo()));
|
||||||
connect(file_exit, SIGNAL(triggered()), this, SLOT(file_Exit()));
|
connect(file_exit, SIGNAL(triggered()), this, SLOT(file_Exit()));
|
||||||
|
|
||||||
connect(in_out_increase, SIGNAL(triggered()), this, SLOT(movementOption1()));
|
connect(in_out_increase, SIGNAL(triggered()), this, SLOT(movementOption1()));
|
||||||
connect(in_out, SIGNAL(triggered()), this, SLOT(movementOption2()));
|
connect(in_out, SIGNAL(triggered()), this, SLOT(movementOption2()));
|
||||||
connect(out_reset, SIGNAL(triggered()), this, SLOT(movementOption3()));
|
connect(out_reset, SIGNAL(triggered()), this, SLOT(movementOption3()));
|
||||||
|
|
||||||
controls_stop = new QAction(tr("Sto&p"), this);
|
controls_stop = new QAction(tr("Sto&p"), this);
|
||||||
controls_stop->setShortcut(tr("Ctrl+C"));
|
controls_stop->setShortcut(tr("Ctrl+C"));
|
||||||
controls_menu->addAction(controls_stop);
|
controls_menu->addAction(controls_stop);
|
||||||
|
|
||||||
controls_stop->setEnabled(false);
|
controls_stop->setEnabled(false);
|
||||||
|
|
||||||
controls_snapshot = new QAction(tr("Take &Snapshot"), this);
|
controls_snapshot = new QAction(tr("Take &Snapshot"), this);
|
||||||
controls_snapshot->setShortcut(tr("Ctrl+A"));
|
controls_snapshot->setShortcut(tr("Ctrl+A"));
|
||||||
controls_menu->addAction(controls_snapshot);
|
controls_menu->addAction(controls_snapshot);
|
||||||
|
|
||||||
controls_pause = new QAction(tr("&Pause"), this);
|
controls_pause = new QAction(tr("&Pause"), this);
|
||||||
controls_pause->setShortcut(tr("Ctrl+P"));
|
controls_pause->setShortcut(tr("Ctrl+P"));
|
||||||
controls_menu->addAction(controls_pause);
|
controls_menu->addAction(controls_pause);
|
||||||
|
|
||||||
controls_step = new QAction(tr("Step"), this);
|
controls_step = new QAction(tr("Step"), this);
|
||||||
controls_step->setShortcut(tr("Ctrl+I"));
|
controls_step->setShortcut(tr("Ctrl+I"));
|
||||||
controls_menu->addAction(controls_step);
|
controls_menu->addAction(controls_step);
|
||||||
|
|
||||||
controls_setimage = new QAction(tr("Set Image"), this);
|
controls_setimage = new QAction(tr("Set Image"), this);
|
||||||
controls_setimage->setShortcut(tr("Ctrl+I"));
|
controls_setimage->setShortcut(tr("Ctrl+I"));
|
||||||
controls_menu->addAction(controls_setimage);
|
controls_menu->addAction(controls_setimage);
|
||||||
|
|
||||||
controls_setkey = new QAction(tr("Set Color Key Image"), this);
|
controls_setkey = new QAction(tr("Set Color Key Image"), this);
|
||||||
controls_setkey->setShortcut(tr("Ctrl+K"));
|
controls_setkey->setShortcut(tr("Ctrl+K"));
|
||||||
controls_menu->addAction(controls_setkey);
|
controls_menu->addAction(controls_setkey);
|
||||||
|
|
||||||
clear_images = new QAction(tr("Clear Images"), this);
|
|
||||||
clear_images->setShortcut(tr("Ctrl+E"));
|
|
||||||
controls_menu->addAction(clear_images);
|
|
||||||
|
|
||||||
controls_showvideo = new QAction(tr("Hide Display Video"), this);
|
controls_showvideo = new QAction(tr("Hide Display Video"), this);
|
||||||
controls_showvideo->setShortcut(tr("Ctrl+V"));
|
controls_showvideo->setShortcut(tr("Ctrl+V"));
|
||||||
controls_menu->addAction(controls_showvideo);
|
controls_menu->addAction(controls_showvideo);
|
||||||
|
|
||||||
reset_filters = new QAction(tr("Reset Filters"), this);
|
reset_filters = new QAction(tr("Reset Filters"), this);
|
||||||
reset_filters->setShortcut(tr("Ctrl+R"));
|
reset_filters->setShortcut(tr("Ctrl+R"));
|
||||||
controls_menu->addAction(reset_filters);
|
controls_menu->addAction(reset_filters);
|
||||||
|
|
||||||
controls_showvideo->setEnabled(false);
|
controls_showvideo->setEnabled(false);
|
||||||
controls_showvideo->setCheckable(true);
|
controls_showvideo->setCheckable(true);
|
||||||
|
|
||||||
open_search = new QAction(tr("Search Filters"), this);
|
open_search = new QAction(tr("Search Filters"), this);
|
||||||
open_search->setShortcut(tr("Ctrl+S"));
|
open_search->setShortcut(tr("Ctrl+S"));
|
||||||
controls_menu->addAction(open_search);
|
controls_menu->addAction(open_search);
|
||||||
@@ -410,7 +399,6 @@ void AC_MainWindow::createMenu() {
|
|||||||
connect(controls_setkey, SIGNAL(triggered()), this, SLOT(controls_SetKey()));
|
connect(controls_setkey, SIGNAL(triggered()), this, SLOT(controls_SetKey()));
|
||||||
connect(controls_showvideo, SIGNAL(triggered()), this, SLOT(controls_ShowVideo()));
|
connect(controls_showvideo, SIGNAL(triggered()), this, SLOT(controls_ShowVideo()));
|
||||||
connect(reset_filters, SIGNAL(triggered()), this, SLOT(controls_Reset()));
|
connect(reset_filters, SIGNAL(triggered()), this, SLOT(controls_Reset()));
|
||||||
connect(clear_images, SIGNAL(triggered()), this, SLOT(controls_Clear()));
|
|
||||||
connect(combo_rgb, SIGNAL(currentIndexChanged(int)), this, SLOT(cb_SetIndex(int)));
|
connect(combo_rgb, SIGNAL(currentIndexChanged(int)), this, SLOT(cb_SetIndex(int)));
|
||||||
controls_pause->setText(tr("Pause"));
|
controls_pause->setText(tr("Pause"));
|
||||||
help_about = new QAction(tr("About"), this);
|
help_about = new QAction(tr("About"), this);
|
||||||
@@ -421,7 +409,10 @@ void AC_MainWindow::createMenu() {
|
|||||||
controls_pause->setEnabled(false);
|
controls_pause->setEnabled(false);
|
||||||
controls_step->setEnabled(false);
|
controls_step->setEnabled(false);
|
||||||
controls_snapshot->setEnabled(false);
|
controls_snapshot->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AC_MainWindow::resetIndex() {
|
||||||
|
frame_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AC_MainWindow::clear_subfilter() {
|
void AC_MainWindow::clear_subfilter() {
|
||||||
@@ -472,6 +463,16 @@ void AC_MainWindow::noflip_action() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AC_MainWindow::repeat_vid() {
|
||||||
|
bool val = repeat_v->isChecked();
|
||||||
|
playback->enableRepeat(val);
|
||||||
|
if(val == true) {
|
||||||
|
Log(tr("Repeat Enabled\n"));
|
||||||
|
} else {
|
||||||
|
Log(tr("Repeat Disabled\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AC_MainWindow::speed1() {
|
void AC_MainWindow::speed1() {
|
||||||
ac::alpha_increase = speed_actions[0];
|
ac::alpha_increase = speed_actions[0];
|
||||||
QString text;
|
QString text;
|
||||||
@@ -959,17 +960,16 @@ void AC_MainWindow::controls_Pause() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AC_MainWindow::controls_Clear() {
|
|
||||||
playback->Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AC_MainWindow::controls_SetImage() {
|
void AC_MainWindow::controls_SetImage() {
|
||||||
QString fileName = QFileDialog::getOpenFileName(this,tr("Open Image"), "/home", tr("Image Files (*.png *.jpg)"));
|
QString fileName = QFileDialog::getOpenFileName(this,tr("Open Image"), "/home", tr("Image Files (*.png *.jpg)"));
|
||||||
if(fileName != "") {
|
if(fileName != "") {
|
||||||
cv::Mat tblend_image = cv::imread(fileName.toStdString());
|
cv::Mat tblend_image = cv::imread(fileName.toStdString());
|
||||||
if(!tblend_image.empty()) {
|
if(!tblend_image.empty()) {
|
||||||
playback->setImage(tblend_image);
|
playback->setImage(tblend_image);
|
||||||
QMessageBox::information(this, tr("Loaded Image"), tr("Image set"));
|
QString text;
|
||||||
|
QTextStream stream(&text);
|
||||||
|
stream << "Successfully Loaded Image: [" << fileName << "] Size: " << tblend_image.cols << "x" << tblend_image.rows << "\n";
|
||||||
|
Log(text);
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::information(this, tr("Image Load failed"), tr("Could not load image"));
|
QMessageBox::information(this, tr("Image Load failed"), tr("Could not load image"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
QComboBox *color_maps, *filters;
|
QComboBox *color_maps, *filters;
|
||||||
QMenu *file_menu, *controls_menu, *help_menu, *options, *movement, *speed_menu;
|
QMenu *file_menu, *controls_menu, *help_menu, *options, *movement, *speed_menu;
|
||||||
QAction *file_exit, *file_new_capture, *file_new_video;
|
QAction *file_exit, *file_new_capture, *file_new_video;
|
||||||
QAction *controls_snapshot, *controls_pause, *controls_step, *controls_stop, *controls_setimage,*controls_setkey,*controls_showvideo, *clear_images, *reset_filters;
|
QAction *controls_snapshot, *controls_pause, *controls_step, *controls_stop, *controls_setimage,*controls_setkey,*controls_showvideo, *reset_filters;
|
||||||
QAction *help_about;
|
QAction *help_about;
|
||||||
QAction *open_search;
|
QAction *open_search;
|
||||||
QAction *in_out_increase;
|
QAction *in_out_increase;
|
||||||
@@ -45,6 +45,7 @@ public:
|
|||||||
QAction *flip1, *flip2, *flip3, *noflip;
|
QAction *flip1, *flip2, *flip3, *noflip;
|
||||||
QAction *clear_sub;
|
QAction *clear_sub;
|
||||||
QAction *clear_image;
|
QAction *clear_image;
|
||||||
|
QAction *repeat_v;
|
||||||
double speed_actions[7];
|
double speed_actions[7];
|
||||||
QRadioButton *filter_single, *filter_custom;
|
QRadioButton *filter_single, *filter_custom;
|
||||||
void updateList();
|
void updateList();
|
||||||
@@ -64,11 +65,11 @@ public slots:
|
|||||||
void controls_SetImage();
|
void controls_SetImage();
|
||||||
void controls_ShowVideo();
|
void controls_ShowVideo();
|
||||||
void controls_SetKey();
|
void controls_SetKey();
|
||||||
void controls_Clear();
|
|
||||||
void controls_Reset();
|
void controls_Reset();
|
||||||
void help_About();
|
void help_About();
|
||||||
void updateFrame(QImage img);
|
void updateFrame(QImage img);
|
||||||
void stopRecording();
|
void stopRecording();
|
||||||
|
void resetIndex();
|
||||||
void chk_Clicked();
|
void chk_Clicked();
|
||||||
void cb_SetIndex(int index);
|
void cb_SetIndex(int index);
|
||||||
void frameInc();
|
void frameInc();
|
||||||
@@ -95,6 +96,7 @@ public slots:
|
|||||||
void noflip_action();
|
void noflip_action();
|
||||||
void clear_subfilter();
|
void clear_subfilter();
|
||||||
void clear_img();
|
void clear_img();
|
||||||
|
void repeat_vid();
|
||||||
private:
|
private:
|
||||||
void createControls();
|
void createControls();
|
||||||
void createMenu();
|
void createMenu();
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ Playback::Playback(QObject *parent) : QThread(parent) {
|
|||||||
prev_filter = std::pair<int, int>(0, 0);
|
prev_filter = std::pair<int, int>(0, 0);
|
||||||
flip_frame1 = false;
|
flip_frame1 = false;
|
||||||
flip_frame2 = false;
|
flip_frame2 = false;
|
||||||
|
repeat_video = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Playback::Play() {
|
void Playback::Play() {
|
||||||
@@ -204,6 +205,12 @@ void Playback::run() {
|
|||||||
while(!stop) {
|
while(!stop) {
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
if(!capture.read(frame)) {
|
if(!capture.read(frame)) {
|
||||||
|
if(repeat_video && mode == MODE_VIDEO) {
|
||||||
|
setFrameIndex(0);
|
||||||
|
mutex.unlock();
|
||||||
|
emit resetIndex();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
stop = true;
|
stop = true;
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
emit stopRecording();
|
emit stopRecording();
|
||||||
@@ -285,6 +292,17 @@ Playback::~Playback() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Playback::setFrameIndex(const long &index) {
|
||||||
|
capture.set(CV_CAP_PROP_POS_FRAMES, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Playback::enableRepeat(bool re) {
|
||||||
|
mutex.lock();
|
||||||
|
repeat_video = re;
|
||||||
|
mutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Playback::Clear() {
|
void Playback::Clear() {
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
blend_set = false;
|
blend_set = false;
|
||||||
|
|||||||
@@ -31,12 +31,15 @@ private:
|
|||||||
bool isPaused, isStep;
|
bool isPaused, isStep;
|
||||||
VideoMode mode;
|
VideoMode mode;
|
||||||
int device_num;
|
int device_num;
|
||||||
|
unsigned long *frame_index;
|
||||||
unsigned int red, green, blue;
|
unsigned int red, green, blue;
|
||||||
unsigned int bright_, gamma_, saturation_;
|
unsigned int bright_, gamma_, saturation_;
|
||||||
bool single_mode;
|
bool single_mode;
|
||||||
std::pair<int, int> current_filter, prev_filter;
|
std::pair<int, int> current_filter, prev_filter;
|
||||||
double alpha;
|
double alpha;
|
||||||
bool flip_frame1, flip_frame2;
|
bool flip_frame1, flip_frame2;
|
||||||
|
bool repeat_video;
|
||||||
|
void setFrameIndex(const long &index);
|
||||||
public:
|
public:
|
||||||
Playback(QObject *parent = 0);
|
Playback(QObject *parent = 0);
|
||||||
~Playback();
|
~Playback();
|
||||||
@@ -66,10 +69,12 @@ public:
|
|||||||
void filterFade(cv::Mat &frame, std::pair<int, int> &filter1, std::pair<int, int> &filter2, double alpha);
|
void filterFade(cv::Mat &frame, std::pair<int, int> &filter1, std::pair<int, int> &filter2, double alpha);
|
||||||
void reset_filters();
|
void reset_filters();
|
||||||
void setSubFilter(int index);
|
void setSubFilter(int index);
|
||||||
|
void enableRepeat(bool re);
|
||||||
signals:
|
signals:
|
||||||
void procImage(const QImage image);
|
void procImage(const QImage image);
|
||||||
void stopRecording();
|
void stopRecording();
|
||||||
void frameIncrement();
|
void frameIncrement();
|
||||||
|
void resetIndex();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user