// Standard Library
#include <iostream>
// OpenCV Header
#include<opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
// Kinect for Windows SDK Header
#include <Kinect.h>
#include<fstream>
using namespace cv;
using namespace std;
vector<Point> src;
int i = 0;
ofstream fout("01.txt");
void writeMatToFile(cv::Mat& m, Point p, const char* filename)
{
//ofstream fout(filename);
if (!fout)
{
cout << "File Not Opened" << endl; return;
}
fout <<p.x<<" "<<p.y<<" "<< m.at<unsigned short>(p.x, p.y) << endl;
fout.close();
}
//点击两下获取部分三维坐标
Point p;
void onMouse(int event, int x, int y, int flags, void *param)
{
Mat *img = reinterpret_cast<Mat*>(param);
if (event == CV_EVENT_LBUTTONDOWN)//左键按下,读取初始坐标,并在图像上该点处划圆
{
i++;//统计点击的次数
Kinect获取深度图,鼠标点击获取该点三维坐标并保存txt
最新推荐文章于 2024-11-29 09:47:00 发布