示例#1
0
Camera Tracker::getPosition(vector<double>& coords) {		
	// TODO: Get order!
	vector<Point2f> image;       // Image coordinates
	for (int i = 0; i < coords.size(); i += 2) {
		image.push_back(Point2f(coords[i], coords[i+1]));
	}

	Mat rvec(3,1,CV_32FC1);
	Mat tvec(3,1,CV_32FC1);
	solvePnP(object,image,cam,noArray(),rvec,tvec,false,CV_P3P);
	//gpu::solvePnPRansac(object,image,cam,,rvec,tvec);

	// Filter rvec, tvec?
	Camera ret = base_camera;
	ret.ApplyRT(rvec, tvec);
	cout << rvec << endl;
	cout << tvec << endl;
	return ret;
}