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


C++ CDib::DrawLine方法代码示例

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


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

示例1: ColorBoxRecog


//.........这里部分代码省略.........
			CamPoint(2,0) = 940 - gi_pt[i].z;	// 940 mm: Kinect와 World Frame 사이의 거리
			CamPoint(3,0) = 1.0;

			//Staubli 기준 좌표로 변환
			StaubliPoint = M_st * CamPoint;	// Transformation Matrix 곱해줌


			//m_cbWorldPoint[i].x = CamPoint(0,0);
			//m_cbWorldPoint[i].y = CamPoint(1,0);
			//m_cbWorldPoint[i].z = (CamPoint(2,0) < -370 ? -370 : CamPoint(2,0));	// 땅에 부딪히지 않도록 limit 걸어줌
			//m_cbWorldPoint[i].rx = 0.0;
			//m_cbWorldPoint[i].ry = 0.0;
			//m_cbWorldPoint[i].rz = gi_pt[i].rz;

			
			m_cbWorldPoint[i].x = StaubliPoint(0,0);
			m_cbWorldPoint[i].y = StaubliPoint(1,0);
			//m_cbWorldPoint[i].z = (StaubliPoint(2,0) < -305 ? -305 : StaubliPoint(2,0));	// 땅에 부딪히지 않도록 limit 걸어줌
			m_cbWorldPoint[i].z = -305;	// 땅에 부딪히지 않도록 limit 걸어줌
			m_cbWorldPoint[i].rx = 0.0;
			m_cbWorldPoint[i].ry = 0.0;
			m_cbWorldPoint[i].rz = gi_pt[i].rz;
			
			
			// 현재 데이터를 이전 데이터로 저장
			preGiPt[i].x = gi_pt[i].x;
			preGiPt[i].y = gi_pt[i].y;
			preGiPt[i].z = gi_pt[i].z;
			preGiPt[i].rx = gi_pt[i].rx;
			preGiPt[i].ry = gi_pt[i].ry;
			preGiPt[i].rz = gi_pt[i].rz;

			double px = gi_pt[i].x-m_ClipRect.left;
			double py = gi_pt[i].y-m_ClipRect.top;

			//pRed->DrawCross(mpt[i].x, mpt[i].y, val);
			src->DrawCross(px, py, val);	// using local(clip) coordinate


			double rad = gi_pt[i].rz;
			double len = 15;
			src->DrawLine(px-len*cos(rad), py-len*sin(rad), px+len*cos(rad), py+len*sin(rad), RGB(255,100,128));
		}
	}

	


	// Region growing은 버리자...
	//CDib* pDib = pRed->RegionGrowing(mpt[BLUE].x, mpt[BLUE].y);
	//CDib* pDib = src->RegionGrowing(mpt[RED].x, mpt[RED].y, 80);
	
	if(m_flag) {
		int width = kdemat[RED]->Width();
		int height = kdemat[RED]->Height();

		// 파일로 저장
		FILE *f;
		f = fopen("c:\\kde.dat","wb");
		if(f!=NULL) {
					
			for(int j=0; j<height; j++)
			{
				for(int i=0; i<width; i++)
				{
					fprintf(f, "%lf ", kdemat[RED]->GetValue(i,j));
				}
				fprintf(f, "\n");
			}
	
			fclose(f);
		}
	
		m_flag=0;
		AfxMessageBox("kde map is saved");
	}



	////////////////////////////////////////////
	// Copy an image for monitoring
	pTestImage = bDib[GREEN]->CopyCDib();
	//pTestImage = src->GetGrayCDib();



	////////////////////////////////////////////
	//// delete images.... 
	delete pRed;
	delete pGreen;
	delete pBlue;
	delete pYellow;

	for(i=0; i<NUMBOX; i++) {
		delete bDib[i];
		kdemat[i]->releaseKDEMask();
	}

	return src;
}
开发者ID:HoomanLee,项目名称:HT_RTS,代码行数:101,代码来源:VisionTab.cpp

