Commit 0a05db5f authored by Thiago Santini's avatar Thiago Santini

Handles monocular recordings playback

parent d3796708
......@@ -557,10 +557,21 @@ void PostProcessingWidget::startPlayback(QFileInfo& info)
ui->playbackSlider->setMaximum(videoSource->getFrameCount());
ui->playbackSlider->setValue(0);
leftEyeVideoSource = new VideoSource();
leftEyeVideoSource->init(leftEyeInfo.absoluteFilePath(), findAssociatedDataFile(dir, leftEyeInfo));
rightEyeVideoSource = new VideoSource();
rightEyeVideoSource->init(rightEyeInfo.absoluteFilePath(), findAssociatedDataFile(dir, rightEyeInfo));
auto openVideo = [&](const QFileInfo &info) {
VideoSource *vs = nullptr;
if (info.exists() && info.isFile()) {
vs = new VideoSource();
vs->init(info.absoluteFilePath(), findAssociatedDataFile(dir, info));
if (!vs->isReady()) {
vs->deleteLater();
vs = nullptr;
}
}
return vs;
};
leftEyeVideoSource = openVideo(leftEyeInfo);
rightEyeVideoSource = openVideo(rightEyeInfo);
QMetaObject::invokeMethod(videoSource, "play");
ui->statusbar->showMessage("Playing...");
......@@ -600,9 +611,6 @@ void PostProcessingWidget::present(const VideoFrame& videoFrame)
tuple.field.input = videoFrame.frame;
if (ui->showEyesCheckBox->isChecked()) {
tuple.lEye.input = leftEyeVideoSource->getFrameAt(tuple.lEye.timestamp);
tuple.rEye.input = rightEyeVideoSource->getFrameAt(tuple.rEye.timestamp);
// TODO:
// temporary solution to get the eye projection, fix later
auto projectEye = [](EyeData& ed, float radius = 12) {
......@@ -613,12 +621,18 @@ void PostProcessingWidget::present(const VideoFrame& videoFrame)
projection.center.y = 0.5 * ed.input.rows + focal_length * center(1) / center(2);
projection.size.width = projection.size.height = 2 * focal_length * radius / center(2);
};
projectEye(tuple.lEye);
projectEye(tuple.rEye);
if (leftEyeVideoSource && leftEyeVideoSource->isReady()) {
tuple.lEye.input = leftEyeVideoSource->getFrameAt(tuple.lEye.timestamp);
projectEye(tuple.lEye);
emit leftEyePresent(tuple.lEye);
}
if (rightEyeVideoSource && rightEyeVideoSource->isReady()) {
tuple.rEye.input = rightEyeVideoSource->getFrameAt(tuple.rEye.timestamp);
projectEye(tuple.rEye);
emit rightEyePresent(tuple.rEye);
}
}
emit present(tuple);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment