MCPcopy Create free account
hub / github.com/UZ-SLAMLab/ORB_SLAM3 / FindHomography

Method FindHomography

src/TwoViewReconstruction.cc:131–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129 }
130
131 void TwoViewReconstruction::FindHomography(vector<bool> &vbMatchesInliers, float &score, Eigen::Matrix3f &H21)
132 {
133 // Number of putative matches
134 const int N = mvMatches12.size();
135
136 // Normalize coordinates
137 vector<cv::Point2f> vPn1, vPn2;
138 Eigen::Matrix3f T1, T2;
139 Normalize(mvKeys1,vPn1, T1);
140 Normalize(mvKeys2,vPn2, T2);
141 Eigen::Matrix3f T2inv = T2.inverse();
142
143 // Best Results variables
144 score = 0.0;
145 vbMatchesInliers = vector<bool>(N,false);
146
147 // Iteration variables
148 vector<cv::Point2f> vPn1i(8);
149 vector<cv::Point2f> vPn2i(8);
150 Eigen::Matrix3f H21i, H12i;
151 vector<bool> vbCurrentInliers(N,false);
152 float currentScore;
153
154 // Perform all RANSAC iterations and save the solution with highest score
155 for(int it=0; it<mMaxIterations; it++)
156 {
157 // Select a minimum set
158 for(size_t j=0; j<8; j++)
159 {
160 int idx = mvSets[it][j];
161
162 vPn1i[j] = vPn1[mvMatches12[idx].first];
163 vPn2i[j] = vPn2[mvMatches12[idx].second];
164 }
165
166 Eigen::Matrix3f Hn = ComputeH21(vPn1i,vPn2i);
167 H21i = T2inv * Hn * T1;
168 H12i = H21i.inverse();
169
170 currentScore = CheckHomography(H21i, H12i, vbCurrentInliers, mSigma);
171
172 if(currentScore>score)
173 {
174 H21 = H21i;
175 vbMatchesInliers = vbCurrentInliers;
176 score = currentScore;
177 }
178 }
179 }
180
181
182 void TwoViewReconstruction::FindFundamental(vector<bool> &vbMatchesInliers, float &score, Eigen::Matrix3f &F21)

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
inverseMethod · 0.45

Tested by

no test coverage detected