| 1072 | } |
| 1073 | |
| 1074 | bool KeyFrame::ProjectPointUnDistort(MapPoint* pMP, cv::Point2f &kp, float &u, float &v) |
| 1075 | { |
| 1076 | |
| 1077 | // 3D in absolute coordinates |
| 1078 | Eigen::Vector3f P = pMP->GetWorldPos(); |
| 1079 | |
| 1080 | // 3D in camera coordinates |
| 1081 | Eigen::Vector3f Pc = mRcw * P + mTcw.translation(); |
| 1082 | float &PcX = Pc(0); |
| 1083 | float &PcY= Pc(1); |
| 1084 | float &PcZ = Pc(2); |
| 1085 | |
| 1086 | // Check positive depth |
| 1087 | if(PcZ<0.0f) |
| 1088 | { |
| 1089 | cout << "Negative depth: " << PcZ << endl; |
| 1090 | return false; |
| 1091 | } |
| 1092 | |
| 1093 | // Project in image and check it is not outside |
| 1094 | const float invz = 1.0f/PcZ; |
| 1095 | u = fx * PcX * invz + cx; |
| 1096 | v = fy * PcY * invz + cy; |
| 1097 | |
| 1098 | if(u<mnMinX || u>mnMaxX) |
| 1099 | return false; |
| 1100 | if(v<mnMinY || v>mnMaxY) |
| 1101 | return false; |
| 1102 | |
| 1103 | kp = cv::Point2f(u, v); |
| 1104 | |
| 1105 | return true; |
| 1106 | } |
| 1107 | |
| 1108 | Sophus::SE3f KeyFrame::GetRelativePoseTrl() |
| 1109 | { |
nothing calls this directly
no test coverage detected