This day saw the progress I achieved in creating a fusion of MFC frame and OpenCV code as well as some settled problems. But it is quite late now cause the time for me to prepare the small thesis of the Micro-computer course is not enough, if I spent further time on writing this today. So I'm gonna display those settled problems here and finish this essay the other day, in the future but soon.

[1]Open files(especially images) in dialog-based  MFC programme by selecting files in a new dialog, which is just like what we use to see in Windows system;

[2]Switch the CString vars to char* or string vars;

[3]Show the image in picture control without stretching it even with scaling considered;

[4]Remove the former image while displaying a new one;

[5]How to deal with the error which appears when we try to open a image without choosing anything;

[6]Cope with the error that .png images can not be opened.

unfinished...2017-10-26 21:26:25

===========================================

updated

===========================================

Firstly, we should choose a starting button in a dialog or in a menu. In this programme, menu is chosen. If you have no idea how to create a new dialog by  clicking the menu, turn to this article:#MFC Programming# Using Dialog To Set A Correlate Menu

Since we have got a dialog and a correlate menu, what we need to do create a system dialog which can implement file-reading and file-saving[1].

To start with, we should add a new class of the dialog but the dialog Delimage in this project has had a class when the dialog-based project is created. Therefore, we just need to add a event handler of the submenu Open:

Now we open the Event Handler Wizard:

Any class in the class view is ok but considering convenience and visibility, we choose CCV_OpenImageDlg followed by editing the code:

(Actually followed by Add and Edit because I have already added one)

Then a message response function OnImageopen() is created. It is time that we started writing the code:

 void CCV_OpenImageDlg::OnImageopen()
{
Invalidate(); //Update the dialog including the picture control
CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_READONLY,
TEXT("支持的图像文件 (*.jpg;*.png;*.gif;*.bmp;...)|*.jpg;*.png;*.gif;*.bmp|专用Tiff图像文件(*.tiff;*.tif)|*.tiff;*.tif|所有文件(*.*)|*.*||"), NULL);
dlg.m_ofn.nFilterIndex = ;
dlg.m_ofn.hwndOwner = m_hWnd;
dlg.m_ofn.lStructSize = sizeof(OPENFILENAME);
dlg.m_ofn.lpstrTitle = TEXT("打开图像文件...\0");
dlg.m_ofn.nMaxFile = MAX_PATH;
if (dlg.DoModal() == IDOK)
{
m_path = dlg.GetPathName();
UpdateData(FALSE);
}
else
return;
//string s_path(m_path.GetBuffer()); //then there should be #include <string.h>
char *s_path;
s_path = m_path.GetBuffer(m_path.GetLength()); //switch CString to Char *
m_StaticPath.SetWindowTextA(m_path); //write the image path to static text control
Mat Mat_image = imread(s_path, );
IplImage image = Mat_image;
DrawPicToHDC(&image, ID_SHOWLEFT);
}

Display of result:

unfinished...2017-10-28 11:39:59

