bool VideoAnalyzer::nextFrame() {
	if (_videoCapture==NULL) return false;
	if (_currentFrameIndex>=_frameCount) return false;
	
    _videoCapture->set(cv::CAP_PROP_POS_FRAMES, _nextFrameIndex);
	(*_videoCapture) >> _currentFrame;
	
	if (_analyzedFrames%2==0) {
		_evenFrame.release();
		_evenFrame = _currentFrame.clone();
	}
	else {
		_oddFrame.release();
		_oddFrame = _currentFrame.clone();
	}
	
	if (_currentFrameIndex==0) {
		analysisStarted();
	}
	else if (_analyzerCallback && _analyzerCallback->analyze(_evenFrame, _oddFrame)) {
		callFrameCallback();
	}

	++_analyzedFrames;
	_nextFrameIndex += _frameStep;
	_currentFrameIndex = _nextFrameIndex;
	
	if (_nextFrameIndex>=_frameCount) {
		analysisFinished();
	}
	
	return true;
}
Beispiel #2
0
DetailWindow::DetailWindow(QWidget *parent, QString path) : QMainWindow(parent), ui(new Ui::DetailWindow){
  ui->setupUi(this);
  //: The title of the Detail window
  this->setWindowTitle(GuiStrings::getInstance()->appName() + GuiStrings::getInstance()->delim() + tr("Detailed Analysis"));
  //: A tooltip on the Detail window
  ui->chromaColourCombo->setToolTip(wrapToolTip(tr("Choose the colour scheme for the chromagram. Some provide higher contrast than others.")));
  //: A tooltip on the Detail window
  ui->colourScaleLabel->setToolTip(wrapToolTip(tr("This is the colour scale of the current chromagram. You can change the colour scheme using the dropdown below.")));
  connect(&analysisWatcher, SIGNAL(finished()), this, SLOT(analysisFinished()));
  allowDrops = true;
  ui->progressBar->setVisible(false);
  ui->runButton->setEnabled(false);
  layoutScaling();
  drawColourScale();
  drawPianoKeys();
  blankVisualisations();
  blankKeyLabel();
  if(path != ""){
    filePath = path;
    runAnalysis();
  }
}