当前位置: 首页>>代码示例>>C++>>正文


C++ CSettingList::getSetting方法代码示例

本文整理汇总了C++中CSettingList::getSetting方法的典型用法代码示例。如果您正苦于以下问题:C++ CSettingList::getSetting方法的具体用法?C++ CSettingList::getSetting怎么用?C++ CSettingList::getSetting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSettingList的用法示例。


在下文中一共展示了CSettingList::getSetting方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: detectBlobs

void CUpperGoalDetector::detectBlobs(CVideoFrame * pFrame, CFrameGrinder* pFrameGrinder)
{
    try
    {
        static struct timespec timeLastCameraFrame = {0};
        static struct timespec timeNow = {0};
        static cv::Scalar lowerBounds = cv::Scalar(79,0,150);
	static cv::Scalar upperBounds = cv::Scalar(96,255,250);
        
        cv::Mat img_hsv, img_blur, goal_blob;
        static int iCount = 0;
        
        int timeSinceLastCameraFrameMilliseconds = (int) CTestMonitor::getDeltaTimeMilliseconds(
                timeLastCameraFrame,
                pFrame->m_timeAddedToQueue[(int) CVideoFrame::FRAME_QUEUE_WAIT_FOR_BLOB_DETECT]);
        timeLastCameraFrame = pFrame->m_timeAddedToQueue[(int) CVideoFrame::FRAME_QUEUE_WAIT_FOR_BLOB_DETECT];

        // RBG is flawed as a way to filter based on color because the brightness is combined 
        // with the color info. 
        // Not so with HSV, where Hue and Saturation are maintained separately
        // OpenCV has a handy conversion from RGB to HSV
        cv::cvtColor(pFrame->m_frame, img_hsv, CV_BGR2HSV);
        
        cv::GaussianBlur(img_hsv, img_blur, cv::Size(5,5),1.5);

       // Look for the green hue we are emitting from the LED halo 
        if(g_settings.isDynamicSettingsEnabled())
        {
             g_settings.getValueFromFile(CSetting::SETTING_FILTER_HUE_LOWER_BOUND);
             g_settings.getValueFromFile(CSetting::SETTING_FILTER_HUE_UPPER_BOUND);
        }
        if(g_settings.isValueChanged(CSetting::SETTING_FILTER_HUE_LOWER_BOUND))
        {
            lowerBounds = cv::Scalar(g_settings.getSetting(CSetting::SETTING_FILTER_HUE_LOWER_BOUND),0,150);
        }
        if(g_settings.isValueChanged(CSetting::SETTING_FILTER_HUE_UPPER_BOUND))
        {
            upperBounds = cv::Scalar(g_settings.getSetting(CSetting::SETTING_FILTER_HUE_UPPER_BOUND),255,250);
        }

        // Find the bright response from the retro-reflective tape
        cv::inRange(img_blur, lowerBounds, upperBounds, goal_blob);
        pFrame->m_filteredFrame = goal_blob.clone();
            
        iCount++;
        if ((iCount % 17) == 0)
        {
            pFrameGrinder->m_testMonitor.saveFrameToJpeg(pFrame->m_filteredFrame);
        }

        //Find the contours. Use the contourOutput Mat so the original image doesn't get overwritten
        cv::vector<std::vector<cv::Point> > goalContours;
        cv::findContours(goal_blob, goalContours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);
        
        CUpperGoalRectangle upperGoalRectangle;
        float upperGoalAzimuthDegrees = 0.0;
        float distanceToUpperGoalInches = 0.0;
        bool isUpperGoalFound = false;
        isUpperGoalFound = filterContours(goalContours, pFrame->m_frame.rows, pFrame->m_frame.cols,
                upperGoalRectangle, upperGoalAzimuthDegrees, distanceToUpperGoalInches);
       
        CTestMonitor::getTicks(&timeNow);
        int timeLatencyThisCameraFrameMilliseconds = (int) CTestMonitor::getDeltaTimeMilliseconds(
                pFrame->m_timeAddedToQueue[(int) CVideoFrame::FRAME_QUEUE_WAIT_FOR_BLOB_DETECT],
                timeNow);

        pFrame->m_targetInfo.updateTargetInfo(
                timeSinceLastCameraFrameMilliseconds, timeLatencyThisCameraFrameMilliseconds, 
                isUpperGoalFound, upperGoalAzimuthDegrees, distanceToUpperGoalInches, upperGoalRectangle.center.x);

        pFrame->updateAnnotationInfo(upperGoalRectangle);

        m_gpioLed.setGreenLED(isUpperGoalFound, pFrame->m_timeRemovedFromQueue[(int) CVideoFrame::FRAME_QUEUE_WAIT_FOR_BLOB_DETECT]);
    }
    catch (...)
    {
    }
}
开发者ID:Team4276,项目名称:2016_VisionSystem,代码行数:78,代码来源:CUpperGoalDetector.cpp


注:本文中的CSettingList::getSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。