Пример #1
0
bool SndFileSource::openNextFile()
    {
    if (mSoundFile)
        {
        sf_close(mSoundFile);
        mSoundFile = 0;
        }

    QString filename = getNextFilePath();
    if (filename.isEmpty())
        return false;

    SF_INFO fileInfo;
    memset(&fileInfo, 0, sizeof(fileInfo));
    mSoundFile = sf_open(qPrintable(filename), SFM_READ, &fileInfo);
    if (!mSoundFile)
        return false;

    Q_ASSERT(fileInfo.samplerate);
    mAlsaFrame.setChannelsNo(fileInfo.channels);
    mAlsaFrame.setSampleTime(1.0/fileInfo.samplerate);
    mAlsaFrame.setFrameTime(AlsaFrame::DefaultFrameTime);
    mAlsaFrame.setSourceName(filename);
    return true;
    }
Пример #2
0
bool CTestMonitor::saveFrameToJpeg(cv::Mat frame)
{
    if (m_isMonitorEnabled)
    {
        std::vector<int> qualityType;
        qualityType.push_back(CV_IMWRITE_JPEG_QUALITY);
        qualityType.push_back(90);

        deleteFileByNumberIfExists(m_nNextFile, m_sLogFolder);
        std::string sFilePath = getNextFilePath(m_sLogFolder);
        sFilePath += ".jpg";
        cv::imwrite(sFilePath.c_str(), frame, qualityType);
    }
}
Пример #3
0
void MatrixFileSource::process()
    {
    QString filename = getNextFilePath();
    if (filename.isEmpty())
        emit processingCompleted();

    else
        {
        arma::mat frame;
        if (data::Load(filename.toStdString(), frame, true))
            {
            mMatrixFrame = frame;
            emit framesReady();
            }
        }
    }
Пример #4
0
bool CTestMonitor::enableVideoCollection(bool bEnable, int framesPerSec, unsigned int height, unsigned int width, int codec)
{
    int nColor = 1;
    cv::Size mySize = cv::Size(width, height);

    std::string sFilePath = getNextFilePath(m_sLogVideoFolder);
    sFilePath += ".avi";

    //make output video file  
    m_outVideo.open(sFilePath, codec, framesPerSec, mySize, nColor);
    if (!m_outVideo.isOpened())
    {
        return false;
    }
    return true;
}