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


C++ RenderWindow::Capture方法代码示例

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


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

示例1: renderFrame

void renderFrame() {
	//perform HSI converison
	GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
	
	GLuint programID = hsi->programID();
	
	GL_CHECK(glUseProgram(programID));

	DrawQuad(programID);
	GL_CHECK(glUseProgram(0));
	
	
	*frame = window.Capture();
	
	//perform dilation
	GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
	
	programID = dilation->programID();
	
	GL_CHECK(glUseProgram(programID));
	
	DrawQuad(programID);
	GL_CHECK(glUseProgram(0));
	
	*frame = window.Capture();
	dilate = false;
	
	//perform erosion
	GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
	
	programID = erosion->programID();
	
	GL_CHECK(glUseProgram(programID));
	
	DrawQuad(programID);
	GL_CHECK(glUseProgram(0));
	 
	*frame = window.Capture();
	
	Blob* boundaries[BASE_SIZE];
	int nBlob = 0;
	
	memset(boundaries,0,sizeof(boundaries));
	
	sf::Image *labels = new sf::Image(frame->GetWidth(), frame->GetHeight());
	
	LabelRegions(frame, labels, boundaries, &nBlob);
	
	//printf("%d\n", nBlob);
	
	// draw rectangles
	for (int i=1; i<= nBlob; i++){
		// find the points
		BlobPoint ll, ur;
		ll.x = 99999;
		ll.y = 99999;
		ur.x = 0;
		ur.y = 0;
		Blob* blob = boundaries[i];
		BlobPoint* next = blob->points;
		printf("%d\n", blob->numPoints);
		while(next != NULL)
		{
			if(next->x < ll.x) ll.x = next->x;
			if(next->y < ll.y) ll.y = next->y;
			if(next->x > ur.x) ur.x = next->x;
			if(next->y > ur.y) ur.y = next->y;
			next = next->nextPoint;
			
		}
		
		ll.x -= 2;
		ll.y -= 2;
		ur.x += 2;
		ur.y += 2;
		bool fillBlack = false;
		if (!circleTest(blob)) {
			fillBlack = true;
		}
		drawRectangle(frame, ll, ur, sf::Color(0,0,255), fillBlack);
	}
		
	GL_CHECK(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
	
	programID = dead->programID();
	
	GL_CHECK(glUseProgram(programID));
	
	DrawQuad(programID);
	GL_CHECK(glUseProgram(0));
	
	FreeAllRegions(boundaries, nBlob);
}
开发者ID:mly,项目名称:BMW,代码行数:93,代码来源:Main.cpp


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