goto frame is working

This commit is contained in:
lostjared
2018-08-30 04:59:19 -07:00
parent 646faeac2c
commit 68bc7dbda3
6 changed files with 61 additions and 9 deletions

View File

@@ -280,6 +280,7 @@ void Playback::run() {
}
}
Playback::~Playback() {
mutex.lock();
stop = true;
@@ -298,6 +299,22 @@ void Playback::setFrameIndex(const long &index) {
mutex.unlock();
}
bool Playback::getFrame(QImage &img, const int &index) {
QImage image;
setFrameIndex(index);
mutex.lock();
cv::Mat frame;
if(mode == MODE_VIDEO && capture.read(frame)) {
cv::cvtColor(frame, rgb_frame, CV_BGR2RGB);
img = QImage((const unsigned char*)(rgb_frame.data), rgb_frame.cols, rgb_frame.rows, QImage::Format_RGB888);
mutex.unlock();
setFrameIndex(index);
return true;
}
mutex.unlock();
return false;
}
void Playback::enableRepeat(bool re) {
mutex.lock();
repeat_video = re;