This commit is contained in:
Jared Bruni
2020-02-02 13:10:29 -08:00
parent 3143643865
commit f3a8a424b0
2 changed files with 24 additions and 26 deletions

View File

@@ -968,15 +968,17 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
Log(tr("Capture Device Opened [Camera]\n"));
std::ostringstream time_stream;
switch(res) {
case 0:
case 0:
break;
case 1:
res_w = 640;
res_h = 480;
break;
case 1:
case 2:
res_w = 1280;
res_h = 720;
break;
case 2:
case 3:
res_w = 1920;
res_h = 1080;
break;
@@ -998,7 +1000,7 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
std::ostringstream index_val;
index_val << std::setw(4) << std::setfill('0') << (++index);
time_stream << "-" << (m->tm_year + 1900) << "." << (m->tm_mon + 1) << "." << m->tm_mday << "_" << m->tm_hour << "." << m->tm_min << "." << m->tm_sec << "_";
stream_ << outdir << "/" << "Acid.Cam.Video" << "." << out_type << time_stream.str().c_str() << "." << res_w << "x" << res_h << "." "AC2.Output." << index_val.str().c_str() << ext;
stream_ << outdir << "/" << "Acid.Cam.Video" << "." << out_type << time_stream.str().c_str() << "." << "AC2.Output." << index_val.str().c_str() << ext;
/*
bool cw = capture_camera.set(CV_CAP_PROP_FRAME_WIDTH, res_w);
bool ch = capture_camera.set(CV_CAP_PROP_FRAME_HEIGHT, res_h);

View File

@@ -69,37 +69,33 @@ bool Playback::setVideoCamera(std::string name, int type, int device, int res, c
mutex.unlock();
return false;
}
/*#else
if(!capture.isOpened()) {
capture.open(device);
if(!capture.isOpened()) {
mutex.unlock();
return false;
}
}
#endif*/
recording = record;
writer = wr;
int res_w = 640, res_h = 480;
switch(res) {
case 0:
break;
case 1:
res_w = 640;
res_h = 480;
break;
case 1:
case 2:
res_w = 1280;
res_h = 720;
break;
case 2:
case 3:
res_w = 1920;
res_h = 1080;
break;
}
capture.set(cv::CAP_PROP_FRAME_WIDTH, res_w);
capture.set(cv::CAP_PROP_FRAME_HEIGHT, res_h);
double fps = capture.get(cv::CAP_PROP_FPS);
res_w = capture.get(cv::CAP_PROP_FRAME_WIDTH);
res_h = capture.get(cv::CAP_PROP_FRAME_HEIGHT);
if(res != 0) {
capture.set(cv::CAP_PROP_FRAME_WIDTH, res_w);
capture.set(cv::CAP_PROP_FRAME_HEIGHT, res_h);
}
double fps = capture.get(cv::CAP_PROP_FPS);
res_w = capture.get(cv::CAP_PROP_FRAME_WIDTH);
res_h = capture.get(cv::CAP_PROP_FRAME_HEIGHT);
if(name.size()>0) {
writer = cv::VideoWriter(name, type, fps, cv::Size(res_w, res_h), true);
if(!writer.isOpened()) {
@@ -258,9 +254,9 @@ void Playback::drawFilter(cv::Mat &frame, FilterValue &f) {
}
void Playback::run() {
int duration = 1000/ac::fps;
while(!stop) {
mutex.lock();
if(ac::release_frames) {
@@ -290,7 +286,7 @@ void Playback::run() {
cv::flip(frame, temp_frame, 0);
frame = temp_frame;
}
mutex.unlock();
static std::vector<FilterValue> cur;
mutex_shown.lock();
@@ -315,7 +311,7 @@ void Playback::run() {
++cycle_index;
if(cycle_index > static_cast<int>(cycle_values.size()-1))
cycle_index = 0;
break;
case 3:
cycle_image = &cycle_values[cycle_index];
@@ -333,7 +329,7 @@ void Playback::run() {
}
}
mutex.unlock();
if(single_mode == true && alpha > 0) {
if(fadefilter == true) filterFade(frame, current_filter, prev_filter, alpha);
drawEffects(frame);
@@ -358,7 +354,7 @@ void Playback::run() {
} else {
if(_custom_cycle_index > static_cast<int>(cur.size()-1))
_custom_cycle_index = 0;
if(_custom_cycle_index >= 0 && _custom_cycle_index < static_cast<int>(cur.size())) {
drawFilter(frame, cur[_custom_cycle_index]);
msleep(duration/2);