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


C++ image_type::resize方法代码示例

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


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

示例1: RSS_MultiSensor_Fleet_Region

void RSS_MultiSensor_Fleet_Region(const image_type &VLImage, const image_type &IRImage, image_type &result1, image_type &result2, float regions[61])
{
	using namespace rss;
	rss::FleetEdgeDetector detector;
	detector(IRImage, result1);
	// result1 holds the fution image
	RSS_MultiSensor_Wavelet_Fusion(VLImage,IRImage,result1);

	// put the image of result into the Memeory dc
	HDC m_hDC = CreateCompatibleDC(::GetDC(NULL));
	HBITMAP m_hBitmap = CreateCompatibleBitmap(::GetDC(NULL),result1.width(),result1.height());
	HPEN m_hPen = CreatePen(PS_SOLID,1,RGB(255,255,255));
	HBRUSH m_hBrush = (HBRUSH)GetStockObject(NULL_BRUSH);
	SelectObject(m_hDC,m_hBitmap);
	SelectObject(m_hDC,m_hPen);
	SelectObject(m_hDC,m_hBrush);
	SetBkMode(m_hDC,TRANSPARENT);
	SetTextColor(m_hDC,RGB(255,255,255));
	for (int x = 0; x < result1.width(); x ++) {
		for (int y = 0; y < result1.height(); y ++) {
			int gray = rss::pixel_cast<rss::GrayPixel>(result1(x,y));
			COLORREF color = RGB(gray,gray,gray);
			SetPixel(m_hDC,x,y,color);
		}
	}

	ObjectiveRegions r = detector.objective_region();		
	regions[0] = min(20u, static_cast<float>(r.size()));		
	for(size_t i = 0; i < min(20U, r.size()); i++) {
		regions[i*3 + 1] = r[i].center.x();
		regions[i*3 + 2] = r[i].center.y();
		regions[i*3 + 3] = r[i].reliability;
	}
	// fill the background
	result2.resize(result1.size());
	for (int x = 0; x < result2.width(); x ++)
		for (int y =  0; y < result2.height(); y ++)
			result2(x,y) = 0;
	// file the sensitive region
	for (int i = 0; i < min(20U,r.size()); i ++) {
		::Rectangle(m_hDC,r[i].region.left(),r[i].region.top(),r[i].region.right(),r[i].region.bottom());
		int dx = (r[i].region.right() - r[i].region.left()) / 2;
		int dy = (r[i].region.bottom() - r[i].region.top()) / 2;
		char* str = RSS_MultiSensor_Get_String(i+1);
		TextOut(m_hDC,r[i].region.left()+dx,r[i].region.top()+dy,str,strlen(str));
		image_type region;
		region.resize(r[i].region.size());
		for (int x = r[i].region.left(); x < r[i].region.right(); x ++) {
			for (int y = r[i].region.top(); y < r[i].region.bottom(); y ++) {
				region(x-r[i].region.left(),y-r[i].region.top()) = VLImage(x,y);
			}
		}
		RegionGrow<image_type> regionGrow(1.0/5.0,10);
		image_type region_result;
		regionGrow(region,region_result);
		for (int x = r[i].region.left(); x < r[i].region.right(); x ++) {
			for (int y = r[i].region.top(); y < r[i].region.bottom(); y ++) {
				result2(x,y) = region_result(x-r[i].region.left(),y-r[i].region.top());
			}
		}
	}
	//	put the image of Memory dc back to result1
	for (int x = 0; x < VLImage.width(); x ++) {
		for (int y = 0; y < VLImage.height(); y ++) {
			result1(x,y) = rss::pixel_cast<rss::RealPixel>GetRValue(GetPixel(m_hDC,x,y));
		}
	}
	DeleteObject(m_hDC);
	DeleteObject(m_hBitmap);
	DeleteObject(m_hPen);
	DeleteObject(m_hBrush);

}
开发者ID:ch3n2k,项目名称:rss,代码行数:73,代码来源:im_interface.cpp


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