-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
using push_back to avoid an Seg fault
- Loading branch information
Showing
7 changed files
with
70 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <WebARKitPattern.h> | ||
#include <opencv2/calib3d.hpp> | ||
|
||
void WebARKitPatternTrackingInfo::computePose(const WebARKitPattern& pattern, cv::Mat caMatrix, cv::Mat distCoeffs) | ||
{ | ||
cv::Mat Rvec; | ||
cv::Mat_<float> Tvec; | ||
cv::Mat raux, taux; | ||
|
||
cv::solvePnPRansac(pattern.points3d, points2d, caMatrix, distCoeffs, raux, taux); | ||
raux.convertTo(Rvec, CV_32F); | ||
taux.convertTo(Tvec, CV_32F); | ||
|
||
cv::Mat_<float> rotMat(3, 3); | ||
cv::Rodrigues(Rvec, rotMat); | ||
|
||
cv::hconcat(rotMat, Tvec, pose3d); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#ifndef WEBARKITPATTERN_H | ||
#define WEBARKITPATTERN_H | ||
|
||
#include <opencv2/core/core.hpp> | ||
|
||
struct WebARKitPattern { | ||
cv::Size size; | ||
|
||
//cv::Mat grayImg; | ||
|
||
//std::vector<cv::KeyPoint> keypoints; | ||
//cv::Mat descriptors; | ||
|
||
std::vector<cv::Point2f> points2d; | ||
std::vector<cv::Point3f> points3d; | ||
}; | ||
|
||
/** | ||
* Intermediate pattern tracking info structure | ||
*/ | ||
struct WebARKitPatternTrackingInfo | ||
{ | ||
cv::Mat homography; | ||
std::vector<cv::Point2f> points2d; | ||
cv::Mat pose3d; | ||
|
||
/** | ||
* Compute pattern pose using PnP algorithm | ||
*/ | ||
void computePose(const WebARKitPattern& pattern, cv::Mat caMatrix, cv::Mat distCoeffs); | ||
}; | ||
|
||
#endif // WEBARKITPATTERN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters