选择图像显示,CString转换为char*
来源:互联网 发布:宿州淘宝招聘信息 编辑:程序博客网 时间:2024/06/06 02:07
CFileDialog dlg(TRUE, _T("*.bmp"), NULL,
OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY,
_T("image files (*.bmp; *.jpg) |*.bmp;*.jpg|All Files (*.*)|*.*||"),NULL);
dlg.m_ofn.lpstrTitle= _T("Open Image");
IplImage *image = NULL; // This is image pointer
if (dlg.DoModal() == IDOK) {
CString path= dlg.GetPathName(); // contain the selected filename
// char* sz=(char*)path.GetBuffer(path.GetLength());
char* sz= new char [path.GetLength()];
strcpy(sz, (LPCTSTR)path);
image= cvLoadImage(sz);
// cvNamedWindow("Reference Image");
// load the image
// cvShowImage("Reference Image", image); // display it
}
// TODO: 在此添加控件通知处理程序代码
// IplImage *image=NULL; //原始图像
// if(image) cvReleaseImage(&image);
// image = cvLoadImage("D:\\demo.jpg",1); //显示图片
OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY,
_T("image files (*.bmp; *.jpg) |*.bmp;*.jpg|All Files (*.*)|*.*||"),NULL);
dlg.m_ofn.lpstrTitle= _T("Open Image");
IplImage *image = NULL; // This is image pointer
if (dlg.DoModal() == IDOK) {
CString path= dlg.GetPathName(); // contain the selected filename
// char* sz=(char*)path.GetBuffer(path.GetLength());
char* sz= new char [path.GetLength()];
strcpy(sz, (LPCTSTR)path);
image= cvLoadImage(sz);
// cvNamedWindow("Reference Image");
// load the image
// cvShowImage("Reference Image", image); // display it
}
// TODO: 在此添加控件通知处理程序代码
// IplImage *image=NULL; //原始图像
// if(image) cvReleaseImage(&image);
// image = cvLoadImage("D:\\demo.jpg",1); //显示图片
DrawPicToHDC(image, IDC_SHOWIMG);
注意:在CString转换为char*时,需要转换字符集为multi-bytes...,如图所示:
0 0
- 选择图像显示,CString转换为char*
- cstring转换为char*
- cstring转换为char*
- cstring转换为char*
- CString转换为char*
- CString转换为char *
- CString转换为char*
- CString转换为char*
- CString转换为char
- CString 转换为char*
- char*转换CString 、CString转换为char *、连接char* 串
- CString转换为const char * 或者CString转换为char*
- CString,string转换为char*
- VS2010 CString转换为char*
- 将CString转换为char*
- CString转换为const char*
- CString 转换为const char *
- MFC CString转换为char*
- 10+个方便,可重复使用的jQuery代码片段
- 一个使用c++在lua中创建自定义数据类型的简易方法
- ASCII 码字符
- ActionScript 3.0宝典教程——添加或者修改属性
- Lookup类型的column在SharePoint2013版本中的小区别
- 选择图像显示,CString转换为char*
- Generate Parentheses
- 真心不知道开发流程如何处理才是最好,记录下“上头条”(和汪峰无关,囧...)活动开发总结
- W5500 EVB 用户手册 V1.01
- 汇总这一年半我所使用过的那些工具
- 单session下的cr块的产生
- 一位高人解答的关于开启“数据漫游”才能上网的解答
- 常用的数据字典视图和包
- rails Router后续