Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // TestNEURALVFX.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include <iostream>
- #include "pose_estimate.h"
- #include <opencv2/opencv.hpp>
- using namespace std;
- using namespace cv;
- struct TransformData {
- public:
- float tX, tY, tZ, rfX, rfY, rfZ, ruX, ruY, ruZ;
- };
- int main()
- {
- std::vector<cv::Point3d> transs;
- std::vector<cv::Point3d> rot_uu;
- std::vector<cv::Point3d> rot_ff;
- int detectRatio = 1;
- int camId;
- bool _ready = false;
- TransformData faces;
- Estimator result;
- cv::Mat im = cv::imread("headPose.jpg");
- int cam_width = im.cols, cam_height = im.rows;
- result.init(cam_width, cam_height, detectRatio, camId);
- double focal_length = im.cols; // Approximate focal length.
- Point2d center = cv::Point2d(im.cols / 2, im.rows / 2);
- // Setup camera
- cv::Mat camera_matrix = (cv::Mat_<double>(3, 3) << focal_length, 0,
- center.x, 0, focal_length, center.y, 0, 0, 1);
- cv::Mat dist_coeffs = cv::Mat::zeros(
- 4, 1, cv::DataType<double>::type); // Assuming no lens distortion
- cout << "Camera Matrix " << endl << camera_matrix << endl;
- // Output rotation and transslation
- cv::Mat rotation_vector; // Rotation in axis-angle form
- cv::Mat transslation_vector;
- std::vector<cv::Point3d> transs;
- std::vector<cv::Point3d> rot_uu;
- std::vector<cv::Point3d> rot_ff;
- _ready = true;
- result.close();
- TransformData outFaces = faces;
- result.detect(outFaces);
- transs.push_back(cv::Point3d((faces.tX, faces.tY, faces.tZ)));
- rot_uu.push_back(cv::Point3d((faces.ruX, faces.ruY, faces.ruZ)));
- rot_ff.push_back(cv::Point3d((faces.rfX, faces.rfY, faces.rfZ)));
- }
- // Run program: Ctrl + F5 or Debug > Start Without Debugging menu
- // Debug program: F5 or Debug > Start Debugging menu
- // Tips for Getting Started:
- // 1. Use the Solution Explorer window to add/manage files
- // 2. Use the Team Explorer window to connect to source control
- // 3. Use the Output window to see build output and other messages
- // 4. Use the Error List window to view errors
- // 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
- // 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
Advertisement
Add Comment
Please, Sign In to add comment