mirror of
https://github.com/lostjared/Acid.Cam.v2.Qt.git
synced 2025-12-17 12:20:00 +01:00
updated playback
This commit is contained in:
@@ -467,7 +467,7 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
|
|||||||
#else
|
#else
|
||||||
ext = ".avi";
|
ext = ".avi";
|
||||||
#endif
|
#endif
|
||||||
|
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 << "_";
|
||||||
stream_ << outdir << "/" << "Video." << time_stream.str().c_str() << "AC2.Output." << (++index) << ext;
|
stream_ << outdir << "/" << "Video." << time_stream.str().c_str() << "AC2.Output." << (++index) << ext;
|
||||||
@@ -549,7 +549,7 @@ bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, b
|
|||||||
int res_h = capture_video.get(CV_CAP_PROP_FRAME_HEIGHT);
|
int res_h = capture_video.get(CV_CAP_PROP_FRAME_HEIGHT);
|
||||||
QString str;
|
QString str;
|
||||||
QTextStream stream(&str);
|
QTextStream stream(&str);
|
||||||
stream << "Opened capture device " << res_w << "x" << res_h << "\n";
|
stream << "Opened capture device [Video] " << res_w << "x" << res_h << "\n";
|
||||||
stream << "Video File: " << filename << "\n";
|
stream << "Video File: " << filename << "\n";
|
||||||
stream << "FPS: " << video_fps << "\n";
|
stream << "FPS: " << video_fps << "\n";
|
||||||
stream << "Frame Count: " << video_frames << "\n";
|
stream << "Frame Count: " << video_frames << "\n";
|
||||||
@@ -636,6 +636,7 @@ void AC_MainWindow::controls_Stop() {
|
|||||||
disp->hide();
|
disp->hide();
|
||||||
playback->Release();
|
playback->Release();
|
||||||
}
|
}
|
||||||
|
Log(tr("Capture device [Closed]\n"));;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AC_MainWindow::controls_ShowVideo() {
|
void AC_MainWindow::controls_ShowVideo() {
|
||||||
|
|||||||
@@ -136,6 +136,32 @@ void Playback::setDisplayed(bool shown) {
|
|||||||
video_shown = shown;
|
video_shown = shown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Playback::drawEffects(cv::Mat &frame) {
|
||||||
|
if(ac::set_color_map > 0) ac::ApplyColorMap(frame);
|
||||||
|
if(bright_ > 0) {
|
||||||
|
ac::setBrightness(frame, 1.0, bright_);
|
||||||
|
}
|
||||||
|
if(gamma_ > 0) {
|
||||||
|
cv::Mat gam = frame.clone();
|
||||||
|
ac::setGamma(gam, frame, gamma_);
|
||||||
|
}
|
||||||
|
if(saturation_ > 0) {
|
||||||
|
ac::setSaturation(frame, saturation_);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Playback::drawFilter(cv::Mat &frame, std::pair<int, int> &filter) {
|
||||||
|
if(filter.first == 0) {
|
||||||
|
ac::draw_func[filter.second](frame);
|
||||||
|
} else if(current_filter.first == 1) {
|
||||||
|
current_filterx = filter.second;
|
||||||
|
ac::alphaFlame(frame);
|
||||||
|
} else if(filter.first == 2) {
|
||||||
|
draw_plugin(frame, filter.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Playback::run() {
|
void Playback::run() {
|
||||||
|
|
||||||
int duration = 1000/ac::fps;
|
int duration = 1000/ac::fps;
|
||||||
@@ -155,56 +181,22 @@ void Playback::run() {
|
|||||||
mutex_shown.unlock();
|
mutex_shown.unlock();
|
||||||
ac::orig_frame = frame.clone();
|
ac::orig_frame = frame.clone();
|
||||||
if(single_mode == true) {
|
if(single_mode == true) {
|
||||||
ac::in_custom = false;
|
|
||||||
if(current_filter.first == 0) {
|
|
||||||
ac::draw_func[current_filter.second](frame);
|
|
||||||
} else if(current_filter.first == 1) {
|
|
||||||
current_filterx = current_filter.second;
|
|
||||||
ac::alphaFlame(frame);
|
|
||||||
} else if(current_filter.first == 2) {
|
|
||||||
draw_plugin(frame, current_filter.second);
|
|
||||||
}
|
|
||||||
msleep(duration/2);
|
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
if(ac::set_color_map > 0) ac::ApplyColorMap(frame);
|
ac::in_custom = false;
|
||||||
if(bright_ > 0) {
|
drawFilter(frame, current_filter);
|
||||||
ac::setBrightness(frame, 1.0, bright_);
|
msleep(duration/2);
|
||||||
}
|
drawEffects(frame);
|
||||||
if(gamma_ > 0) {
|
|
||||||
cv::Mat gam = frame.clone();
|
|
||||||
ac::setGamma(gam, frame, gamma_);
|
|
||||||
}
|
|
||||||
if(saturation_ > 0) {
|
|
||||||
ac::setSaturation(frame, saturation_);
|
|
||||||
}
|
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
} else if(cur.size()>0) {
|
} else if(cur.size()>0) {
|
||||||
|
mutex.lock();
|
||||||
ac::in_custom = true;
|
ac::in_custom = true;
|
||||||
for(unsigned int i = 0; i < cur.size(); ++i) {
|
for(unsigned int i = 0; i < cur.size(); ++i) {
|
||||||
if(i == cur.size()-1)
|
if(i == cur.size()-1)
|
||||||
ac::in_custom = false;
|
ac::in_custom = false;
|
||||||
if(cur[i].first == 0) {
|
drawFilter(frame, cur[i]);
|
||||||
ac::draw_func[cur[i].second](frame);
|
|
||||||
} else if(cur[i].first == 1) {
|
|
||||||
current_filterx = cur[i].second;
|
|
||||||
ac::alphaFlame(frame);
|
|
||||||
} else if(cur[i].first == 2) {
|
|
||||||
draw_plugin(frame, cur[i].second);
|
|
||||||
}
|
|
||||||
msleep(duration/2);
|
msleep(duration/2);
|
||||||
}
|
}
|
||||||
mutex.lock();
|
drawEffects(frame);
|
||||||
if(ac::set_color_map > 0) ac::ApplyColorMap(frame);
|
|
||||||
if(bright_ > 0) {
|
|
||||||
ac::setBrightness(frame, 1.0, bright_);
|
|
||||||
}
|
|
||||||
if(gamma_ > 0) {
|
|
||||||
cv::Mat gam = frame.clone();
|
|
||||||
ac::setGamma(gam, frame, gamma_);
|
|
||||||
}
|
|
||||||
if(saturation_ > 0) {
|
|
||||||
ac::setSaturation(frame, saturation_);
|
|
||||||
}
|
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
} else {
|
} else {
|
||||||
msleep(duration);
|
msleep(duration);
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ public:
|
|||||||
void setDisplayed(bool shown);
|
void setDisplayed(bool shown);
|
||||||
void setIndexChanged(std::string name);
|
void setIndexChanged(std::string name);
|
||||||
void setSingleMode(bool val);
|
void setSingleMode(bool val);
|
||||||
|
void drawFilter(cv::Mat &frame, std::pair<int, int> &filter);
|
||||||
|
void drawEffects(cv::Mat &frame);
|
||||||
signals:
|
signals:
|
||||||
void procImage(const QImage image);
|
void procImage(const QImage image);
|
||||||
void stopRecording();
|
void stopRecording();
|
||||||
|
|||||||
Reference in New Issue
Block a user