opencv中在屏幕上每隔几秒显示一个点,并且保存点的坐标
2015-10-12 09:02
507 查看
<span style="font-size:18px;">#include<Windows.h> #include<opencv2/imgproc/imgproc.hpp> #include<opencv2/highgui/highgui.hpp> #include<opencv2/objdetect/objdetect.hpp> #include<vector> #include<fstream> #include<iostream> #include<string> using namespace std; using namespace cv; int main() { const Size sizepx(900, 900); Mat screen(sizepx.width, sizepx.height, CV_32FC3); screen.setTo(Scalar(255, 0, 0)); string filename = "E:data1.txt"; ofstream outFile(filename.c_str(), ios::app); //在文件末尾写入 vector<Point> vectorp; for (int i = 150; i < sizepx.height; i += 300) { for (int j = 150; j < sizepx.width; j += 300) { Point p = Point(i, j); circle(screen, p, 8, Scalar(0, 255, 0), -1); imshow("屏幕", screen); waitKey(3000); screen.setTo(Scalar(255, 0, 0)); vectorp.push_back(p); cout << p.x << ' ' << p.y << endl; } } for (int i = 0; i<vectorp.size(); i++) { outFile << vectorp[i].x << ' ' << vectorp[i].y; //每列数据用 tab 隔开 outFile << endl; } /*waitKey(0);*/ return 0; }</span>
相关文章推荐
- ACdream 1216——Beautiful People——————【二维LIS,nlogn处理】
- linux根目录下各文件夹的作用
- 硬件文章远程视频监控
- 虚拟机linux系统不能识别USB及其解决办法
- 25个你会喜欢的创新的水平滚动网站设计欣赏
- Linux&nbsp;shell&nbsp;很坑的空格
- Windows Hadoop 2.6.0编译安装
- gooreplacer&nbsp;解决国外网站加…
- windows&nbsp;安装linux之后进入wi…
- Linux性能分析工具——top
- Linux&nbsp;离线安装&nbsp;gcc&nbsp;g++
- Linux性能分析工具&mdash;&mdash;mpstat
- Linux&nbsp;下好用的QQ
- Linux&nbsp;sh执行多行命令
- linux&nbsp;下&nbsp;.sh&nbsp;文件语法
- Linux&nbsp;中断sh文件无法关闭mon…
- CentOS7&nbsp;安装fcitx&nbsp;搜狗输入法
- Linux&nbsp;bash暂停
- Dynamic Partial Reconfiguration 4 ZyCAP--an open source controller
- 【linux】自己常用命令总结