adding stuff

This commit is contained in:
Jared Bruni
2019-10-06 16:38:17 -07:00
parent 63ee3da04b
commit e6e479be64
4 changed files with 74 additions and 8 deletions

View File

@@ -10,6 +10,7 @@
#include"qtheaders.h" #include"qtheaders.h"
class DisplayWindow : public QDialog { class DisplayWindow : public QDialog {
Q_OBJECT Q_OBJECT
public: public:

View File

@@ -85,6 +85,11 @@ AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
take_snapshot = false; take_snapshot = false;
goto_window = new GotoWindow(this); goto_window = new GotoWindow(this);
disp = new DisplayWindow(this); disp = new DisplayWindow(this);
disp2 = new DisplayWindow(this);
disp2->setFixedSize(640, 480);
disp2->setGeometry(100, 100, 640, 480);
disp2->hide();
disp2->setWindowTitle("View Window");
playback = new Playback(); playback = new Playback();
goto_window->setParent(this); goto_window->setParent(this);
@@ -475,6 +480,9 @@ void AC_MainWindow::createMenu() {
connect(show_fullscreen, SIGNAL(triggered()), this, SLOT(showFull())); connect(show_fullscreen, SIGNAL(triggered()), this, SLOT(showFull()));
controls_menu->addAction(show_image_window); controls_menu->addAction(show_image_window);
connect(show_image_window, SIGNAL(triggered()), this, SLOT(showImageWindow())); connect(show_image_window, SIGNAL(triggered()), this, SLOT(showImageWindow()));
show_control_window = new QAction(tr("Show View Window"), this);
connect(show_control_window, SIGNAL(triggered()), this, SLOT(controls_ShowDisp2()));
controls_menu->addAction(show_control_window);
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"));
@@ -896,7 +904,11 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
struct tm *m; struct tm *m;
m = localtime(&t); m = localtime(&t);
QString ext; QString ext;
ext = (type == 0) ? ".mov" : ".avi"; if(type >= 0 && type < 3)
ext = ".mp4";
else
ext = ".avi";
//ext = (type == 0) ? ".mov" : ".avi";
Log(tr("Capture Device Opened [Camera]\n")); Log(tr("Capture Device Opened [Camera]\n"));
std::ostringstream time_stream; 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 << "_"; time_stream << "-" << (m->tm_year + 1900) << "." << (m->tm_mon + 1) << "." << m->tm_mday << "_" << m->tm_hour << "." << m->tm_min << "." << m->tm_sec << "_";
@@ -931,7 +943,22 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
if(recording) { if(recording) {
video_file_name = output_name; video_file_name = output_name;
writer = cv::VideoWriter(output_name.toStdString(), (type == 0) ? cv::VideoWriter::fourcc('m', 'p', '4', 'v') : cv::VideoWriter::fourcc('X','V','I','D'), video_fps, cv::Size(res_w, res_h), true); int c_type = 0;
switch(type) {
case 0:
c_type = cv::VideoWriter::fourcc('m', 'p', '4', 'v');
break;
case 1:
c_type = cv::VideoWriter::fourcc('a', 'v', 'c', '3');
break;
case 2:
c_type = cv::VideoWriter::fourcc('h', 'e', 'v', '1');
break;
case '3':
c_type = cv::VideoWriter::fourcc('X', 'V', 'I', 'D');
break;
}
writer = cv::VideoWriter(output_name.toStdString(), c_type, video_fps, cv::Size(res_w, res_h), true);
if(!writer.isOpened()) { if(!writer.isOpened()) {
Log(tr("Could not create video writer..\n")); Log(tr("Could not create video writer..\n"));
@@ -998,7 +1025,11 @@ bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, b
struct tm *m; struct tm *m;
m = localtime(&t); m = localtime(&t);
QString ext; QString ext;
ext = (type == 0) ? ".mov" : ".avi"; if(type >= 0 && type < 3)
ext = ".mp4";
else
ext = ".avi";
//ext = (type == 0) ? ".mov" : ".avi";
std::ostringstream time_stream; 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 << "_"; 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) << ext; stream_ << outdir << "/" << "Video" << time_stream.str().c_str() << "AC2.Output." << (++index) << ext;
@@ -1006,7 +1037,22 @@ bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, b
if(recording) { if(recording) {
video_file_name = output_name; video_file_name = output_name;
writer = cv::VideoWriter(output_name.toStdString(), (type == 0) ? cv::VideoWriter::fourcc('m', 'p', '4', 'v') : cv::VideoWriter::fourcc('X','V','I','D'), video_fps, cv::Size(res_w, res_h), true); int c_type = 0;
switch(type) {
case 0:
c_type = cv::VideoWriter::fourcc('m', 'p', '4', 'v');
break;
case 1:
c_type = cv::VideoWriter::fourcc('a', 'v', 'c', '1');
break;
case 2:
c_type = cv::VideoWriter::fourcc('h', 'e', 'v', '1');
break;
case '3':
c_type = cv::VideoWriter::fourcc('X', 'V', 'I', 'D');
break;
}
writer = cv::VideoWriter(output_name.toStdString(), c_type, video_fps, cv::Size(res_w, res_h), true);
if(!writer.isOpened()) { if(!writer.isOpened()) {
Log("Error could not open video writer.\n"); Log("Error could not open video writer.\n");
@@ -1078,6 +1124,17 @@ void AC_MainWindow::controls_ShowVideo() {
} }
} }
void AC_MainWindow::controls_ShowDisp2() {
QString st = show_control_window->text();
if(st == "Hide Control Window") {
disp2->hide();
show_control_window->setText("Show View Window");
} else {
show_control_window->setText("Hide Control Window");
disp2->show();
}
}
void AC_MainWindow::controls_Reset() { void AC_MainWindow::controls_Reset() {
playback->reset_filters(); playback->reset_filters();
} }
@@ -1201,6 +1258,7 @@ void AC_MainWindow::setFrameIndex(int index) {
void AC_MainWindow::updateFrame(QImage img) { void AC_MainWindow::updateFrame(QImage img) {
if(playback->isStopped() == false) { if(playback->isStopped() == false) {
disp->displayImage(img); disp->displayImage(img);
disp2->displayImage(img);
frame_index++; frame_index++;
QString frame_string; QString frame_string;
QTextStream frame_stream(&frame_string); QTextStream frame_stream(&frame_string);

View File

@@ -58,6 +58,7 @@ public:
QAction *show_fullscreen; QAction *show_fullscreen;
QAction *show_image_window; QAction *show_image_window;
QAction *show_options_window; QAction *show_options_window;
QAction *show_control_window;
double speed_actions[7]; double speed_actions[7];
QRadioButton *filter_single, *filter_custom; QRadioButton *filter_single, *filter_custom;
void updateList(); void updateList();
@@ -84,6 +85,7 @@ public slots:
void controls_ShowVideo(); void controls_ShowVideo();
void controls_SetKey(); void controls_SetKey();
void controls_Reset(); void controls_Reset();
void controls_ShowDisp2();
void help_About(); void help_About();
void updateFrame(QImage img); void updateFrame(QImage img);
void stopRecording(); void stopRecording();
@@ -128,6 +130,7 @@ private:
void createControls(); void createControls();
void createMenu(); void createMenu();
DisplayWindow *disp; DisplayWindow *disp;
DisplayWindow *disp2;
CaptureCamera *cap_camera; CaptureCamera *cap_camera;
CaptureVideo *cap_video; CaptureVideo *cap_video;
SearchWindow *search_box; SearchWindow *search_box;

View File

@@ -50,8 +50,10 @@ void CaptureCamera::createControls() {
video_type = new QComboBox(this); video_type = new QComboBox(this);
video_type->setGeometry(80, 90, 90, 25); video_type->setGeometry(80, 90, 90, 25);
video_type->addItem("MOV"); video_type->addItem("MP4 - MPEG-4");
video_type->addItem("AVI"); video_type->addItem("MP4 - AVC");
video_type->addItem("MP4 - HEVC");
video_type->addItem("AVI - XviD");
} }
void CaptureCamera::setParent(AC_MainWindow *p) { void CaptureCamera::setParent(AC_MainWindow *p) {
@@ -119,8 +121,10 @@ void CaptureVideo::createControls() {
video_type = new QComboBox(this); video_type = new QComboBox(this);
video_type->setGeometry(180, 55, 120, 25); video_type->setGeometry(180, 55, 120, 25);
video_type->addItem("MOV"); video_type->addItem("MP4 - MPEG-4");
video_type->addItem("AVI"); video_type->addItem("MP4 - AVC");
video_type->addItem("MP4 - HEVC");
video_type->addItem("AVI - XviD");
connect(btn_setedit, SIGNAL(clicked()), this, SLOT(btn_SetSourceFile())); connect(btn_setedit, SIGNAL(clicked()), this, SLOT(btn_SetSourceFile()));
connect(btn_setout, SIGNAL(clicked()), this, SLOT(btn_SetOutputDir())); connect(btn_setout, SIGNAL(clicked()), this, SLOT(btn_SetOutputDir()));
connect(btn_start, SIGNAL(clicked()), this, SLOT(btn_Start())); connect(btn_start, SIGNAL(clicked()), this, SLOT(btn_Start()));