Blame view
MovieAnalyzer.h
3.14 KB
3f2992b2c
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
#ifndef MOVIEANALYZER_H #define MOVIEANALYZER_H #include <QWidget> #include <QString> #include <QSize> #include <QVector> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <armadillo> #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<qint64> &shotPositions, int nVBlock, int nHBlock, bool viewProgress); QList<qint64> getTruePositive() const; bool localSpkDiar(QList<QPair<qint64, qint64>> subBound, QMap<QString, QList<QPair<int, qreal>>> shotPatterns, QMap<QString, QList<QPair<qint64, qint64>>> strictShotPattBound, UtteranceTree::DistType dist, bool norm, UtteranceTree::AgrCrit agr, UtteranceTree::PartMeth partMeth, bool weight, bool sigma, const QString &baseName); bool localSpkDiarBaseline(QMap<QString, QList<QPair<int, qreal>>> shotPatterns, QList<QPair<qint64, qint64>> subBound, QMap<QString, QList<QPair<int, qreal>>> shotUtterances, QMap<QString, QList<QPair<qint64, qint64>>> strictShotPattBound, const QString &baseName); bool globalSpkDiar(const QString &baseName); public slots: void setSpeakerPartition(QList<QList<int>> 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<QString, QList<QPair<qreal, qreal>>> speakers); void playSpeakers(QList<int> 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<QPair<qint64, qint64>> segments); void setLocalDer(const QString &score); void setGlobalDer(const QString &score); private: bool isNewShot() const; QVector<cv::Mat> splitImage(const cv::Mat &frame, int nVBlock, int nHBlock); qreal meanDistance(const QVector<qreal> &distance); void normalize(UtteranceTree::DistType dist); QPair<qint64, qint64> adjustSubBoundaries(qint64 subStart, qint64 subEnd, QList<QPair<qint64, qint64>> shotPattBound); QString retrieveDer(const QString fName); SpkDiarMonitor *m_treeMonitor; cv::VideoCapture m_cap; VideoFrameProcessor *m_processor; QVector<cv::Mat> m_prevLocHisto; cv::Mat m_prevGlobHisto; arma::mat E; arma::mat CovInv; arma::mat Sigma; arma::mat CovW; QMap<QString, QList<QPair<qreal, qreal>>> m_utterances; QList<QString> m_speakers; QString m_baseName; }; #endif |