#ifndef MOVIEANALYZER_H #define MOVIEANALYZER_H #include #include #include #include #include #include #include #include "VideoFrameProcessor.h" #include "VideoFrame.h" #include "Segment.h" #include "UtteranceTree.h" #include "SpkDiarMonitor.h" class MovieAnalyzer: public QWidget { Q_OBJECT public: MovieAnalyzer(QWidget *parent = 0); ~MovieAnalyzer(); bool extractVideoFrames(const QString &fName); bool extractShots(const QString &fName, int histoType, int nVBins, int nHBins, int nSBins, int metrics, qreal threshold1, qreal threshold2, int nVBlock, int nHBlock, bool viewProgress = true); bool labelSimilarShots(QString fName, int histoType, int nVBins, int nHBins, int nSBins, int metrics, qreal maxDist, int windowSize, const QList &shotPositions, int nVBlock, int nHBlock, bool viewProgress); QList getTruePositive() const; bool localSpkDiar(QList> subBound, QMap>> shotPatterns, QMap>> strictShotPattBound, UtteranceTree::DistType dist, bool norm, UtteranceTree::AgrCrit agr, UtteranceTree::PartMeth partMeth, bool weight, bool sigma, const QString &baseName); bool localSpkDiarBaseline(QMap>> shotPatterns, QList> subBound, QMap>> shotUtterances, QMap>> strictShotPattBound, const QString &baseName); bool globalSpkDiar(const QString &baseName); public slots: void setSpeakerPartition(QList> partition); void setDiarData(const arma::mat &E, const arma::mat &Sigma, const arma::mat &W); void setDiarData(const arma::mat &E, const arma::mat &Sigma, const arma::mat &W, QMap>> speakers); void playSpeakers(QList speakers); signals: void setResolution(const QSize &resolution); void setFps(qreal fps); void appendVideoFrame(int id, qint64 position); void insertShot(qint64 position, Segment::Source source); void labelSimShot(qint64 position, int nCamera, Segment::Source source); void setSpeaker(qint64 start, qint64 end, const QString &speaker, VideoFrame::SpeakerSource source); void playSegments(QList> segments); void setLocalDer(const QString &score); void setGlobalDer(const QString &score); private: bool isNewShot() const; QVector splitImage(const cv::Mat &frame, int nVBlock, int nHBlock); qreal meanDistance(const QVector &distance); void normalize(UtteranceTree::DistType dist); QPair adjustSubBoundaries(qint64 subStart, qint64 subEnd, QList> shotPattBound); QString retrieveDer(const QString fName); SpkDiarMonitor *m_treeMonitor; cv::VideoCapture m_cap; VideoFrameProcessor *m_processor; QVector m_prevLocHisto; cv::Mat m_prevGlobHisto; arma::mat E; arma::mat CovInv; arma::mat Sigma; arma::mat CovW; QMap>> m_utterances; QList m_speakers; QString m_baseName; }; #endif