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


C++ CImage::get_unsafe方法代码示例

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


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

示例1: if


//.........这里部分代码省略.........
			// convert to TKeyPointList (opencv compatible)
			m_convert_featureList_to_keypointList( img_data.pyr_feats[octave], feats_vector );

			m_profiler.leave(sProfileName.c_str()); // end detect
		}
		else
			THROW_EXCEPTION("	[sVO -- Stg2: Detect] ERROR: Unknown detection method")

		// ***********************************
		// Non-maximal suppression
		// ***********************************
		if( params_detect.non_maximal_suppression )
		{
			if( params_detect.nmsMethod == TDetectParams::nmsmStandard )
			{
				const size_t imgH = input_im.rows;
				const size_t imgW = input_im.cols;
				vector<bool> dummy;
				m_non_max_sup( 
					kps_to_detect[octave], // params_detect.orb_nfeats
					feats_vector, 
					desc_aux, 
					img_data.pyr_feats_kps[octave], 
					img_data.pyr_feats_desc[octave], 
					imgH, imgW,
					dummy );
			}
			else if( params_detect.nmsMethod == TDetectParams::nmsmAdaptive )
			{
				m_adaptive_non_max_sup( 
					kps_to_detect[octave], // params_detect.orb_nfeats*/
					feats_vector, 
					desc_aux, 
					img_data.pyr_feats_kps[octave], 
					img_data.pyr_feats_desc[octave] );
			}
			else
				THROW_EXCEPTION("	[sVO -- Stg2: Detect] Invalid non-maximal-suppression method." );
		} // end-if-non-max-sup
		else
		{
			feats_vector.swap(img_data.pyr_feats_kps[octave]);
			img_data.pyr_feats_desc[octave] = desc_aux;					// this should be fast (just copy the header)
		}

		// update indexes here
		m_update_indexes( img_data, octave, true );

        // gui info
		m_next_gui_info->stats_feats_per_octave[octave] = 
			nFeatsPassingKLTPerOctave[octave] = img_data.pyr_feats_kps[octave].size();

	 } // end-for-octaves

	if( params_gui.show_gui && params_gui.draw_all_raw_feats )
	{
		// (It's almost as efficient to directly draw these small feature marks at this point
		// rather than send all the info to the gui thread and then draw there. A quick test shows
		// a gain of 75us -> 50us only, so don't optimize unless efficiency pushes really hard).
		m_profiler.enter("stg2.draw_feats");

        for (size_t octave=0;octave<nOctaves;octave++)
        {
			const TKeyPointList & f1 = img_data.pyr_feats_kps[octave];
            const size_t n1 = f1.size();

            const bool org_img_color	= gui_image.isColor();
            unsigned char* ptr1			= gui_image.get_unsafe(0,0);
            const size_t img1_stride	= gui_image.getRowStride();
            for(size_t i=0;i<n1;++i)
            {
                const int x=f1[i].pt.x; const int y=f1[i].pt.y;
                unsigned char* ptr = ptr1 + img1_stride*y + (org_img_color ? 3*x:x);
                if (org_img_color) {
                    *ptr++ = 0x00;
                    *ptr++ = 0x00;
                    *ptr++ = 0xFF;
                }
                else {
                    *ptr = 0xFF;
                }
            } // end-for
        } // end-for

		m_profiler.leave("stg2.draw_feats");
	} // end-if

    // for the GUI thread
    string sPassKLT = "", sDetect = "";
    for( size_t i=0;i<nOctaves;i++ )
	{
        sPassKLT += mrpt::format( "%u/",static_cast<unsigned int>(nFeatsPassingKLTPerOctave[i]) );
        sDetect  += mrpt::format( "%u/",static_cast<unsigned int>(img_data.pyr_feats_kps[i].size()) );
	}

    string aux = mrpt::format( "\n%s feats (%s passed KLT)", sDetect.c_str(), sPassKLT.c_str() );
    m_next_gui_info->text_msg_from_detect += aux;

	m_profiler.leave("_stg2");
}
开发者ID:caomw,项目名称:stereo-vo,代码行数:101,代码来源:stage2_detect.cpp


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