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


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

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


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

示例1: data_mat

    /******************************************************************************
    Description.: this thread worker grabs a frame and copies it to the global buffer
    Input Value.: unused
    Return Value: unused, always NULL
     ******************************************************************************/
    void *cam_thread(void *arg) {
        
        g_settings.init();
        setCameraExposure();
        
        CVideoFrame* pFrame = NULL;

#ifndef TEST_USE_JPEGS_NOT_CAMERA 
        int width = VIEW_PIXEL_X_WIDTH;
        int height = VIEW_PIXEL_Y_HEIGHT;
        IplImage * img = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 3); // obraz OpenCV
#endif

        frameGrinder.init();

#ifdef TEST_USE_JPEGS_NOT_CAMERA 
        std::string sBasePath = "/home/";
        sBasePath += HOME_NAME;
        std::string sPath = sBasePath;
        sPath += "/0243-20150125-22-21-46.jpg";
        //sPath += "/0007-20150125-22-36-25.jpg";  
        cv::Mat frame1 = cv::imread(sPath.c_str(), CV_LOAD_IMAGE_COLOR);
        if (frame1.empty()) {
            dbgMsg_s("Failed to read image data from a file1\n");
        }

        sPath = sBasePath;
        sPath += "/0243-20150125-22-21-46.jpg";
        //sPath += "/0007-20150125-22-36-25.jpg";  
        cv::Mat frame2 = cv::imread(sPath.c_str(), CV_LOAD_IMAGE_COLOR);
        if (frame2.empty()) {
            dbgMsg_s("Failed to read image data from a file2\n");
        }
        bool toggle = false;
#endif

        context *pcontext = (context*) arg;
        pglobal = pcontext->pglobal;

        /* set cleanup handler to cleanup allocated ressources */
        pthread_cleanup_push(cam_cleanup, pcontext);

        while (!pglobal->stop) {
            while (pcontext->videoIn->streamingState == STREAMING_PAUSED) {
                usleep(1); // maybe not the best way so FIXME
            }

#ifdef TEST_USE_JPEGS_NOT_CAMERA 
            if (frameGrinder.safeGetFreeFrame(&pFrame)) {
                if (toggle) {
                    pFrame->m_frame = frame1;
                } else {
                    pFrame->m_frame = frame2;
                }
                toggle = (!toggle);
                if (!pFrame->m_frame.empty()) {
                    frameGrinder.safeAddTail(pFrame, CVideoFrame::FRAME_QUEUE_WAIT_FOR_BLOB_DETECT);
                } else {
                    dbgMsg_s("Frame is empty\n");
                    frameGrinder.safeAddTail(pFrame, CVideoFrame::FRAME_QUEUE_FREE);
                }
                frameGrinder.m_testMonitor.m_nTasksDone[CTestMonitor::TASK_DONE_CAMERA]++;
            }

#else
            /* grab a frame */
            if (uvcGrab(pcontext->videoIn) < 0) {
                IPRINT("Error grabbing frames\n");
                exit(EXIT_FAILURE);
            }

            DBG("received frame of size: %d from plugin: %d\n", pcontext->videoIn->buf.bytesused, pcontext->id);

            /*
             * Workaround for broken, corrupted frames:
             * Under low light conditions corrupted frames may get captured.
             * The good thing is such frames are quite small compared to the regular pictures.
             * For example a VGA (640x480) webcam picture is normally >= 8kByte large,
             * corrupted frames are smaller.
             */
            if (pcontext->videoIn->buf.bytesused < minimum_size) {
                DBG("dropping too small frame, assuming it as broken\n");
                continue;
            }

            if (g_settings.isDynamicSettingsEnabled())
            {
                g_settings.getValueFromFile(CSetting::SETTING_EXPOSURE);
            }
            if(g_settings.isValueChanged(CSetting::SETTING_EXPOSURE))
            {
                setCameraExposure();
            }

#ifdef NO_CV_JUST_STREAM_THE_CAMERA
//.........这里部分代码省略.........
开发者ID:Team4276,项目名称:2016_VisionSystem,代码行数:101,代码来源:input_uvc.cpp


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