示例2: doingImageProcess


//.........这里部分代码省略.........
					

					break;
					}
				case Calibration:
					{
						CDib* pDib = NULL;
						pDib = GetColorClipImage(m_ClipRect);
						if(pDib) { 
							m_imgProcess.SetDib(pDib->CopyCDib());
						}
						//m_testView.SetDib(pDib->GaussianSmoothing(2));
						delete pDib;
					}
					break;
				case Test:
					{
						CDib* pDib = NULL;
						CDib* pTmp = NULL;
						pDib = GetColorClipImage(m_ClipRect);
						if(pDib) { 
							pTmp = pDib->GlobalBinFixed(m_binThres)->ReverseG()->Opening(3); 	// clip image에 대해서..

							// KDE, image point
							TargetObject obj = CellPhonePartRecog(pTmp);
							
							if(obj.density > 0.6) {

								// Orientation
								double rad = pTmp->GetSobelOrientation();
							
								//center = pTmp->GetMeanCoordinateB(0.0);

								MatrixXd StaubliPoint = MatrixXd::Zero(4,1);
								MatrixXd CamPoint	  = MatrixXd::Zero(4,1);

								// Image -> Camera point 변환
								obj.wz = kinect.getDepthValue(obj.ix, obj.iy);
								CamPoint(0,0) = ((obj.ix - (double)m_GlobalCenter.x)*obj.wz)/K(0,0) + OFFSETX;
								CamPoint(1,0) = -((obj.iy - (double)m_GlobalCenter.y)*obj.wz)/K(1,1) + OFFSETY;
								//CamPoint(2,0) = 940 - obj.wz;	// 940 mm: Kinect와 World Frame 사이의 거리
								CamPoint(3,0) = 1.0;

								// Camera -> Staubli point 변환
								StaubliPoint = M_st * CamPoint;	// Transformation Matrix 곱해줌

			
								obj.rox = StaubliPoint(0,0);
								obj.roy = StaubliPoint(1,0);
								obj.roz = -305;	// 땅에 부딪히지 않도록 limit 걸어줌
								obj.Rz = rad;

								
								// Print & Visualization
								CString str;
								int len = 30;
								//char* CellPhoneParts[] = {"크래들", "플러그", "USB커넥터", "이어폰"};
								const CString CellPhoneParts[] = {"크래들", "플러그", "USB커넥터", "이어폰"};
								str.Format("rox: %.2f, roy: %.2f, roz: %.2f, ori: %.2lf, cnt: %d, Obj Class: %s \n", obj.rox, obj.roy, obj.roz, obj.Rz*RtoD, obj.cnt, CellPhoneParts[obj.ID]);
								SetDlgItemTextA(IDC_COORDTARGETOBJ, str);
								unsigned char val=255;
							
								pDib->DrawCross(obj.cix, obj.ciy, val);
								pDib->DrawLine(obj.cix-len*cos(obj.Rz), obj.ciy-len*sin(obj.Rz), obj.cix+len*cos(obj.Rz), obj.ciy+len*sin(obj.Rz), RGB(255,100,128));
							}
							

							m_imgProcess.SetDib(pDib->CopyCDib());
							m_testView.SetDib(pTmp->CopyCDib());
						}
						delete pDib;
						delete pTmp;
					}
					break;
			}
			
		}
	} else {	// 전체 이미지 모드일땐 그냥 출력만...
		if(pColor)
		{
			CDib* pDib = GetColorImage();
			if(pDib != NULL) m_imgProcess.SetDib(pDib);


			switch(m_visionMode) 
			{
				case Test:{
					//CDib* pDib = GetColorImage();
					//m_testView.SetDib(pDib->GaussianSmoothing(3));
					//delete pDib;
					break;
						  }
				default: {
					
						 }

			}
		}
	}
}
开发者ID:HoomanLee,项目名称:HT_RTS,代码行数:101,代码来源:VisionTab.cpp


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