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


C++ CvvImage类代码示例

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


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

示例1: resize

void DIANMING::draw_Image(CDC* pDC, HDC hDC, Mat img, CRect rect)
{
	int rw = rect.right - rect.left;// 求出图片控件的宽和高
	int rh = rect.bottom - rect.top;

	int iw = img.size().width;// 读取图片的宽和高
	int ih = img.size().height;
	if (rw > iw && rh > ih)
	{

	}
	else
	{
		CvSize size;
		size.height = rh;
		size.width = rw;
		resize(img, img, size);
		iw = rw;
		ih = rh;
	}
	int tx = (int)(rw - iw) / 2;// 使图片的显示位置正好在控件的正中
	int ty = (int)(rh - ih) / 2;

	SetRect(rect, tx, ty, tx + iw, ty + ih);
	CvvImage cimg;
	IplImage img1 = img;
	cimg.CopyOf(&img1);
	cimg.DrawToHDC(hDC, &rect);


}
开发者ID:zengzhishi,项目名称:face_recognition,代码行数:31,代码来源:DIANMING.cpp

示例2: RGB

void MyTestDialog::DrawPicToHDC(cv::Mat& img, UINT ID)
{
	//清空
	CStatic* pStatic = (CStatic*)GetDlgItem(ID);
	pStatic->SetBitmap(NULL);
	CRect rect;
	pStatic->GetClientRect(&rect);
	pStatic->GetDC()->FillSolidRect(rect.left ,rect.top ,rect.Width(),rect.Height(), RGB(240, 240, 240));
	////

	CDC* pDC = GetDlgItem(ID)->GetDC();
	HDC hDC = pDC->GetSafeHdc();

	//调整大小
	////////
	float widthRatio = (float)rect.Width() / img.cols;
	float heightRatio = (float)rect.Height() / img.rows;
	float resRatio = widthRatio < heightRatio ? widthRatio: heightRatio;
	int resWidth = img.cols * resRatio;
	int resHeight = img.rows * resRatio;
	cv::resize(img, img, cv::Size(resWidth, resHeight));
	CRect drawRect;
	drawRect.SetRect(rect.TopLeft().x, rect.TopLeft().y, rect.TopLeft().x + img.cols - 1, rect.TopLeft().y + img.rows - 1);
	///////
	IplImage* tmpimg = &img.operator IplImage();
	CvvImage iimg;
	iimg.CopyOf(tmpimg);
	iimg.DrawToHDC(hDC, &drawRect);
	ReleaseDC(pDC);
	iimg.Destroy();
}
开发者ID:SenitCo,项目名称:mfc_opencv_demo,代码行数:31,代码来源:MyTestDialog.cpp

示例3: tDlg

void CRenderCenterDlg::OnBnClickedInputmuban()
{
	// TODO: 在此添加控件通知处理程序代码
	string tstring;
	CString tFileName;
	CFileDialog tDlg(TRUE);
	if(tDlg.DoModal()==IDOK)
	{
		tFileName=tDlg.GetPathName();
		tstring=wstring2string(tFileName.GetBuffer(0));
	}
	imgtarget=imread(tstring,1);
	if(!imgtarget.data)
	{
		MessageBox(TEXT("error"),TEXT("no image loaded!"),MB_OK);
		return;
	}
	CWnd *pWnd=GetDlgItem(IDC_MUBAN);
	CDC *pDC=pWnd->GetDC();
	HDC hDC=pDC->GetSafeHdc();
	IplImage img=imgtarget;
	CvvImage cimg;
	cimg.CopyOf(&img);
	CRect rect;
	GetDlgItem(IDC_MUBAN)->GetClientRect(&rect);
	cimg.DrawToHDC(hDC,&rect);
}
开发者ID:gordongithub,项目名称:RadarSim,代码行数:27,代码来源:RenderCenterDlg+-+副本.cpp

示例4: cvCreateImage

void CAntimonyDlg::showImage(IplImage *image, UINT ID)    // ID 是Picture Control控件的ID号
{
	CvSize ImgSize;
	IplImage *theimg;
	ImgSize.width = picrect.Width();
	ImgSize.height = picrect.Height();
	theimg = cvCreateImage(ImgSize, IPL_DEPTH_8U, 3);
	IplImage *image2 = image;
	resize_image(image2, theimg);

	CDC *pDC = GetDlgItem(ID)->GetDC();
	HDC hDC = pDC->GetSafeHdc();

	int rw = picrect.right - picrect.left;
	int rh = picrect.bottom - picrect.top;
	int iw = theimg->width;
	int ih = theimg->height;
	int tx = (int)(rw - iw) / 2;
	int ty = (int)(rh - ih) / 2;
	SetRect(picrect, tx, ty, tx + iw, ty + ih);
	CvvImage cimg;
	cimg.CopyOf(theimg); // 复制图片
	cimg.DrawToHDC(hDC, &picrect); // 将图片绘制到显示控件的指定区域内
	ReleaseDC(pDC);
}
开发者ID:Spritutu,项目名称:MonitorSYS,代码行数:25,代码来源:AntimonyDlg.cpp

