1 /*
2 * Copyright (C) 2017 Alberto Irurueta Carro (alberto@irurueta.com)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package com.irurueta.geometry.estimators;
17
18 import com.irurueta.geometry.PinholeCameraIntrinsicParameters;
19 import com.irurueta.geometry.Point2D;
20 import com.irurueta.geometry.Point3D;
21 import com.irurueta.numerical.robust.RobustEstimatorMethod;
22
23 import java.util.List;
24
25 /**
26 * Base abstract class for algorithms to robustly find the best pinhole camera
27 * for collections of matched 3D/2D points using EPnP (Efficient
28 * Perspective-n-Point) algorithm.
29 * Implementations of this class should be able to detect and discard outliers
30 * in order to find the best solution.
31 */
32 @SuppressWarnings("DuplicatedCode")
33 public abstract class EPnPPointCorrespondencePinholeCameraRobustEstimator
34 extends PointCorrespondencePinholeCameraRobustEstimator {
35
36 /**
37 * Intrinsic parameters of camera to be estimated.
38 */
39 protected PinholeCameraIntrinsicParameters intrinsic;
40
41 /**
42 * Indicates whether planar configuration is checked to determine whether
43 * point correspondences are in such configuration and find a specific
44 * solution for such case.
45 */
46 protected boolean planarConfigurationAllowed =
47 EPnPPointCorrespondencePinholeCameraEstimator.DEFAULT_PLANAR_CONFIGURATION_ALLOWED;
48
49 /**
50 * Indicates whether the case where a dimension 2 null-space is allowed.
51 * When allowed, additional constraints are taken into account to ensure
52 * equality of scales so that less point correspondences are required.
53 * Enabling this parameter is usually ok.
54 */
55 protected boolean nullspaceDimension2Allowed =
56 EPnPPointCorrespondencePinholeCameraEstimator.DEFAULT_NULLSPACE_DIMENSION2_ALLOWED;
57
58 /**
59 * Indicates whether the case where a dimension 3 null-space is allowed.
60 * When allowed, additional constraints are taken into account to ensure
61 * equality of scales so that less point correspondences are required.
62 * Enabling this parameter is usually ok although less precise than
63 * when a null-space of dimension 2 is used.
64 */
65 protected boolean nullspaceDimension3Allowed =
66 EPnPPointCorrespondencePinholeCameraEstimator.DEFAULT_NULLSPACE_DIMENSION3_ALLOWED;
67
68 /**
69 * Threshold to determine whether 3D matched points are in a planar
70 * configuration.
71 * Points are considered to be laying in a plane when the smallest singular
72 * value of their covariance matrix has a value much smaller than the
73 * largest one as many times as this value.
74 */
75 protected double planarThreshold = EPnPPointCorrespondencePinholeCameraEstimator.DEFAULT_PLANAR_THRESHOLD;
76
77 /**
78 * Constructor.
79 */
80 protected EPnPPointCorrespondencePinholeCameraRobustEstimator() {
81 super();
82 }
83
84 /**
85 * Constructor with listener.
86 *
87 * @param listener listener to be notified of events such as when estimation
88 * starts, ends or its progress significantly changes.
89 */
90 protected EPnPPointCorrespondencePinholeCameraRobustEstimator(final PinholeCameraRobustEstimatorListener listener) {
91 super(listener);
92 }
93
94 /**
95 * Constructor with lists of points to be used to estimate a pinhole camera.
96 * Points in the lists located at the same position are considered to be
97 * matched. Hence, both lists must have the same size, and their size must
98 * be greater or equal than MIN_NUMBER_OF_POINT_CORRESPONDENCES (6 points).
99 *
100 * @param points3D list of 3D points used to estimate a pinhole camera.
101 * @param points2D list of corresponding projected 2D points used to
102 * estimate a pinhole camera.
103 * @throws IllegalArgumentException if provided lists of points don't have
104 * the same size or their size is smaller than required minimum size (6
105 * correspondences).
106 */
107 protected EPnPPointCorrespondencePinholeCameraRobustEstimator(
108 final List<Point3D> points3D, final List<Point2D> points2D) {
109 super(points3D, points2D);
110 }
111
112 /**
113 * Constructor with listener and lists of points to be used to estimate a
114 * pinhole camera.
115 * Points in the lists located at the same position are considered to be
116 * matched. Hence, both lists must have the same size, and their size must
117 * be greater or equal than MIN_NUMBER_OF_POINT_CORRESPONDENCES (6 points).
118 *
119 * @param listener listener to be notified of events such as when estimation
120 * starts, ends or its progress significantly changes.
121 * @param points3D list of 3D points used to estimate a pinhole camera.
122 * @param points2D list of corresponding projected 2D points used to
123 * estimate a pinhole camera.
124 * @throws IllegalArgumentException if provided lists of points don't have
125 * the same size or their size is smaller than required minimum size (6
126 * correspondences).
127 */
128 protected EPnPPointCorrespondencePinholeCameraRobustEstimator(
129 final PinholeCameraRobustEstimatorListener listener,
130 final List<Point3D> points3D, final List<Point2D> points2D) {
131 super(listener, points3D, points2D);
132 }
133
134 /**
135 * Constructor with intrinsic parameters.
136 *
137 * @param intrinsic intrinsic parameters of camera to be estimated.
138 */
139 protected EPnPPointCorrespondencePinholeCameraRobustEstimator(final PinholeCameraIntrinsicParameters intrinsic) {
140 this();
141 this.intrinsic = intrinsic;
142 }
143
144 /**
145 * Constructor with intrinsic parameters and listener.
146 *
147 * @param listener listener to be notified of events such as when estimation
148 * starts, ends or its progress significantly changes.
149 * @param intrinsic intrinsic parameters of camera to be estimated.
150 */
151 protected EPnPPointCorrespondencePinholeCameraRobustEstimator(
152 final PinholeCameraRobustEstimatorListener listener, final PinholeCameraIntrinsicParameters intrinsic) {
153 this(listener);
154 this.intrinsic = intrinsic;
155 }
156
157 /**
158 * Constructor with lists of points to be used to estimate a pinhole camera
159 * and intrinsic parameters.
160 * Points in the lists located at the same position are considered to be
161 * matched. Hence, both lists must have the same size, and their size must
162 * be greater or equal than MIN_NUMBER_OF_POINT_CORRESPONDENCES (6 points).
163 *
164 * @param intrinsic intrinsic parameters of camera to be estimated.
165 * @param points3D list of 3D points used to estimate a pinhole camera.
166 * @param points2D list of corresponding projected 2D points used to
167 * estimate a pinhole camera.
168 * @throws IllegalArgumentException if provided lists of points don't have
169 * the same size or their size is smaller than required minimum size (6
170 * correspondences).
171 */
172 protected EPnPPointCorrespondencePinholeCameraRobustEstimator(
173 final PinholeCameraIntrinsicParameters intrinsic, final List<Point3D> points3D,
174 final List<Point2D> points2D) {
175 this(points3D, points2D);
176 this.intrinsic = intrinsic;
177 }
178
179 /**
180 * Constructor with listener and lists of points to be used to estimate a
181 * pinhole camera and intrinsic parameters.
182 * Points in the lists located at the same position are considered to be
183 * matched. Hence, both lists must have the same size, and their size must
184 * be greater or equal than MIN_NUMBER_OF_POINT_CORRESPONDENCES (6 points).
185 *
186 * @param listener listener to be notified of events such as when estimation
187 * starts, ends or its progress significantly changes.
188 * @param intrinsic intrinsic parameters of camera to be estimated.
189 * @param points3D list of 3D points used to estimate a pinhole camera.
190 * @param points2D list of corresponding projected 2D points used to
191 * estimate a pinhole camera.
192 * @throws IllegalArgumentException if provided lists of points don't have
193 * the same size or their size is smaller than required minimum size (6
194 * correspondences).
195 */
196 protected EPnPPointCorrespondencePinholeCameraRobustEstimator(
197 final PinholeCameraRobustEstimatorListener listener, final PinholeCameraIntrinsicParameters intrinsic,
198 final List<Point3D> points3D, final List<Point2D> points2D) {
199 this(listener, points3D, points2D);
200 this.intrinsic = intrinsic;
201 }
202
203 /**
204 * Indicates whether planar configuration is checked to determine whether
205 * point correspondences are in such configuration and find a specific
206 * solution for such case.
207 *
208 * @return true to allow specific solutions for planar configurations,
209 * false to always find a solution assuming the general case.
210 */
211 public boolean isPlanarConfigurationAllowed() {
212 return planarConfigurationAllowed;
213 }
214
215 /**
216 * Specifies whether planar configuration is checked to determine whether
217 * point correspondences are in such configuration and find a specific
218 * solution for such case.
219 *
220 * @param planarConfigurationAllowed true to allow specific solutions for
221 * planar configurations, false to always find a solution assuming the
222 * general case.
223 * @throws LockedException if estimator is locked.
224 */
225 public void setPlanarConfigurationAllowed(final boolean planarConfigurationAllowed) throws LockedException {
226 if (isLocked()) {
227 throw new LockedException();
228 }
229 this.planarConfigurationAllowed = planarConfigurationAllowed;
230 }
231
232 /**
233 * Indicates whether the case where a dimension 2 null-space is allowed.
234 * When allowed, additional constraints are taken into account to ensure
235 * equality of scales so that less point correspondences are required.
236 * Enabling this parameter is usually ok.
237 *
238 * @return true to allow 2-dimensional null-space, false otherwise.
239 */
240 public boolean isNullspaceDimension2Allowed() {
241 return nullspaceDimension2Allowed;
242 }
243
244 /**
245 * Specifies whether the case where a dimension 2 null-space is allowed.
246 * When allowed, additional constraints are taken into account to ensure
247 * equality of scales so that less point correspondences are required.
248 * Enabling this parameter is usually ok.
249 *
250 * @param nullspaceDimension2Allowed true to allow 2-dimensional null-space,
251 * false otherwise.
252 * @throws LockedException if estimator is locked.
253 */
254 public void setNullspaceDimension2Allowed(final boolean nullspaceDimension2Allowed) throws LockedException {
255 if (isLocked()) {
256 throw new LockedException();
257 }
258 this.nullspaceDimension2Allowed = nullspaceDimension2Allowed;
259 }
260
261 /**
262 * Indicates whether the case where a dimension 3 null-space is allowed.
263 * When allowed, additional constraints are taken into account to ensure
264 * equality of scales so that less point correspondences are required.
265 * Enabling this parameter is usually ok although less precise than
266 * when a null-space of dimension 2 is used.
267 *
268 * @return true to allow 3-dimensional null-space, false otherwise.
269 */
270 public boolean isNullspaceDimension3Allowed() {
271 return nullspaceDimension3Allowed;
272 }
273
274 /**
275 * Specifies whether the case where a dimension 3 null-space is allowed.
276 * When allowed, additional constraints are taken into account to ensure
277 * equality of scales so that less point correspondences are required.
278 * Enabling this parameter is usually ok although less precise than
279 * when a null-space of dimension 2 is used.
280 *
281 * @param nullspaceDimension3Allowed true to allow 3-dimensional null-space,
282 * false otherwise.
283 * @throws LockedException if estimator is locked.
284 */
285 public void setNullspaceDimension3Allowed(final boolean nullspaceDimension3Allowed) throws LockedException {
286 if (isLocked()) {
287 throw new LockedException();
288 }
289 this.nullspaceDimension3Allowed = nullspaceDimension3Allowed;
290 }
291
292 /**
293 * Gets threshold to determine whether 3D matched points are in a planar
294 * configuration.
295 * Points are considered to be laying in a plane when the smallest singular
296 * value of their covariance matrix has a value much smaller than the
297 * largest one as many times as this value.
298 *
299 * @return threshold to determine whether 3D matched points are in a planar
300 * configuration.
301 */
302 public double getPlanarThreshold() {
303 return planarThreshold;
304 }
305
306 /**
307 * Sets threshold to determine whether 3D matched points are in a planar
308 * configuration.
309 * Points are considered to be laying in a plane when the smallest singular
310 * value of their covariance matrix has a value much smaller than the
311 * largest one as many times as this value.
312 *
313 * @param planarThreshold threshold to determine whether 3D matched points
314 * are in a planar configuration.
315 * @throws IllegalArgumentException if provided threshold is negative.
316 * @throws LockedException if estimator is locked.
317 */
318 public void setPlanarThreshold(final double planarThreshold) throws LockedException {
319 if (isLocked()) {
320 throw new LockedException();
321 }
322 if (planarThreshold < 0.0) {
323 throw new IllegalArgumentException();
324 }
325 this.planarThreshold = planarThreshold;
326 }
327
328 /**
329 * Gets intrinsic parameters of camera to be estimated.
330 *
331 * @return intrinsic parameters of camera to be estimated.
332 */
333 public PinholeCameraIntrinsicParameters getIntrinsic() {
334 return intrinsic;
335 }
336
337 /**
338 * Sets intrinsic parameters of camera to be estimated.
339 *
340 * @param intrinsic intrinsic parameters of camera to be estimated.
341 * @throws LockedException if estimator is locked.
342 */
343 public void setIntrinsic(final PinholeCameraIntrinsicParameters intrinsic) throws LockedException {
344 if (isLocked()) {
345 throw new LockedException();
346 }
347 this.intrinsic = intrinsic;
348 }
349
350 /**
351 * Indicates if estimator is ready to start the pinhole camera estimation.
352 * This is true when input data (i.e. lists of 2D/3D matched points) are
353 * provided and a minimum of MIN_NUMBER_OF_POINT_CORRESPONDENCES are
354 * available.
355 *
356 * @return true if estimator is ready, false otherwise.
357 */
358 @Override
359 public boolean isReady() {
360 return super.isReady() && intrinsic != null;
361 }
362
363 /**
364 * Returns value indicating if each picked subset point correspondences are
365 * normalized to increase the accuracy of the estimation.
366 *
367 * @return true if each picked subset point correspondences are normalized,
368 * false otherwise.
369 */
370 @Override
371 public boolean isNormalizeSubsetPointCorrespondences() {
372 return false;
373 }
374
375 /**
376 * Sets value indicating if each picked subset point correspondences are
377 * normalized to increase the accuracy of the estimation.
378 *
379 * @param normalizeSubsetPointCorrespondences true if each picked subset
380 * point correspondences are normalized, false otherwise.
381 * @throws LockedException if robust estimator is locked because an
382 * estimation is already in progress.
383 */
384 @Override
385 public void setNormalizeSubsetPointCorrespondences(final boolean normalizeSubsetPointCorrespondences)
386 throws LockedException {
387 if (isLocked()) {
388 throw new LockedException();
389 }
390 }
391
392 /**
393 * Creates a pinhole camera robust estimator based on point correspondences
394 * and using provided robust estimator method.
395 *
396 * @param method method of a robust estimator algorithm to estimate the best
397 * pinhole camera.
398 * @return an instance of a pinhole camera robust estimator.
399 */
400 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(final RobustEstimatorMethod method) {
401 return switch (method) {
402 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator();
403 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator();
404 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator();
405 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator();
406 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator();
407 };
408 }
409
410 /**
411 * Creates a pinhole camera robust estimator based on point correspondences
412 * and using provided 2D/3D points and robust estimator method.
413 *
414 * @param points3D list of 3D points used to estimate a pinhole camera.
415 * @param points2D list of corresponding projected 2D points used to
416 * estimate a pinhole camera.
417 * @param method method of a robust estimator algorithm to estimate the best
418 * pinhole camera.
419 * @return an instance of a pinhole camera robust estimator.
420 * @throws IllegalArgumentException if provided lists of points don't have
421 * the same size or their size is smaller than required minimum size (6
422 * correspondences).
423 */
424 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
425 final List<Point3D> points3D, final List<Point2D> points2D, final RobustEstimatorMethod method) {
426 return switch (method) {
427 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(points3D, points2D);
428 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(points3D, points2D);
429 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(points3D, points2D);
430 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(points3D, points2D);
431 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(points3D, points2D);
432 };
433 }
434
435 /**
436 * Creates a pinhole camera robust estimator based on point correspondences
437 * and using provided listener.
438 *
439 * @param listener listener to be notified of events such as when estimation
440 * starts, ends or its progress significantly changes.
441 * @param method method of a robust estimator algorithm to estimate the best
442 * pinhole camera.
443 * @return an instance of a pinhole camera robust estimator.
444 */
445 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
446 final PinholeCameraRobustEstimatorListener listener, final RobustEstimatorMethod method) {
447 return switch (method) {
448 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(listener);
449 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener);
450 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener);
451 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(listener);
452 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener);
453 };
454 }
455
456 /**
457 * Creates a pinhole camera robust estimator based on point correspondences
458 * and using provided listener, 2D/3D points and robust estimator method.
459 *
460 * @param listener listener to be notified of events such as when estimation
461 * starts, ends or its progress significantly changes.
462 * @param points3D list of 3D points used to estimate a pinhole camera.
463 * @param points2D list of corresponding projected 2D points used to
464 * estimate a pinhole camera.
465 * @param method method of a robust estimator algorithm to estimate the best
466 * pinhole camera.
467 * @return an instance of a pinhole camera robust estimator.
468 * @throws IllegalArgumentException if provided lists of points don't have
469 * the same size or their size is smaller than required minimum size (6
470 * correspondences).
471 */
472 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
473 final PinholeCameraRobustEstimatorListener listener, final List<Point3D> points3D,
474 final List<Point2D> points2D, final RobustEstimatorMethod method) {
475 return switch (method) {
476 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, points3D, points2D);
477 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, points3D, points2D);
478 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, points3D, points2D);
479 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(
480 listener, points3D, points2D);
481 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, points3D, points2D);
482 };
483 }
484
485 /**
486 * Creates a pinhole camera robust estimator based on point correspondences
487 * and using provided quality scores and robust estimator method.
488 *
489 * @param qualityScores quality scores corresponding to each pair of matched
490 * points.
491 * @param method method of a robust estimator algorithm to estimate the best
492 * pinhole camera.
493 * @return an instance of a pinhole camera robust estimator.
494 * @throws IllegalArgumentException if provided quality scores length is
495 * smaller than required minimum size (6 samples).
496 */
497 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
498 final double[] qualityScores, final RobustEstimatorMethod method) {
499 return switch (method) {
500 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator();
501 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator();
502 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(qualityScores);
503 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(qualityScores);
504 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator();
505 };
506 }
507
508 /**
509 * Creates a pinhole camera robust estimator based on point correspondences
510 * and using provided 2D/3D points, quality scores and robust estimator
511 * method.
512 *
513 * @param points3D list of 3D points used to estimate a pinhole camera.
514 * @param points2D list of corresponding projected 2D points used to
515 * estimate a pinhole camera.
516 * @param qualityScores quality scores corresponding to each pair of matched
517 * points.
518 * @param method method of a robust estimator algorithm to estimate the best
519 * pinhole camera.
520 * @return an instance of a pinhole camera robust estimator.
521 * @throws IllegalArgumentException if provided lists of points and quality
522 * scores don't have the same size or their size is smaller than required
523 * minimum size (6 correspondences).
524 */
525 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
526 final List<Point3D> points3D, final List<Point2D> points2D, final double[] qualityScores,
527 final RobustEstimatorMethod method) {
528 return switch (method) {
529 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(points3D, points2D);
530 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(points3D, points2D);
531 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(
532 points3D, points2D, qualityScores);
533 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(
534 points3D, points2D, qualityScores);
535 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(points3D, points2D);
536 };
537 }
538
539 /**
540 * Creates a pinhole camera robust estimator based on point correspondences
541 * and using provided listener and quality scores.
542 *
543 * @param listener listener to be notified of events such as when estimation
544 * starts, ends or its progress significantly changes.
545 * @param qualityScores quality scores corresponding to each pair of matched
546 * points.
547 * @param method method of a robust estimator algorithm to estimate the best
548 * pinhole camera.
549 * @return an instance of a pinhole camera robust estimator.
550 * @throws IllegalArgumentException if provided quality scores don't have
551 * the required minimum size (6 correspondences).
552 */
553 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
554 final PinholeCameraRobustEstimatorListener listener, final double[] qualityScores,
555 final RobustEstimatorMethod method) {
556 return switch (method) {
557 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(listener);
558 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener);
559 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, qualityScores);
560 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, qualityScores);
561 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener);
562 };
563 }
564
565 /**
566 * Creates a pinhole camera robust estimator based on point correspondences
567 * and using provided listener, 2D/3D points, quality scores and robust
568 * estimator method.
569 *
570 * @param listener listener to be notified of events such as when estimation
571 * starts, ends or its progress significantly changes.
572 * @param points3D list of 3D points used to estimate a pinhole camera.
573 * @param points2D list of corresponding projected 2D points used to
574 * estimate a pinhole camera.
575 * @param qualityScores quality scores corresponding to each pair of matched
576 * points.
577 * @param method method of a robust estimator algorithm to estimate the best
578 * pinhole camera.
579 * @return an instance of a pinhole camera robust estimator.
580 * @throws IllegalArgumentException if provided lists of points and quality
581 * scores don't have the same size or their size is smaller than required
582 * minimum size (6 correspondences).
583 */
584 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
585 final PinholeCameraRobustEstimatorListener listener, final List<Point3D> points3D,
586 final List<Point2D> points2D, final double[] qualityScores, final RobustEstimatorMethod method) {
587 return switch (method) {
588 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, points3D, points2D);
589 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, points3D, points2D);
590 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(
591 listener, points3D, points2D, qualityScores);
592 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(
593 listener, points3D, points2D, qualityScores);
594 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, points3D, points2D);
595 };
596 }
597
598 /**
599 * Creates a pinhole camera robust estimator based on point correspondences
600 * and using provided robust estimator method.
601 *
602 * @param intrinsic intrinsic parameters of camera to be estimated.
603 * @param method method of a robust estimator algorithm to estimate the best
604 * pinhole camera.
605 * @return an instance of a pinhole camera robust estimator.
606 */
607 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
608 final PinholeCameraIntrinsicParameters intrinsic, final RobustEstimatorMethod method) {
609 return switch (method) {
610 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic);
611 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic);
612 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic);
613 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic);
614 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic);
615 };
616 }
617
618 /**
619 * Creates a pinhole camera robust estimator based on point correspondences
620 * and using provided 2D/3D points and robust estimator method.
621 *
622 * @param intrinsic intrinsic parameters of camera to be estimated.
623 * @param points3D list of 3D points used to estimate a pinhole camera.
624 * @param points2D list of corresponding projected 2D points used to
625 * estimate a pinhole camera.
626 * @param method method of a robust estimator algorithm to estimate the best
627 * pinhole camera.
628 * @return an instance of a pinhole camera robust estimator.
629 * @throws IllegalArgumentException if provided lists of points don't have
630 * the same size or their size is smaller than required minimum size (6
631 * correspondences).
632 */
633 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
634 final PinholeCameraIntrinsicParameters intrinsic, final List<Point3D> points3D,
635 final List<Point2D> points2D, final RobustEstimatorMethod method) {
636 return switch (method) {
637 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic, points3D, points2D);
638 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic, points3D, points2D);
639 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic, points3D, points2D);
640 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(
641 intrinsic, points3D, points2D);
642 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic, points3D, points2D);
643 };
644 }
645
646 /**
647 * Creates a pinhole camera robust estimator based on point correspondences
648 * and using provided listener.
649 *
650 * @param listener listener to be notified of events such as when estimation
651 * starts, ends or its progress significantly changes.
652 * @param intrinsic intrinsic parameters of camera to be estimated.
653 * @param method method of a robust estimator algorithm to estimate the best
654 * pinhole camera.
655 * @return an instance of a pinhole camera robust estimator.
656 */
657 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
658 final PinholeCameraRobustEstimatorListener listener, final PinholeCameraIntrinsicParameters intrinsic,
659 final RobustEstimatorMethod method) {
660 return switch (method) {
661 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, intrinsic);
662 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, intrinsic);
663 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, intrinsic);
664 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, intrinsic);
665 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, intrinsic);
666 };
667 }
668
669 /**
670 * Creates a pinhole camera robust estimator based on point correspondences
671 * and using provided listener, 2D/3D points and robust estimator method.
672 *
673 * @param listener listener to be notified of events such as when estimation
674 * starts, ends or its progress significantly changes.
675 * @param intrinsic intrinsic parameters of camera to be estimated.
676 * @param points3D list of 3D points used to estimate a pinhole camera.
677 * @param points2D list of corresponding projected 2D points used to
678 * estimate a pinhole camera.
679 * @param method method of a robust estimator algorithm to estimate the best
680 * pinhole camera.
681 * @return an instance of a pinhole camera robust estimator.
682 * @throws IllegalArgumentException if provided lists of points don't have
683 * the same size or their size is smaller than required minimum size (6
684 * correspondences).
685 */
686 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
687 final PinholeCameraRobustEstimatorListener listener, final PinholeCameraIntrinsicParameters intrinsic,
688 final List<Point3D> points3D, final List<Point2D> points2D, final RobustEstimatorMethod method) {
689 return switch (method) {
690 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(
691 listener, intrinsic, points3D, points2D);
692 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(
693 listener, intrinsic, points3D, points2D);
694 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(
695 listener, intrinsic, points3D, points2D);
696 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(
697 listener, intrinsic, points3D, points2D);
698 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(
699 listener, intrinsic, points3D, points2D);
700 };
701 }
702
703 /**
704 * Creates a pinhole camera robust estimator based on point correspondences
705 * and using provided quality scores and robust estimator method.
706 *
707 * @param intrinsic intrinsic parameters of camera to be estimated.
708 * @param qualityScores quality scores corresponding to each pair of matched
709 * points.
710 * @param method method of a robust estimator algorithm to estimate the best
711 * pinhole camera.
712 * @return an instance of a pinhole camera robust estimator.
713 * @throws IllegalArgumentException if provided quality scores length is
714 * smaller than required minimum size (6 samples).
715 */
716 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
717 final PinholeCameraIntrinsicParameters intrinsic, final double[] qualityScores,
718 final RobustEstimatorMethod method) {
719 return switch (method) {
720 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic);
721 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic);
722 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic, qualityScores);
723 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic, qualityScores);
724 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic);
725 };
726 }
727
728 /**
729 * Creates a pinhole camera robust estimator based on point correspondences
730 * and using provided 2D/3D points, quality scores and robust estimator
731 * method.
732 *
733 * @param intrinsic intrinsic parameters of camera to be estimated.
734 * @param points3D list of 3D points used to estimate a pinhole camera.
735 * @param points2D list of corresponding projected 2D points used to
736 * estimate a pinhole camera.
737 * @param qualityScores quality scores corresponding to each pair of matched
738 * points.
739 * @param method method of a robust estimator algorithm to estimate the best
740 * pinhole camera.
741 * @return an instance of a pinhole camera robust estimator.
742 * @throws IllegalArgumentException if provided lists of points and quality
743 * scores don't have the same size or their size is smaller than required
744 * minimum size (6 correspondences).
745 */
746 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
747 final PinholeCameraIntrinsicParameters intrinsic, final List<Point3D> points3D,
748 final List<Point2D> points2D, final double[] qualityScores, final RobustEstimatorMethod method) {
749 return switch (method) {
750 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic, points3D, points2D);
751 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic, points3D, points2D);
752 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(
753 intrinsic, points3D, points2D, qualityScores);
754 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(
755 intrinsic, points3D, points2D, qualityScores);
756 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(intrinsic, points3D, points2D);
757 };
758 }
759
760 /**
761 * Creates a pinhole camera robust estimator based on point correspondences
762 * and using provided listener and quality scores.
763 *
764 * @param listener listener to be notified of events such as when estimation
765 * starts, ends or its progress significantly changes.
766 * @param intrinsic intrinsic parameters of camera to be estimated.
767 * @param qualityScores quality scores corresponding to each pair of matched
768 * points.
769 * @param method method of a robust estimator algorithm to estimate the best
770 * pinhole camera.
771 * @return an instance of a pinhole camera robust estimator.
772 * @throws IllegalArgumentException if provided quality scores don't have
773 * the required minimum size (6 correspondences).
774 */
775 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
776 final PinholeCameraRobustEstimatorListener listener, final PinholeCameraIntrinsicParameters intrinsic,
777 final double[] qualityScores, final RobustEstimatorMethod method) {
778 return switch (method) {
779 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, intrinsic);
780 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, intrinsic);
781 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(
782 listener, intrinsic, qualityScores);
783 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(
784 listener, intrinsic, qualityScores);
785 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(listener, intrinsic);
786 };
787 }
788
789 /**
790 * Creates a pinhole camera robust estimator based on point correspondences
791 * and using provided listener, 2D/3D points, quality scores and robust
792 * estimator method.
793 *
794 * @param listener listener to be notified of events such as when estimation
795 * starts, ends or its progress significantly changes.
796 * @param intrinsic intrinsic parameters of camera to be estimated.
797 * @param points3D list of 3D points used to estimate a pinhole camera.
798 * @param points2D list of corresponding projected 2D points used to
799 * estimate a pinhole camera.
800 * @param qualityScores quality scores corresponding to each pair of matched
801 * points.
802 * @param method method of a robust estimator algorithm to estimate the best
803 * pinhole camera.
804 * @return an instance of a pinhole camera robust estimator.
805 * @throws IllegalArgumentException if provided lists of points and quality
806 * scores don't have the same size or their size is smaller than required
807 * minimum size (6 correspondences).
808 */
809 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
810 final PinholeCameraRobustEstimatorListener listener, final PinholeCameraIntrinsicParameters intrinsic,
811 final List<Point3D> points3D, final List<Point2D> points2D, final double[] qualityScores,
812 final RobustEstimatorMethod method) {
813 return switch (method) {
814 case LMEDS -> new LMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(
815 listener, intrinsic, points3D, points2D);
816 case MSAC -> new MSACEPnPPointCorrespondencePinholeCameraRobustEstimator(
817 listener, intrinsic, points3D, points2D);
818 case PROSAC -> new PROSACEPnPPointCorrespondencePinholeCameraRobustEstimator(
819 listener, intrinsic, points3D, points2D, qualityScores);
820 case PROMEDS -> new PROMedSEPnPPointCorrespondencePinholeCameraRobustEstimator(
821 listener, intrinsic, points3D, points2D, qualityScores);
822 default -> new RANSACEPnPPointCorrespondencePinholeCameraRobustEstimator(
823 listener, intrinsic, points3D, points2D);
824 };
825 }
826
827 /**
828 * Creates a pinhole camera robust estimator based on point correspondences
829 * and using default robust estimator method.
830 *
831 * @return an instance of a pinhole camera robust estimator.
832 */
833 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create() {
834 return create(DEFAULT_ROBUST_METHOD);
835 }
836
837 /**
838 * Creates a pinhole camera robust estimator based on point correspondences
839 * and using provided 2D/3D points and default robust estimator method.
840 *
841 * @param points3D list of 3D points used to estimate a pinhole camera.
842 * @param points2D list of corresponding projected 2D points used to
843 * estimate a pinhole camera.
844 * @return an instance of a pinhole camera robust estimator.
845 * @throws IllegalArgumentException if provided lists of points don't have
846 * the same size or their size is smaller than required minimum size
847 * (6 correspondences).
848 */
849 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
850 final List<Point3D> points3D, final List<Point2D> points2D) {
851 return create(points3D, points2D, DEFAULT_ROBUST_METHOD);
852 }
853
854 /**
855 * Creates a pinhole camera robust estimator based on point
856 * correspondences and using provided listener and default robust estimator
857 * method.
858 *
859 * @param listener listener to be notified of events such as when estimation
860 * starts, ends or its progress significantly changes.
861 * @return an instance of a pinhole camera robust estimator.
862 */
863 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
864 final PinholeCameraRobustEstimatorListener listener) {
865 return create(listener, DEFAULT_ROBUST_METHOD);
866 }
867
868 /**
869 * Creates a pinhole camera robust estimator based on point correspondences
870 * and using provided listener, 2D/3D points and default robust estimator
871 * method.
872 *
873 * @param listener listener to be notified of events such as when estimation
874 * starts, ends or its progress significantly changes.
875 * @param points3D list of 3D points used to estimate a pinhole camera.
876 * @param points2D list of corresponding projected 2D points used to
877 * estimate a pinhole camera.
878 * @return an instance of a pinhole camera robust estimator.
879 * @throws IllegalArgumentException if provided lists of points don't have
880 * the same size or their size is smaller than required minimum size
881 * (6 correspondences).
882 */
883 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
884 final PinholeCameraRobustEstimatorListener listener, final List<Point3D> points3D,
885 final List<Point2D> points2D) {
886 return create(listener, points3D, points2D, DEFAULT_ROBUST_METHOD);
887 }
888
889 /**
890 * Creates a pinhole camera robust estimator based on point correspondences
891 * and using provided quality scores and default robust estimator method.
892 *
893 * @param qualityScores quality scores corresponding to each pair of matched
894 * points.
895 * @return an instance of a pinhole camera robust estimator.
896 * @throws IllegalArgumentException if provided quality scores length is
897 * smaller than required minimum size (6 samples).
898 */
899 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(final double[] qualityScores) {
900 return create(qualityScores, DEFAULT_ROBUST_METHOD);
901 }
902
903 /**
904 * Creates a pinhole camera robust estimator based on point correspondences
905 * and using provided 2D/3D points, quality scores and default robust
906 * estimator method.
907 *
908 * @param points3D list of 3D points used to estimate a pinhole camera.
909 * @param points2D list of corresponding projected 2D points used to
910 * estimate a pinhole camera.
911 * @param qualityScores quality scores corresponding to each pair of matched
912 * points.
913 * @return an instance of a pinhole camera robust estimator.
914 * @throws IllegalArgumentException if provided lists of points and quality
915 * scores don't have the same size or their size is smaller than required
916 * minimum size (6 correspondences).
917 */
918 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
919 final List<Point3D> points3D, final List<Point2D> points2D, final double[] qualityScores) {
920 return create(points3D, points2D, qualityScores, DEFAULT_ROBUST_METHOD);
921 }
922
923 /**
924 * Creates a pinhole camera robust estimator based on point
925 * correspondences and using provided listener, quality scores and default
926 * robust estimator method.
927 *
928 * @param listener listener to be notified of events such as when estimation
929 * starts, ends or its progress significantly changes.
930 * @param qualityScores quality scores corresponding to each pair of matched
931 * points.
932 * @return an instance of a pinhole camera robust estimator.
933 * @throws IllegalArgumentException if provided quality scores don't have
934 * the required minimum size (6 correspondences).
935 */
936 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
937 final PinholeCameraRobustEstimatorListener listener, final double[] qualityScores) {
938 return create(listener, qualityScores, DEFAULT_ROBUST_METHOD);
939 }
940
941 /**
942 * Creates a pinhole camera robust estimator based on point correspondences
943 * and using provided listener, 2D/3D points, quality scores and default
944 * robust estimator method.
945 *
946 * @param listener listener to be notified of events such as when estimation
947 * starts, ends or its progress significantly changes.
948 * @param points3D list of 3D points used to estimate a pinhole camera.
949 * @param points2D list of corresponding projected 2D points used to
950 * estimate a pinhole camera.
951 * @param qualityScores quality scores corresponding to each pair of matched
952 * points.
953 * @return an instance of a pinhole camera robust estimator.
954 * @throws IllegalArgumentException if provided lists of points and quality
955 * scores don't have the same size or their size is smaller than required
956 * minimum size (6 correspondences).
957 */
958 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
959 final PinholeCameraRobustEstimatorListener listener, final List<Point3D> points3D,
960 final List<Point2D> points2D, final double[] qualityScores) {
961 return create(listener, points3D, points2D, qualityScores, DEFAULT_ROBUST_METHOD);
962 }
963
964 /**
965 * Creates a pinhole camera robust estimator based on point correspondences
966 * and using default robust estimator method.
967 *
968 * @param intrinsic intrinsic parameters of camera to be estimated.
969 * @return an instance of a pinhole camera robust estimator.
970 */
971 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
972 final PinholeCameraIntrinsicParameters intrinsic) {
973 return create(intrinsic, DEFAULT_ROBUST_METHOD);
974 }
975
976 /**
977 * Creates a pinhole camera robust estimator based on point correspondences
978 * and using provided 2D/3D points and default robust estimator method.
979 *
980 * @param intrinsic intrinsic parameters of camera to be estimated.
981 * @param points3D list of 3D points used to estimate a pinhole camera.
982 * @param points2D list of corresponding projected 2D points used to
983 * estimate a pinhole camera.
984 * @return an instance of a pinhole camera robust estimator.
985 * @throws IllegalArgumentException if provided lists of points don't have
986 * the same size or their size is smaller than required minimum size
987 * (6 correspondences).
988 */
989 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
990 final PinholeCameraIntrinsicParameters intrinsic, final List<Point3D> points3D,
991 final List<Point2D> points2D) {
992 return create(intrinsic, points3D, points2D, DEFAULT_ROBUST_METHOD);
993 }
994
995 /**
996 * Creates a pinhole camera robust estimator based on point
997 * correspondences and using provided listener and default robust estimator
998 * method.
999 *
1000 * @param listener listener to be notified of events such as when estimation
1001 * starts, ends or its progress significantly changes.
1002 * @param intrinsic intrinsic parameters of camera to be estimated.
1003 * @return an instance of a pinhole camera robust estimator.
1004 */
1005 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
1006 final PinholeCameraRobustEstimatorListener listener, final PinholeCameraIntrinsicParameters intrinsic) {
1007 return create(listener, intrinsic, DEFAULT_ROBUST_METHOD);
1008 }
1009
1010 /**
1011 * Creates a pinhole camera robust estimator based on point correspondences
1012 * and using provided listener, 2D/3D points and default robust estimator
1013 * method.
1014 *
1015 * @param listener listener to be notified of events such as when estimation
1016 * starts, ends or its progress significantly changes.
1017 * @param intrinsic intrinsic parameters of camera to be estimated.
1018 * @param points3D list of 3D points used to estimate a pinhole camera.
1019 * @param points2D list of corresponding projected 2D points used to
1020 * estimate a pinhole camera.
1021 * @return an instance of a pinhole camera robust estimator.
1022 * @throws IllegalArgumentException if provided lists of points don't have
1023 * the same size or their size is smaller than required minimum size
1024 * (6 correspondences).
1025 */
1026 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
1027 final PinholeCameraRobustEstimatorListener listener, final PinholeCameraIntrinsicParameters intrinsic,
1028 final List<Point3D> points3D, final List<Point2D> points2D) {
1029 return create(listener, intrinsic, points3D, points2D, DEFAULT_ROBUST_METHOD);
1030 }
1031
1032 /**
1033 * Creates a pinhole camera robust estimator based on point correspondences
1034 * and using provided quality scores and default robust estimator method.
1035 *
1036 * @param intrinsic intrinsic parameters of camera to be estimated.
1037 * @param qualityScores quality scores corresponding to each pair of matched
1038 * points.
1039 * @return an instance of a pinhole camera robust estimator.
1040 * @throws IllegalArgumentException if provided quality scores length is
1041 * smaller than required minimum size (6 samples).
1042 */
1043 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
1044 final PinholeCameraIntrinsicParameters intrinsic, final double[] qualityScores) {
1045 return create(intrinsic, qualityScores, DEFAULT_ROBUST_METHOD);
1046 }
1047
1048 /**
1049 * Creates a pinhole camera robust estimator based on point correspondences
1050 * and using provided 2D/3D points, quality scores and default robust
1051 * estimator method.
1052 *
1053 * @param intrinsic intrinsic parameters of camera to be estimated.
1054 * @param points3D list of 3D points used to estimate a pinhole camera.
1055 * @param points2D list of corresponding projected 2D points used to
1056 * estimate a pinhole camera.
1057 * @param qualityScores quality scores corresponding to each pair of matched
1058 * points.
1059 * @return an instance of a pinhole camera robust estimator.
1060 * @throws IllegalArgumentException if provided lists of points and quality
1061 * scores don't have the same size or their size is smaller than required
1062 * minimum size (6 correspondences).
1063 */
1064 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
1065 final PinholeCameraIntrinsicParameters intrinsic, final List<Point3D> points3D,
1066 final List<Point2D> points2D, final double[] qualityScores) {
1067 return create(intrinsic, points3D, points2D, qualityScores, DEFAULT_ROBUST_METHOD);
1068 }
1069
1070 /**
1071 * Creates a pinhole camera robust estimator based on point
1072 * correspondences and using provided listener, quality scores and default
1073 * robust estimator method.
1074 *
1075 * @param listener listener to be notified of events such as when estimation
1076 * starts, ends or its progress significantly changes.
1077 * @param intrinsic intrinsic parameters of camera to be estimated.
1078 * @param qualityScores quality scores corresponding to each pair of matched
1079 * points.
1080 * @return an instance of a pinhole camera robust estimator.
1081 * @throws IllegalArgumentException if provided quality scores don't have
1082 * the required minimum size (6 correspondences).
1083 */
1084 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
1085 final PinholeCameraRobustEstimatorListener listener, final PinholeCameraIntrinsicParameters intrinsic,
1086 final double[] qualityScores) {
1087 return create(listener, intrinsic, qualityScores, DEFAULT_ROBUST_METHOD);
1088 }
1089
1090 /**
1091 * Creates a pinhole camera robust estimator based on point correspondences
1092 * and using provided listener, 2D/3D points, quality scores and default
1093 * robust estimator method.
1094 *
1095 * @param listener listener to be notified of events such as when estimation
1096 * starts, ends or its progress significantly changes.
1097 * @param intrinsic intrinsic parameters of camera to be estimated.
1098 * @param points3D list of 3D points used to estimate a pinhole camera.
1099 * @param points2D list of corresponding projected 2D points used to
1100 * estimate a pinhole camera.
1101 * @param qualityScores quality scores corresponding to each pair of matched
1102 * points.
1103 * @return an instance of a pinhole camera robust estimator.
1104 * @throws IllegalArgumentException if provided lists of points and quality
1105 * scores don't have the same size or their size is smaller than required
1106 * minimum size (6 correspondences).
1107 */
1108 public static EPnPPointCorrespondencePinholeCameraRobustEstimator create(
1109 final PinholeCameraRobustEstimatorListener listener, final PinholeCameraIntrinsicParameters intrinsic,
1110 final List<Point3D> points3D, final List<Point2D> points2D, final double[] qualityScores) {
1111 return create(listener, intrinsic, points3D, points2D, qualityScores, DEFAULT_ROBUST_METHOD);
1112 }
1113 }