本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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 );
}
示例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);
}
示例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();
}
示例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);
}
示例12: CopyOf
void CvvImage::CopyOf( CvvImage& image, int desired_color )
{
IplImage* img = image.GetImage();
if( img )
{
CopyOf( img, desired_color );
}
}
示例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);
}
示例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);
}
}
示例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 );
}