Beispiel #1
0
void loop(NVideoInput::CVideoCapture& videoCapture,
          std::vector<std::shared_ptr<NAlgorithms::IAlertAlgorithm>>& algorithms)
{
    std::vector<std::shared_ptr<CAlertNotification>> alerts(videoCapture.getBufferSizeWithoutConnection());
    for (size_t i = 0; i < videoCapture.getBufferSizeWithoutConnection(); i++)
    {
        alerts[i].reset(new CAlertNotification(i));
    }
    while (true)
    {
        double timeBeging = (double) cv::getTickCount();
        for (size_t bufferId = 0;
             bufferId < videoCapture.getBufferSizeWithoutConnection();
             bufferId++)
        {
            if (videoCapture.processNextFrame(bufferId))
            {
#ifdef __BUILD_MOTION_ALGO__
                if (CConfig::getInstance().mRunStatus.mIsRunMotionAlgo)
                {
                    CMainFunctions::doAlgo( *alerts[bufferId], bufferId, algorithms);
                }
#endif
            }
        }
        CMainFunctions::sleepTo(timeBeging);
        cv::waitKey(1);
    }
}
Beispiel #2
0
CJsonNode CNSTAlerts::Serialize(void) const
{
    CJsonNode           alerts(CJsonNode::NewArrayNode());
    CFastMutexGuard     guard(m_Lock);

    for (map<enum EAlertType,
             SNSTAlertAttributes>::const_iterator  k = m_Alerts.begin();
         k != m_Alerts.end(); ++k) {
        CJsonNode   single_alert(k->second.Serialize());

        single_alert.SetString("Name", x_TypeToId(k->first));
        alerts.Append(single_alert);
    }
    return alerts;
}