示例5: MessageBox

void CRenderCenterDlg::OnBnClickedRate()
{
	// TODO: 在此添加控件通知处理程序代码
	if(img1.size()!=img2.size())
	{
		MessageBox(TEXT("Two images are not the same size!"),TEXT("error"),MB_OK);
		return;
	}
	RateBlending lp;
	Mat_<Vec3f> l; img1.convertTo(l,CV_32F,1.0/255.0);//Vec3f表示有三个通道,即 l[row][column][depth]  
	Mat_<Vec3f> r; img2.convertTo(r,CV_32F,1.0/255.0);
	Mat_<float> m(l.rows,l.cols,0.0);
	m(Range::all(),Range(0,m.cols/2)) = 1.0; 
	Mat_<Vec3f> blend =lp.RateBlend(l, r, m);
	blend.convertTo(imgfusion,CV_8UC3,255);

	CWnd *pWnd=GetDlgItem(IDC_IMGFUSION);
	CDC *pDC=pWnd->GetDC();
	HDC hDC=pDC->GetSafeHdc();
	IplImage img=imgfusion;
	CvvImage cimg;
	cimg.CopyOf(&img);
	CRect rect;
	GetDlgItem(IDC_IMGFUSION)->GetClientRect(&rect);
	cimg.DrawToHDC(hDC,&rect);
}
开发者ID:gordongithub,项目名称:RadarSim,代码行数:26,代码来源:RenderCenterDlg+-+副本.cpp

示例6: GetDlgItem

void CMFCCapView::DrawPicToHDC(IplImage *img, UINT ID)
{
	CDC *pDC = GetDlgItem(ID)->GetDC();
	HDC hDC= pDC->GetSafeHdc(); 
	CRect rect;
	GetDlgItem(ID)->GetClientRect(&rect);
	CvvImage cimg;
	cimg.CopyOf(img);
	cimg.DrawToHDC(hDC,&rect);
	ReleaseDC(pDC);
} 
开发者ID:nash635,项目名称:Ab-CvCap,代码行数:11,代码来源:MFCCapView.cpp

示例7: GetDlgItem

void MFC_SelectCartoonDlg::DrawPicToHDC(IplImage *img, UINT ID)
{
	CDC *pDC = GetDlgItem(ID)->GetDC();
	HDC hDC= pDC->GetSafeHdc();
	CRect rect;
	GetDlgItem(ID)->GetClientRect(&rect);
	CvvImage cimg;
	cimg.CopyOf( img ); // 复制图片
	cimg.DrawToHDC( hDC, &rect ); // 将图片绘制到显示控件的指定区域内
	ReleaseDC( pDC );
}
开发者ID:underspirit,项目名称:VideoCartoon_MFC,代码行数:11,代码来源:MFC_SelectCartoonDlg.cpp

示例8: GetDlgItem

// CustomDialog 消息处理程序
void CustomDialog::DrawPicToHDC(IplImage *img, UINT ID)
{
	CDC *pDC =	GetDlgItem(ID)->GetDC();
	HDC hDC= pDC->GetSafeHdc();
	CRect rect;
	GetDlgItem(ID)->GetClientRect(&rect);
	CvvImage cimg;
	cimg.CopyOf(img); // 复制图片
	cimg.DrawToHDC(hDC, &rect); // 将图片绘制到显示控件的指定区域内
	cimg.Destroy();
	ReleaseDC(pDC);
}
开发者ID:zjhsdtc,项目名称:eyetracking,代码行数:13,代码来源:CustomDialog.cpp

示例9: _ttoi

//set default contrast value 2.2
void CBrightDlg::OnBnClickedButton1()
{
	int alpha = _ttoi(m_SliderValue);// transfer cstring to int
	Mat temp = autoBrightContrast(m_mat, 2.2, alpha);
	IplImage img = temp;
	CvvImage cimg;
	cimg.CopyOf(&img);

	CPrevDlg dlg;
	dlg.m_image = cimg;
	dlg.DoModal();
	waitKey(0);
	CDialogEx::OnOK();
}
开发者ID:Shanshan-IC,项目名称:MscProject,代码行数:15,代码来源:BrightDlg.cpp

示例10: GetDlgItem

