mirror of
https://github.com/lostjared/Acid.Cam.v2.Qt.git
synced 2025-12-17 04:10:01 +01:00
worked around bug for MacOS X, now instead of closing camera, just leaves it open then next time it resizes to new resolution.
This commit is contained in:
BIN
src/Acid_Cam_v2_Qt
Executable file
BIN
src/Acid_Cam_v2_Qt
Executable file
Binary file not shown.
343
src/Makefile
Normal file
343
src/Makefile
Normal file
@@ -0,0 +1,343 @@
|
||||
#############################################################################
|
||||
# Makefile for building: Acid_Cam_v2_Qt
|
||||
# Generated by qmake (2.01a) (Qt 4.8.7) on: Sun Mar 5 13:10:37 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 \
|
||||
display_window.cpp \
|
||||
playback_thread.cpp moc_main_window.cpp \
|
||||
moc_new_dialog.cpp \
|
||||
moc_display_window.cpp \
|
||||
moc_playback_thread.cpp \
|
||||
qrc_qresource.cpp
|
||||
OBJECTS = main.o \
|
||||
main_window.o \
|
||||
new_dialog.o \
|
||||
plugin.o \
|
||||
select_image.o \
|
||||
ac.o \
|
||||
fractal.o \
|
||||
display_window.o \
|
||||
playback_thread.o \
|
||||
moc_main_window.o \
|
||||
moc_new_dialog.o \
|
||||
moc_display_window.o \
|
||||
moc_playback_thread.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 display_window.h playback_thread.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 display_window.cpp playback_thread.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 moc_display_window.cpp moc_playback_thread.cpp
|
||||
compiler_moc_header_clean:
|
||||
-$(DEL_FILE) moc_main_window.cpp moc_new_dialog.cpp moc_display_window.cpp moc_playback_thread.cpp
|
||||
moc_main_window.cpp: qtheaders.h \
|
||||
ac.h \
|
||||
fractal.h \
|
||||
new_dialog.h \
|
||||
display_window.h \
|
||||
playback_thread.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
|
||||
|
||||
moc_display_window.cpp: qtheaders.h \
|
||||
ac.h \
|
||||
fractal.h \
|
||||
display_window.h
|
||||
/usr/lib/x86_64-linux-gnu/qt4/bin/moc $(DEFINES) $(INCPATH) display_window.h -o moc_display_window.cpp
|
||||
|
||||
moc_playback_thread.cpp: qtheaders.h \
|
||||
ac.h \
|
||||
fractal.h \
|
||||
playback_thread.h
|
||||
/usr/lib/x86_64-linux-gnu/qt4/bin/moc $(DEFINES) $(INCPATH) playback_thread.h -o moc_playback_thread.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 \
|
||||
display_window.h \
|
||||
playback_thread.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 \
|
||||
display_window.h \
|
||||
playback_thread.h \
|
||||
plugin.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 \
|
||||
display_window.h \
|
||||
playback_thread.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
|
||||
|
||||
display_window.o: display_window.cpp display_window.h \
|
||||
qtheaders.h \
|
||||
ac.h \
|
||||
fractal.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o display_window.o display_window.cpp
|
||||
|
||||
playback_thread.o: playback_thread.cpp playback_thread.h \
|
||||
qtheaders.h \
|
||||
ac.h \
|
||||
fractal.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o playback_thread.o playback_thread.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
|
||||
|
||||
moc_display_window.o: moc_display_window.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_display_window.o moc_display_window.cpp
|
||||
|
||||
moc_playback_thread.o: moc_playback_thread.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_playback_thread.o moc_playback_thread.cpp
|
||||
|
||||
qrc_qresource.o: qrc_qresource.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_qresource.o qrc_qresource.cpp
|
||||
|
||||
####### Install
|
||||
|
||||
install: FORCE
|
||||
|
||||
uninstall: FORCE
|
||||
|
||||
FORCE:
|
||||
|
||||
@@ -302,23 +302,25 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
|
||||
step_frame = false;
|
||||
video_file_name = "";
|
||||
frame_index = 0;
|
||||
/*
|
||||
capture_camera.open(dev);
|
||||
if(!capture_camera.isOpened()) {
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
video_frames = 0;
|
||||
video_fps = 24;
|
||||
video_fps = 24; /*
|
||||
int ores_w = capture_camera.get(CV_CAP_PROP_FRAME_WIDTH);
|
||||
int ores_h = capture_camera.get(CV_CAP_PROP_FRAME_HEIGHT);
|
||||
int res_w = ores_w;
|
||||
int res_h = ores_h;
|
||||
QString str;
|
||||
*/
|
||||
int res_w = 0;
|
||||
int res_h = 0;
|
||||
/*QString str;
|
||||
QTextStream stream(&str);
|
||||
stream << "Opened capture device " << res_w << "x" << res_h << "\n";
|
||||
stream << "FPS: " << video_fps << "\n";
|
||||
stream << "FPS: " << video_fps << "\n";*/
|
||||
output_directory = outdir;
|
||||
frame_index = 0;
|
||||
Log(str);
|
||||
//Log(str);
|
||||
paused = false;
|
||||
recording = record;
|
||||
QString output_name;
|
||||
@@ -349,8 +351,11 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
|
||||
case 2:
|
||||
res_w = 1920;
|
||||
res_h = 1080;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
bool cw = capture_camera.set(CV_CAP_PROP_FRAME_WIDTH, res_w);
|
||||
bool ch = capture_camera.set(CV_CAP_PROP_FRAME_HEIGHT, res_h);
|
||||
|
||||
@@ -360,12 +365,8 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
|
||||
res_h = ores_h;
|
||||
capture_camera.set(CV_CAP_PROP_FRAME_WIDTH, res_w);
|
||||
capture_camera.set(CV_CAP_PROP_FRAME_HEIGHT, res_h);
|
||||
}
|
||||
} */
|
||||
|
||||
QString res_str;
|
||||
QTextStream res_s(&res_str);
|
||||
res_s << "Resolution set to: " << res_w << "x" << res_h << "\n";
|
||||
Log(res_str);
|
||||
if(recording) {
|
||||
video_file_name = output_name;
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
@@ -385,7 +386,7 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
|
||||
file_new_capture->setEnabled(false);
|
||||
file_new_video->setEnabled(false);
|
||||
controls_stop->setEnabled(true);
|
||||
playback->setVideo(capture_camera, writer, recording);
|
||||
playback->setVideoCamera(dev, res, writer, recording);
|
||||
playback->Play();
|
||||
disp->show();
|
||||
return true;
|
||||
@@ -478,7 +479,6 @@ void AC_MainWindow::controls_Stop() {
|
||||
if(capture_video.isOpened()) {
|
||||
capture_video.release();
|
||||
if(recording == true) writer.release();
|
||||
cv::destroyWindow("Acid Cam v2");
|
||||
file_new_capture->setEnabled(true);
|
||||
file_new_video->setEnabled(true);
|
||||
if(recording) {
|
||||
@@ -490,10 +490,9 @@ void AC_MainWindow::controls_Stop() {
|
||||
disp->hide();
|
||||
playback->Release();
|
||||
}
|
||||
if(capture_camera.isOpened()) {
|
||||
capture_camera.release();
|
||||
if(programMode == MODE_CAMERA) {
|
||||
//capture_camera.release();
|
||||
if(recording == true) writer.release();
|
||||
cv::destroyWindow("Acid Cam v2");
|
||||
file_new_capture->setEnabled(true);
|
||||
file_new_video->setEnabled(true);
|
||||
if(recording) {
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#include "display_window.h"
|
||||
#include "playback_thread.h"
|
||||
|
||||
enum VideoMode { MODE_CAMERA = 0, MODE_VIDEO };
|
||||
|
||||
class AC_MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -17,6 +17,7 @@ void Playback::Play() {
|
||||
}
|
||||
|
||||
void Playback::setVideo(cv::VideoCapture cap, cv::VideoWriter wr, bool record) {
|
||||
mode = MODE_VIDEO;
|
||||
mutex.lock();
|
||||
capture = cap;
|
||||
writer = wr;
|
||||
@@ -28,6 +29,42 @@ void Playback::setVideo(cv::VideoCapture cap, cv::VideoWriter wr, bool record) {
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
void Playback::setVideoCamera(int device, int res, cv::VideoWriter wr, bool record) {
|
||||
mode = MODE_CAMERA;
|
||||
mutex.lock();
|
||||
if(capture.isOpened()) {
|
||||
|
||||
} else {
|
||||
capture.open(device);
|
||||
}
|
||||
recording = record;
|
||||
writer = wr;
|
||||
int res_w = 0, res_h = 0, ores_w = 640, ores_h = 480;
|
||||
switch(res) {
|
||||
case 0:
|
||||
res_w = 640;
|
||||
res_h = 480;
|
||||
break;
|
||||
case 1:
|
||||
res_w = 1280;
|
||||
res_h = 720;
|
||||
break;
|
||||
case 2:
|
||||
res_w = 1920;
|
||||
res_h = 1080;
|
||||
break;
|
||||
}
|
||||
bool cw = capture.set(CV_CAP_PROP_FRAME_WIDTH, res_w);
|
||||
bool ch = capture.set(CV_CAP_PROP_FRAME_HEIGHT, res_h);
|
||||
if(cw == false || ch == false) {
|
||||
res_w = ores_w;
|
||||
res_h = ores_h;
|
||||
capture.set(CV_CAP_PROP_FRAME_WIDTH, res_w);
|
||||
capture.set(CV_CAP_PROP_FRAME_HEIGHT, res_h);
|
||||
}
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
void Playback::setVector(std::vector<std::pair<int, int>> v) {
|
||||
mutex_add.lock();
|
||||
current = v;
|
||||
@@ -126,7 +163,7 @@ void Playback::Stop() {
|
||||
void Playback::Release() {
|
||||
mutex.lock();
|
||||
stop = true;
|
||||
if(capture.isOpened()) capture.release();
|
||||
if(capture.isOpened() && mode == MODE_VIDEO) capture.release();
|
||||
if(writer.isOpened()) writer.release();
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
#define __PLAYBACK_WINDOW_H__
|
||||
|
||||
#include "qtheaders.h"
|
||||
|
||||
#include<atomic>
|
||||
|
||||
enum VideoMode { MODE_CAMERA = 0, MODE_VIDEO };
|
||||
|
||||
class Playback : public QThread {
|
||||
Q_OBJECT
|
||||
private:
|
||||
@@ -21,6 +22,7 @@ private:
|
||||
QImage img;
|
||||
std::vector<std::pair<int, int>> current;
|
||||
bool isPaused, isStep;
|
||||
VideoMode mode;
|
||||
public:
|
||||
Playback(QObject *parent = 0);
|
||||
~Playback();
|
||||
@@ -28,6 +30,7 @@ public:
|
||||
void Stop();
|
||||
void Release();
|
||||
void setVideo(cv::VideoCapture cap, cv::VideoWriter writer, bool record);
|
||||
void setVideoCamera(int device, int res, cv::VideoWriter writer, bool record);
|
||||
bool isStopped() const;
|
||||
void run();
|
||||
void msleep(int ms);
|
||||
|
||||
Reference in New Issue
Block a user