【DIP Learining MFC &OpenCV】 Experience by 20171026的更多相关文章

  1. 【从零学习openCV】IOS7下的人脸检測

    前言: 人脸检測与识别一直是计算机视觉领域一大热门研究方向,并且也从安全监控等工业级的应用扩展到了手机移动端的app,总之随着人脸识别技术获得突破,其应用前景和市场价值都是不可估量的,眼下在学习ope ...

  2. 【从零学习openCV】IOS7根据人脸检测

    前言: 人脸检測与识别一直是计算机视觉领域一大热门研究方向,并且也从安全监控等工业级的应用扩展到了手机移动端的app.总之随着人脸识别技术获得突破,其应用前景和市场价值都是不可估量的,眼下在学习ope ...

  3. 【从零学习openCV】IOS7人脸识别实战

    前言 接着上篇<IOS7下的人脸检測>,我们顺藤摸瓜的学习怎样在IOS7下用openCV的进行人脸识别,实际上非常easy,因为人脸检測部分已经完毕,剩下的无非调用openCV的方法对採集 ...

  4. 【温故知新C/C++/opencv】取址符&||cv::groupRectangles||引用与值传递

    cv::groupRectangles void groupRectangles(vector<Rect>& rectList, int groupThreshold, doubl ...

  5. 【从零学习openCV】opecv操作像素

    1. 存取像素值 在opencv中能够直接对cv::Mat类型的图像调用at函数读取或赋值某个像素,我们用个简单的案例来说明: //在一张图像上增加椒盐噪声,image为输入图像.n为噪点个数 voi ...

  6. 【从零学习openCV】IOS7下的openCV开发起步(Xcode5.1.1&amp;openCV2.49)

    前言: 开发IOS7已经有一月的时间了.近期在准备推研的事,有点想往CV方向发展.于是開始自学openCV. 关注CSDN已经非常久了.也从非常多博主那学到了非常多知识,于是我也从这周开启自己的blo ...

  7. 【OpenCV】边缘检测:Sobel、拉普拉斯算子

    推荐博文,博客.写得很好,给个赞. Reference Link : http://blog.csdn.net/xiaowei_cqu/article/details/7829481 一阶导数法:梯度 ...

  8. 【C# -- OpenCV】Emgu CV 第一个实例

    原文 [C# -- OpenCV]Emgu CV 第一个实例 Emgu CV下载地址 http://sourceforge.net/projects/emgucv/files/ 找最新的下就行了,傻瓜 ...

  9. 【图像算法OpenCV】几何不变矩--Hu矩

    原文地址  http://blog.csdn.NET/daijucug/article/details/7535370 [图像算法OpenCV]几何不变矩--Hu矩 一 原理 几何矩是由Hu(Visu ...

随机推荐

  1. Codesys——限定符的使用方法[来自Codesys的Help]

    Qualifier for actions in SFC In order to configure in which way the actions should be associated to ...

  2. c#用webkit内核支持html5

    [实例简介]经过测试可用 [实例截图] [核心代码] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 using System; ...

  3. java web中路径问题。

    转自:http://blog.csdn.net/liang5630/article/details/38474543 如有侵权,请及时联系本人及时删除 在java web种经常出现 404找不到网页的 ...

  4. ubuntu系统快捷键设置

    1.打开'系统设置' 2.点击键盘 3.选择快捷键,查看和修改对应的快捷键.

  5. E20170628-hm

    forgery   n. 伪造; 伪造罪; 伪造物; 伪造签字; distribute   vt. 分配,散布; 散发,分发; 把…分类; [电] 配电; contribute to(contribu ...

  6. Finding Nemo(搜索)

    http://poj.org/problem?id=2049 题意:有一个迷宫,迷宫中有墙.门和空地.有M道墙,每一道墙用(x,y,d,t)表示,(x,y)表示墙的起始坐标,(d=1,t)表示向上t个 ...

  7. SpringBoot集成Swagger2 以及汉化 快速教程

    (一) Swagger介绍 Swagger 是一款RESTFUL接口的文档在线自动生成+功能测试功能软件 (二)为什么使用Swagger 在现在的开发过程中还有很大一部分公司都是以口口相传的方式来进行 ...

  8. C/C++常用头文件 以及简单应用介绍

    C/C++头文件一览 C #include <assert.h> //设定插入点#include <ctype.h> //字符处理#include <errno.h> ...

  9. MVC系列学习(十七)-过滤器

    本次学习的文件结构如下 1.过滤器的几种表示方式 1.1将过滤器 加到方法上,作用范围为该方法 1.2将过滤器加到当前类上,作用范围为该类的所有方法 1.3添加全局过滤器,作用范围为所有方法 2.Ac ...

  10. Python随笔-字符串

    函数title.lower.upper. ct = "hello WORLD" print(ct.title()) #title 以首字母大写的方式显示每个单词 print(ct. ...