Skip to content

Commit

Permalink
The issue arise the wrong camera matrix data
Browse files Browse the repository at this point in the history
  • Loading branch information
kalwalt committed Nov 4, 2023
1 parent d383ac9 commit 40017fc
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class WebARKitTracker::WebARKitTrackerImpl {
WebARKitTrackerImpl()
: corners(4), initialized(false), output(17, 0.0), _valid(false), _isDetected(false), numMatches(0),
minNumMatches(MIN_NUM_MATCHES), _nn_match_ratio(0.7f) {
m_camMatrix = cv::Mat();
m_camMatrix = cv::Mat(3,3, cv::DataType<double>::type);
//m_distortionCoeff = cv::Mat();
//_patternTrackingInfo.pose3d = cv::Mat::zeros(3, 4, CV_64FC1);
//m_distortionCoeff = cv::Mat::zeros(6, 1, CV_64FC1);
Expand All @@ -30,7 +30,7 @@ class WebARKitTracker::WebARKitTrackerImpl {
}
_camera->setupCamera(frameWidth, frameHeight);
_camera->printSettings();
m_camMatrix = cv::Mat(3, 3, CV_64FC1, _camera->getCameraData().data());
//m_camMatrix = cv::Mat(3, 3, CV_64FC1, _camera->getCameraData().data());
/*m_camMatrix = cv::Mat(3, 3, CV_64FC1);
std::array<double, 9> camData = _camera->getCameraData();
for(auto i = 0; i < 3; i++) {
Expand All @@ -40,6 +40,17 @@ class WebARKitTracker::WebARKitTrackerImpl {
}
}*/

m_camMatrix.at<double>(0,0) = 833.63;
m_camMatrix.at<double>(0,1) = 0.0;
m_camMatrix.at<double>(0,2) = 353.50;
m_camMatrix.at<double>(1,0) = 0.0;
m_camMatrix.at<double>(1,1) = 833.63;
m_camMatrix.at<double>(1,2) = 464.50;
m_camMatrix.at<double>(2,0) = 0.0;
m_camMatrix.at<double>(2,1) = 0.0;
m_camMatrix.at<double>(2,2) = 1.0;


for(auto i = 0; i < 3; i++) {
for(auto j = 0; j < 3; j++) {
WEBARKIT_LOGi("Camera Matrix: %.2f\n", m_camMatrix.at<double>(i, j));
Expand Down

0 comments on commit 40017fc

Please sign in to comment.