mirror of
https://github.com/lostjared/Acid.Cam.v2.Qt.git
synced 2025-12-18 12:50:07 +01:00
fixed file name, added select image
This commit is contained in:
@@ -31,7 +31,7 @@ void custom_filter(cv::Mat &frame) {
|
|||||||
|
|
||||||
AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
|
AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||||
generate_map();
|
generate_map();
|
||||||
setGeometry(0, 0, 800, 600);
|
setGeometry(100, 100, 800, 600);
|
||||||
setFixedSize(800, 600);
|
setFixedSize(800, 600);
|
||||||
setWindowTitle("Acid Cam v2 - Qt");
|
setWindowTitle("Acid Cam v2 - Qt");
|
||||||
createControls();
|
createControls();
|
||||||
@@ -137,21 +137,26 @@ void AC_MainWindow::createMenu() {
|
|||||||
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+S"));
|
controls_snapshot->setShortcut(tr("S"));
|
||||||
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("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("Controls+I"));
|
controls_step->setShortcut(tr("I"));
|
||||||
controls_menu->addAction(controls_step);
|
controls_menu->addAction(controls_step);
|
||||||
|
|
||||||
|
controls_setimage = new QAction(tr("Set Image"), this);
|
||||||
|
controls_setimage->setShortcut(tr("Ctrl+I"));
|
||||||
|
controls_menu->addAction(controls_setimage);
|
||||||
|
|
||||||
connect(controls_snapshot, SIGNAL(triggered()), this, SLOT(controls_Snap()));
|
connect(controls_snapshot, SIGNAL(triggered()), this, SLOT(controls_Snap()));
|
||||||
connect(controls_pause, SIGNAL(triggered()), this, SLOT(controls_Pause()));
|
connect(controls_pause, SIGNAL(triggered()), this, SLOT(controls_Pause()));
|
||||||
connect(controls_step, SIGNAL(triggered()), this, SLOT(controls_Step()));
|
connect(controls_step, SIGNAL(triggered()), this, SLOT(controls_Step()));
|
||||||
connect(controls_stop, SIGNAL(triggered()), this, SLOT(controls_Stop()));
|
connect(controls_stop, SIGNAL(triggered()), this, SLOT(controls_Stop()));
|
||||||
|
connect(controls_setimage, SIGNAL(triggered()), this, SLOT(controls_SetImage()));
|
||||||
|
|
||||||
controls_pause->setCheckable(true);
|
controls_pause->setCheckable(true);
|
||||||
controls_pause->setText("Pause");
|
controls_pause->setText("Pause");
|
||||||
@@ -328,7 +333,14 @@ bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, b
|
|||||||
QString output_name;
|
QString output_name;
|
||||||
QTextStream stream_(&output_name);
|
QTextStream stream_(&output_name);
|
||||||
static unsigned int index = 0;
|
static unsigned int index = 0;
|
||||||
stream_ << outdir << "/" << "AC2.Output." << ++index << ".avi";
|
time_t t = time(0);
|
||||||
|
struct tm *m;
|
||||||
|
m = localtime(&t);
|
||||||
|
std::ostringstream time_stream;
|
||||||
|
time_stream << "-" << (m->tm_year + 1900) << "." << (m->tm_mon + 1) << "." << m->tm_mday << "_" << m->tm_hour << "." << m->tm_min << "." << m->tm_sec << "_";
|
||||||
|
stream_ << outdir << "/" << "Video." << time_stream.str().c_str() << "AC2.Output." << (++index) << ".avi";
|
||||||
|
|
||||||
|
|
||||||
if(recording) {
|
if(recording) {
|
||||||
video_file_name = output_name;
|
video_file_name = output_name;
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
@@ -416,6 +428,17 @@ void AC_MainWindow::controls_Pause() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AC_MainWindow::controls_SetImage() {
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(this,tr("Open Image"), "/home", tr("Image Files (*.png *.jpg)"));
|
||||||
|
if(fileName != "") {
|
||||||
|
blend_image = cv::imread(fileName.toStdString());
|
||||||
|
if(!blend_image.empty()) {
|
||||||
|
blend_set = true;
|
||||||
|
QMessageBox::information(this, tr("Loaded Image"), tr("Image set"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AC_MainWindow::controls_Step() {
|
void AC_MainWindow::controls_Step() {
|
||||||
step_frame = true;
|
step_frame = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public:
|
|||||||
QComboBox *combo_rgb;
|
QComboBox *combo_rgb;
|
||||||
QMenu *file_menu, *controls_menu, *help_menu;
|
QMenu *file_menu, *controls_menu, *help_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;
|
QAction *controls_snapshot, *controls_pause, *controls_step, *controls_stop, *controls_setimage;
|
||||||
QAction *help_about;
|
QAction *help_about;
|
||||||
public slots:
|
public slots:
|
||||||
void addClicked();
|
void addClicked();
|
||||||
@@ -32,6 +32,7 @@ public slots:
|
|||||||
void controls_Snap();
|
void controls_Snap();
|
||||||
void controls_Pause();
|
void controls_Pause();
|
||||||
void controls_Step();
|
void controls_Step();
|
||||||
|
void controls_SetImage();
|
||||||
void help_About();
|
void help_About();
|
||||||
void timer_Camera();
|
void timer_Camera();
|
||||||
void timer_Video();
|
void timer_Video();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
CaptureCamera::CaptureCamera(QWidget *parent) : QDialog(parent) {
|
CaptureCamera::CaptureCamera(QWidget *parent) : QDialog(parent) {
|
||||||
|
setGeometry(100, 100, 290, 120);
|
||||||
setFixedSize(290, 120);
|
setFixedSize(290, 120);
|
||||||
setWindowTitle("Capture from Webcam");
|
setWindowTitle("Capture from Webcam");
|
||||||
setWindowIcon(QPixmap(":/images/icon.png"));
|
setWindowIcon(QPixmap(":/images/icon.png"));
|
||||||
@@ -67,6 +68,7 @@ void CaptureCamera::btn_Start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CaptureVideo::CaptureVideo(QWidget *parent) : QDialog(parent) {
|
CaptureVideo::CaptureVideo(QWidget *parent) : QDialog(parent) {
|
||||||
|
setGeometry(100, 100, 330, 100);
|
||||||
setFixedSize(330, 100);
|
setFixedSize(330, 100);
|
||||||
setWindowTitle(("Capture from Video"));
|
setWindowTitle(("Capture from Video"));
|
||||||
setWindowIcon(QPixmap(":/images/icon.png"));
|
setWindowIcon(QPixmap(":/images/icon.png"));
|
||||||
|
|||||||
Reference in New Issue
Block a user