mirror of
https://github.com/lostjared/Acid.Cam.v2.Qt.git
synced 2025-12-18 12:50:07 +01:00
working on video capture
This commit is contained in:
296
src/Makefile
Normal file
296
src/Makefile
Normal file
@@ -0,0 +1,296 @@
|
|||||||
|
#############################################################################
|
||||||
|
# Makefile for building: Acid.Cam.v2.Qt
|
||||||
|
# Generated by qmake (2.01a) (Qt 4.8.7) on: Thu Feb 2 12:36:11 2017
|
||||||
|
# Project: Acid.Cam.v2.Linux.Qt.pro
|
||||||
|
# Template: app
|
||||||
|
# Command: /usr/lib/x86_64-linux-gnu/qt4/bin/qmake -o Makefile Acid.Cam.v2.Linux.Qt.pro
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
####### Compiler, tools and options
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CXX = g++
|
||||||
|
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
|
||||||
|
CFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
|
||||||
|
CXXFLAGS = -m64 -pipe -std=c++11 -O2 -Wall -W -D_REENTRANT $(DEFINES)
|
||||||
|
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I/usr/include -I/usr/local/include -I.
|
||||||
|
LINK = g++
|
||||||
|
LFLAGS = -m64 -Wl,-O1
|
||||||
|
LIBS = $(SUBLIBS) -L/usr/lib/x86_64-linux-gnu -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_video -lQtGui -lQtCore -lpthread
|
||||||
|
AR = ar cqs
|
||||||
|
RANLIB =
|
||||||
|
QMAKE = /usr/lib/x86_64-linux-gnu/qt4/bin/qmake
|
||||||
|
TAR = tar -cf
|
||||||
|
COMPRESS = gzip -9f
|
||||||
|
COPY = cp -f
|
||||||
|
SED = sed
|
||||||
|
COPY_FILE = $(COPY)
|
||||||
|
COPY_DIR = $(COPY) -r
|
||||||
|
STRIP = strip
|
||||||
|
INSTALL_FILE = install -m 644 -p
|
||||||
|
INSTALL_DIR = $(COPY_DIR)
|
||||||
|
INSTALL_PROGRAM = install -m 755 -p
|
||||||
|
DEL_FILE = rm -f
|
||||||
|
SYMLINK = ln -f -s
|
||||||
|
DEL_DIR = rmdir
|
||||||
|
MOVE = mv -f
|
||||||
|
CHK_DIR_EXISTS= test -d
|
||||||
|
MKDIR = mkdir -p
|
||||||
|
|
||||||
|
####### Output directory
|
||||||
|
|
||||||
|
OBJECTS_DIR = ./
|
||||||
|
|
||||||
|
####### Files
|
||||||
|
|
||||||
|
SOURCES = main.cpp \
|
||||||
|
main_window.cpp \
|
||||||
|
new_dialog.cpp \
|
||||||
|
plugin.cpp \
|
||||||
|
select_image.cpp \
|
||||||
|
ac.cpp \
|
||||||
|
fractal.cpp moc_main_window.cpp \
|
||||||
|
moc_new_dialog.cpp \
|
||||||
|
qrc_qresource.cpp
|
||||||
|
OBJECTS = main.o \
|
||||||
|
main_window.o \
|
||||||
|
new_dialog.o \
|
||||||
|
plugin.o \
|
||||||
|
select_image.o \
|
||||||
|
ac.o \
|
||||||
|
fractal.o \
|
||||||
|
moc_main_window.o \
|
||||||
|
moc_new_dialog.o \
|
||||||
|
qrc_qresource.o
|
||||||
|
DIST = /usr/share/qt4/mkspecs/common/unix.conf \
|
||||||
|
/usr/share/qt4/mkspecs/common/linux.conf \
|
||||||
|
/usr/share/qt4/mkspecs/common/gcc-base.conf \
|
||||||
|
/usr/share/qt4/mkspecs/common/gcc-base-unix.conf \
|
||||||
|
/usr/share/qt4/mkspecs/common/g++-base.conf \
|
||||||
|
/usr/share/qt4/mkspecs/common/g++-unix.conf \
|
||||||
|
/usr/share/qt4/mkspecs/qconfig.pri \
|
||||||
|
/usr/share/qt4/mkspecs/features/qt_functions.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/qt_config.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/default_pre.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/release.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/default_post.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/shared.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/warn_on.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/qt.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/unix/thread.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/moc.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/resources.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/uic.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/yacc.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/lex.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
|
||||||
|
Acid.Cam.v2.Linux.Qt.pro
|
||||||
|
QMAKE_TARGET = Acid.Cam.v2.Qt
|
||||||
|
DESTDIR =
|
||||||
|
TARGET = Acid.Cam.v2.Qt
|
||||||
|
|
||||||
|
first: all
|
||||||
|
####### Implicit rules
|
||||||
|
|
||||||
|
.SUFFIXES: .o .c .cpp .cc .cxx .C
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
|
||||||
|
|
||||||
|
.cc.o:
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
|
||||||
|
|
||||||
|
.cxx.o:
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
|
||||||
|
|
||||||
|
.C.o:
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
|
||||||
|
|
||||||
|
####### Build rules
|
||||||
|
|
||||||
|
all: Makefile $(TARGET)
|
||||||
|
|
||||||
|
$(TARGET): $(OBJECTS)
|
||||||
|
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
|
||||||
|
|
||||||
|
Makefile: Acid.Cam.v2.Linux.Qt.pro /usr/share/qt4/mkspecs/linux-g++-64/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \
|
||||||
|
/usr/share/qt4/mkspecs/common/linux.conf \
|
||||||
|
/usr/share/qt4/mkspecs/common/gcc-base.conf \
|
||||||
|
/usr/share/qt4/mkspecs/common/gcc-base-unix.conf \
|
||||||
|
/usr/share/qt4/mkspecs/common/g++-base.conf \
|
||||||
|
/usr/share/qt4/mkspecs/common/g++-unix.conf \
|
||||||
|
/usr/share/qt4/mkspecs/qconfig.pri \
|
||||||
|
/usr/share/qt4/mkspecs/features/qt_functions.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/qt_config.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/default_pre.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/release.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/default_post.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/shared.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/warn_on.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/qt.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/unix/thread.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/moc.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/resources.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/uic.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/yacc.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/lex.prf \
|
||||||
|
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
|
||||||
|
/usr/lib/x86_64-linux-gnu/libQtGui.prl \
|
||||||
|
/usr/lib/x86_64-linux-gnu/libQtCore.prl
|
||||||
|
$(QMAKE) -o Makefile Acid.Cam.v2.Linux.Qt.pro
|
||||||
|
/usr/share/qt4/mkspecs/common/unix.conf:
|
||||||
|
/usr/share/qt4/mkspecs/common/linux.conf:
|
||||||
|
/usr/share/qt4/mkspecs/common/gcc-base.conf:
|
||||||
|
/usr/share/qt4/mkspecs/common/gcc-base-unix.conf:
|
||||||
|
/usr/share/qt4/mkspecs/common/g++-base.conf:
|
||||||
|
/usr/share/qt4/mkspecs/common/g++-unix.conf:
|
||||||
|
/usr/share/qt4/mkspecs/qconfig.pri:
|
||||||
|
/usr/share/qt4/mkspecs/features/qt_functions.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/qt_config.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/default_pre.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/release.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/default_post.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/shared.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/warn_on.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/qt.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/unix/thread.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/moc.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/resources.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/uic.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/yacc.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/lex.prf:
|
||||||
|
/usr/share/qt4/mkspecs/features/include_source_dir.prf:
|
||||||
|
/usr/lib/x86_64-linux-gnu/libQtGui.prl:
|
||||||
|
/usr/lib/x86_64-linux-gnu/libQtCore.prl:
|
||||||
|
qmake: FORCE
|
||||||
|
@$(QMAKE) -o Makefile Acid.Cam.v2.Linux.Qt.pro
|
||||||
|
|
||||||
|
dist:
|
||||||
|
@$(CHK_DIR_EXISTS) .tmp/Acid.Cam.v2.Qt1.0.0 || $(MKDIR) .tmp/Acid.Cam.v2.Qt1.0.0
|
||||||
|
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/Acid.Cam.v2.Qt1.0.0/ && $(COPY_FILE) --parents main_window.h new_dialog.h plugin.h qtheaders.h select_image.h ac.h fractal.h .tmp/Acid.Cam.v2.Qt1.0.0/ && $(COPY_FILE) --parents qresource.qrc .tmp/Acid.Cam.v2.Qt1.0.0/ && $(COPY_FILE) --parents main.cpp main_window.cpp new_dialog.cpp plugin.cpp select_image.cpp ac.cpp fractal.cpp .tmp/Acid.Cam.v2.Qt1.0.0/ && (cd `dirname .tmp/Acid.Cam.v2.Qt1.0.0` && $(TAR) Acid.Cam.v2.Qt1.0.0.tar Acid.Cam.v2.Qt1.0.0 && $(COMPRESS) Acid.Cam.v2.Qt1.0.0.tar) && $(MOVE) `dirname .tmp/Acid.Cam.v2.Qt1.0.0`/Acid.Cam.v2.Qt1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/Acid.Cam.v2.Qt1.0.0
|
||||||
|
|
||||||
|
|
||||||
|
clean:compiler_clean
|
||||||
|
-$(DEL_FILE) $(OBJECTS)
|
||||||
|
-$(DEL_FILE) *~ core *.core
|
||||||
|
|
||||||
|
|
||||||
|
####### Sub-libraries
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
-$(DEL_FILE) $(TARGET)
|
||||||
|
-$(DEL_FILE) Makefile
|
||||||
|
|
||||||
|
|
||||||
|
check: first
|
||||||
|
|
||||||
|
mocclean: compiler_moc_header_clean compiler_moc_source_clean
|
||||||
|
|
||||||
|
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
|
||||||
|
|
||||||
|
compiler_moc_header_make_all: moc_main_window.cpp moc_new_dialog.cpp
|
||||||
|
compiler_moc_header_clean:
|
||||||
|
-$(DEL_FILE) moc_main_window.cpp moc_new_dialog.cpp
|
||||||
|
moc_main_window.cpp: qtheaders.h \
|
||||||
|
ac.h \
|
||||||
|
fractal.h \
|
||||||
|
new_dialog.h \
|
||||||
|
main_window.h
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt4/bin/moc $(DEFINES) $(INCPATH) main_window.h -o moc_main_window.cpp
|
||||||
|
|
||||||
|
moc_new_dialog.cpp: qtheaders.h \
|
||||||
|
ac.h \
|
||||||
|
fractal.h \
|
||||||
|
new_dialog.h
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt4/bin/moc $(DEFINES) $(INCPATH) new_dialog.h -o moc_new_dialog.cpp
|
||||||
|
|
||||||
|
compiler_rcc_make_all: qrc_qresource.cpp
|
||||||
|
compiler_rcc_clean:
|
||||||
|
-$(DEL_FILE) qrc_qresource.cpp
|
||||||
|
qrc_qresource.cpp: qresource.qrc \
|
||||||
|
images/icon.png
|
||||||
|
/usr/lib/x86_64-linux-gnu/qt4/bin/rcc -name qresource qresource.qrc -o qrc_qresource.cpp
|
||||||
|
|
||||||
|
compiler_image_collection_make_all: qmake_image_collection.cpp
|
||||||
|
compiler_image_collection_clean:
|
||||||
|
-$(DEL_FILE) qmake_image_collection.cpp
|
||||||
|
compiler_moc_source_make_all:
|
||||||
|
compiler_moc_source_clean:
|
||||||
|
compiler_uic_make_all:
|
||||||
|
compiler_uic_clean:
|
||||||
|
compiler_yacc_decl_make_all:
|
||||||
|
compiler_yacc_decl_clean:
|
||||||
|
compiler_yacc_impl_make_all:
|
||||||
|
compiler_yacc_impl_clean:
|
||||||
|
compiler_lex_make_all:
|
||||||
|
compiler_lex_clean:
|
||||||
|
compiler_clean: compiler_moc_header_clean compiler_rcc_clean
|
||||||
|
|
||||||
|
####### Compile
|
||||||
|
|
||||||
|
main.o: main.cpp qtheaders.h \
|
||||||
|
ac.h \
|
||||||
|
fractal.h \
|
||||||
|
main_window.h \
|
||||||
|
new_dialog.h
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
|
||||||
|
|
||||||
|
main_window.o: main_window.cpp main_window.h \
|
||||||
|
qtheaders.h \
|
||||||
|
ac.h \
|
||||||
|
fractal.h \
|
||||||
|
new_dialog.h
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main_window.o main_window.cpp
|
||||||
|
|
||||||
|
new_dialog.o: new_dialog.cpp new_dialog.h \
|
||||||
|
qtheaders.h \
|
||||||
|
ac.h \
|
||||||
|
fractal.h \
|
||||||
|
main_window.h
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o new_dialog.o new_dialog.cpp
|
||||||
|
|
||||||
|
plugin.o: plugin.cpp plugin.h \
|
||||||
|
qtheaders.h \
|
||||||
|
ac.h \
|
||||||
|
fractal.h
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o plugin.o plugin.cpp
|
||||||
|
|
||||||
|
select_image.o: select_image.cpp select_image.h \
|
||||||
|
qtheaders.h \
|
||||||
|
ac.h \
|
||||||
|
fractal.h
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o select_image.o select_image.cpp
|
||||||
|
|
||||||
|
ac.o: ac.cpp ac.h \
|
||||||
|
fractal.h
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o ac.o ac.cpp
|
||||||
|
|
||||||
|
fractal.o: fractal.cpp fractal.h
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o fractal.o fractal.cpp
|
||||||
|
|
||||||
|
moc_main_window.o: moc_main_window.cpp
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_main_window.o moc_main_window.cpp
|
||||||
|
|
||||||
|
moc_new_dialog.o: moc_new_dialog.cpp
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_new_dialog.o moc_new_dialog.cpp
|
||||||
|
|
||||||
|
qrc_qresource.o: qrc_qresource.cpp
|
||||||
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_qresource.o qrc_qresource.cpp
|
||||||
|
|
||||||
|
####### Install
|
||||||
|
|
||||||
|
install: FORCE
|
||||||
|
|
||||||
|
uninstall: FORCE
|
||||||
|
|
||||||
|
FORCE:
|
||||||
|
|
||||||
@@ -49,11 +49,11 @@ AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
|
|||||||
void AC_MainWindow::createControls() {
|
void AC_MainWindow::createControls() {
|
||||||
|
|
||||||
filters = new QListWidget(this);
|
filters = new QListWidget(this);
|
||||||
filters->setGeometry(10, 10, 390, 200);
|
filters->setGeometry(10, 30, 390, 180);
|
||||||
filters->show();
|
filters->show();
|
||||||
|
|
||||||
custom_filters = new QListWidget(this);
|
custom_filters = new QListWidget(this);
|
||||||
custom_filters->setGeometry(400, 10, 390, 200);
|
custom_filters->setGeometry(400, 30, 390, 180);
|
||||||
custom_filters->show();
|
custom_filters->show();
|
||||||
|
|
||||||
for(int i = 0; i < ac::draw_max-4; ++i) {
|
for(int i = 0; i < ac::draw_max-4; ++i) {
|
||||||
@@ -133,6 +133,8 @@ void AC_MainWindow::createMenu() {
|
|||||||
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_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("Ctrl+S"));
|
||||||
controls_menu->addAction(controls_snapshot);
|
controls_menu->addAction(controls_snapshot);
|
||||||
@@ -155,6 +157,8 @@ void AC_MainWindow::createMenu() {
|
|||||||
help_menu->addAction(help_about);
|
help_menu->addAction(help_about);
|
||||||
|
|
||||||
connect(help_about, SIGNAL(triggered()), this, SLOT(help_About()));
|
connect(help_about, SIGNAL(triggered()), this, SLOT(help_About()));
|
||||||
|
timer_video = new QTimer(this);
|
||||||
|
timer_camera = new QTimer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AC_MainWindow::addClicked() {
|
void AC_MainWindow::addClicked() {
|
||||||
@@ -195,7 +199,6 @@ void AC_MainWindow::downClicked() {
|
|||||||
void AC_MainWindow::Log(const QString &s) {
|
void AC_MainWindow::Log(const QString &s) {
|
||||||
QString text;
|
QString text;
|
||||||
text = log_text->toPlainText();
|
text = log_text->toPlainText();
|
||||||
text += "\n";
|
|
||||||
text += s;
|
text += s;
|
||||||
log_text->setText(text);
|
log_text->setText(text);
|
||||||
QTextCursor tmpCursor = log_text->textCursor();
|
QTextCursor tmpCursor = log_text->textCursor();
|
||||||
@@ -212,21 +215,55 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
|
|||||||
// if successful
|
// if successful
|
||||||
file_new_capture->setEnabled(false);
|
file_new_capture->setEnabled(false);
|
||||||
file_new_video->setEnabled(false);
|
file_new_video->setEnabled(false);
|
||||||
|
controls_stop->setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, bool record) {
|
bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, bool record) {
|
||||||
|
|
||||||
|
capture_video.open(filename.toStdString());
|
||||||
|
if(!capture_video.isOpened()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
video_frames = capture_video.get(CV_CAP_PROP_FRAME_COUNT);
|
||||||
|
if(video_frames <= 0) return false;
|
||||||
|
video_fps = capture_video.get(CV_CAP_PROP_FPS);
|
||||||
|
|
||||||
|
int res_w = capture_video.get(CV_CAP_PROP_FRAME_WIDTH);
|
||||||
|
int res_h = capture_video.get(CV_CAP_PROP_FRAME_HEIGHT);
|
||||||
|
|
||||||
|
QString str;
|
||||||
|
QTextStream stream(&str);
|
||||||
|
|
||||||
|
stream << "Opened capture device " << res_w << "x" << res_h << "\n";
|
||||||
|
stream << "FPS: " << video_fps << "\n";
|
||||||
|
stream << "Frame Count: " << video_frames << "\n";
|
||||||
|
|
||||||
|
Log(str);
|
||||||
// if successful
|
// if successful
|
||||||
file_new_capture->setEnabled(false);
|
file_new_capture->setEnabled(false);
|
||||||
file_new_video->setEnabled(false);
|
file_new_video->setEnabled(false);
|
||||||
|
controls_stop->setEnabled(true);
|
||||||
|
cv::namedWindow("Acid Cam v2");
|
||||||
|
|
||||||
|
connect(timer_video, SIGNAL(timeout()), this, SLOT(timer_Video()));
|
||||||
|
timer_video->start(1);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AC_MainWindow::controls_Stop() {
|
void AC_MainWindow::controls_Stop() {
|
||||||
|
if(capture_video.isOpened()) {
|
||||||
|
timer_video->stop();
|
||||||
|
capture_video.release();
|
||||||
|
cv::destroyWindow("Acid Cam v2");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(capture_camera.isOpened()) {
|
||||||
|
timer_camera->stop();
|
||||||
|
capture_camera.release();
|
||||||
|
cv::destroyWindow("Acid Cam v2");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AC_MainWindow::file_Exit() {
|
void AC_MainWindow::file_Exit() {
|
||||||
@@ -259,6 +296,20 @@ void AC_MainWindow::timer_Camera() {
|
|||||||
|
|
||||||
void AC_MainWindow::timer_Video() {
|
void AC_MainWindow::timer_Video() {
|
||||||
|
|
||||||
|
cv::Mat mat;
|
||||||
|
if(capture_video.read(mat) == false) {
|
||||||
|
controls_Stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < custom_filters->count(); ++i) {
|
||||||
|
QListWidgetItem *val = custom_filters->item(i);
|
||||||
|
QString name = val->text();
|
||||||
|
if(filter_map[name.toStdString()].first == 0)
|
||||||
|
ac::draw_func[filter_map[name.toStdString()].second](mat);
|
||||||
|
}
|
||||||
|
|
||||||
|
cv::imshow("Acid Cam v2", mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AC_MainWindow::help_About() {
|
void AC_MainWindow::help_About() {
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ private:
|
|||||||
CaptureCamera *cap_camera;
|
CaptureCamera *cap_camera;
|
||||||
CaptureVideo *cap_video;
|
CaptureVideo *cap_video;
|
||||||
cv::VideoCapture capture_camera, capture_video;
|
cv::VideoCapture capture_camera, capture_video;
|
||||||
|
unsigned long video_frames;
|
||||||
|
double video_fps;
|
||||||
|
QTimer *timer_video, *timer_camera;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const char *filer_names[];
|
extern const char *filer_names[];
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ void CaptureCamera::btn_Start() {
|
|||||||
} else {
|
} else {
|
||||||
QMessageBox::information(this, "Could not open Capture device", "Make sure you Webcam is pluged in. If you have more than one Webcam use the proper device index.");
|
QMessageBox::information(this, "Could not open Capture device", "Make sure you Webcam is pluged in. If you have more than one Webcam use the proper device index.");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
QMessageBox::information(this, tr("Error could not open device"), tr("Could not open capture device"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,15 +99,32 @@ void CaptureVideo::setParent(AC_MainWindow *p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CaptureVideo::btn_SetSourceFile() {
|
void CaptureVideo::btn_SetSourceFile() {
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(this,tr("Open Video"), "/home", tr("Video Files (*.avi *.mov *.mp4 *.mkv)"));
|
||||||
|
if(fileName != "")
|
||||||
|
edit_src->setText(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CaptureVideo::btn_SetOutputDir() {
|
void CaptureVideo::btn_SetOutputDir() {
|
||||||
|
QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home",QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
|
if(dir != "")
|
||||||
|
edit_outdir->setText(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CaptureVideo::btn_Start() {
|
void CaptureVideo::btn_Start() {
|
||||||
|
if(edit_src->text().length() <= 0) {
|
||||||
|
QMessageBox::information(this, tr("No Input"), tr("Please Select a Video File"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(edit_outdir->text().length() <= 0) {
|
||||||
|
QMessageBox::information(this, tr("No Output"), tr("Please Select Output Directory"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(win_parent->startVideo(edit_src->text(), edit_outdir->text(), chk_record->isChecked())) {
|
||||||
|
hide();
|
||||||
|
} else {
|
||||||
|
QMessageBox::information(this, tr("Could not open file"), tr("Could not open video file, an error has occured"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include<QTextStream>
|
#include<QTextStream>
|
||||||
#include<QLineEdit>
|
#include<QLineEdit>
|
||||||
#include<QFileDialog>
|
#include<QFileDialog>
|
||||||
|
#include<QTimer>
|
||||||
#include"ac.h"
|
#include"ac.h"
|
||||||
#include"fractal.h"
|
#include"fractal.h"
|
||||||
#include<unordered_map>
|
#include<unordered_map>
|
||||||
|
|||||||
Reference in New Issue
Block a user