void CHandGestureRecognitionSystemDlg::PlayImage(Mat& image, int ID, CRect& rect)
{
    // get HDC
    CDC* pDC = GetDlgItem(ID)->GetDC(); // 获得显示控件的 DC
    HDC hDC = pDC ->GetSafeHdc();       // 获取HDC(设备句柄)进行绘图操作
    // MAT TO IplImage
    IplImage img = IplImage(image);
    // IplImage TO CvvImage
    CvvImage cimg;
    cimg.CopyOf(&img);                  // 复制图片
    cimg.DrawToHDC(hDC, &rect);         // 将图片绘制到显示控件的指定区域
    // release CDC
    ReleaseDC(pDC);
}
开发者ID:chenxilinsidney,项目名称:HandGestureRecognitionSystem,代码行数:14,代码来源:HandGestureRecognitionSystemDlg.cpp

示例11: image

void CSpotsMainDlg::DrawPicToHDC(cv::Mat& img, UINT ID)
{
	IplImage image(img); //原始图像
	//if (hDC == NULL)
	{
		p_DC = GetDlgItem(ID)->GetDC();
		hDC = p_DC->GetSafeHdc();
	}
	CRect rect;
	GetDlgItem(ID)->GetClientRect(&rect);
	CvvImage cimg;
	cimg.CopyOf(&image); // 复制图片
	cimg.DrawToHDC(hDC, &rect); // 将图片绘制到显示控件的指定区域内
	ReleaseDC(p_DC);
}
开发者ID:vshawn,项目名称:cameraTest,代码行数:15,代码来源:SpotsMainDlg.cpp

示例12: CopyOf

void  CvvImage::CopyOf( CvvImage& image, int desired_color )
{
   IplImage* img = image.GetImage();
   if( img )
   {
      CopyOf( img, desired_color );
   }
}
开发者ID:yuzhuqingyun,项目名称:face_log,代码行数:8,代码来源:CvvImage.cpp

示例13: GetDlgItem

void CCharTrainDlg::DrawPicToHDC(IplImage* img, UINT ID)
{
	CDC *pDC = GetDlgItem(ID)->GetDC();
	HDC hDC = pDC->GetSafeHdc();
	CRect rect;
	GetDlgItem(ID)->GetClientRect(&rect);

	if (img!=NULL)
	{
		CvvImage cimg;

	cimg.CopyOf(img,3);
	cimg.DrawToHDC(hDC,&rect);

	}
	ReleaseDC(pDC);
}
开发者ID:songshine,项目名称:LicensePlateRecognition,代码行数:17,代码来源:CharTrainDlg.cpp

示例14: GetClientRect

//---------------------------------------------------------------------
void ExtPicture::Draw(CDC *pDC)
{
	CRect myrect;
	GetClientRect(&myrect);	//取得客户区尺寸
	if(m_img.data==NULL)
	{
		pDC->Rectangle(&myrect);
		return;
	}

	else 
	{
		IplImage* img=&(IplImage)(m_img);		//将图像转换为IplImage格式,共用同一个内存(浅拷贝)
		CvvImage iimg;								//创建一个CvvImage对象
		iimg.CopyOf(img);

		HDC hDC=pDC->GetSafeHdc();	
		iimg.DrawToHDC(hDC,&myrect);
	}
}
开发者ID:Strongc,项目名称:Mobis,代码行数:21,代码来源:ExtPicture.cpp

示例15: showImage

void LeoPicture_For_AddModel::Draw(CDC *pDC)
{
	if (m_img.empty())
		return;

	cv::Mat showMat=m_img.clone();
	//for (int i = 0; i < ptr_models.size(); i++)
	//{
	//	//int a = ptr_models[i]->m_region.width;
	//	//int b = RectRoi.width;



	//	cv::putText(showMat,ptr_models[i]->m_Describe,cv::Point(ptr_models[i]->m_region.x,ptr_models[i]->m_region.y),CV_FONT_HERSHEY_SIMPLEX,1.5,Scalar(0,0,255));
	//	cv::rectangle(showMat,ptr_models[i]->m_region,cv::Scalar(0,0,255),1);
	//	if(ptr_models[i]->getSmallRegion().area()>0)
	//	{
	//		cv::rectangle(showMat,ptr_models[i]->getSmallRegion(),cv::Scalar(0,255,255),1);
	//	}
	//}


	cv::Mat showImage(showMat,RectRoi);

	CRect myrect;
	GetClientRect(&myrect);	//取得客户区尺寸

	IplImage* img=&(IplImage)showImage;		//将图像转换为IplImage格式,共用同一个内存(浅拷贝)
	CvvImage iimg;								//创建一个CvvImage对象
	iimg.CopyOf(img);

	HDC hDC=pDC->GetSafeHdc();	
	iimg.DrawToHDC(hDC,&myrect);
	

	if(m_RectTracker!=NULL)
		m_RectTracker->Draw(pDC);

	//ReleaseDC( pDC );
}
开发者ID:Strongc,项目名称:Mobis,代码行数:40,代码来源:LeoPicture_For_AddModel.cpp


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