@@ -26,19 +26,31 @@ def _optional_import(module_name: str) -> ModuleType | None:
2626
2727
2828optv_calibration = _optional_import ("optv.calibration" )
29+ optv_correspondences = _optional_import ("optv.correspondences" )
30+ optv_epipolar = _optional_import ("optv.epipolar" )
2931optv_image_processing = _optional_import ("optv.image_processing" )
32+ optv_imgcoord = _optional_import ("optv.imgcoord" )
33+ optv_orientation = _optional_import ("optv.orientation" )
3034optv_parameters = _optional_import ("optv.parameters" )
3135optv_segmentation = _optional_import ("optv.segmentation" )
36+ optv_tracker = _optional_import ("optv.tracker" )
3237optv_tracking_framebuf = _optional_import ("optv.tracking_framebuf" )
38+ optv_transforms = _optional_import ("optv.transforms" )
3339
3440HAS_OPTV = any (
3541 module is not None
3642 for module in (
3743 optv_calibration ,
44+ optv_correspondences ,
45+ optv_epipolar ,
3846 optv_image_processing ,
47+ optv_imgcoord ,
48+ optv_orientation ,
3949 optv_parameters ,
4050 optv_segmentation ,
51+ optv_tracker ,
4152 optv_tracking_framebuf ,
53+ optv_transforms ,
4254 )
4355)
4456
@@ -49,6 +61,38 @@ def _optional_import(module_name: str) -> ModuleType | None:
4961 and hasattr (optv_parameters , "ControlParams" )
5062)
5163
64+ HAS_NATIVE_CORRESPONDENCES = (
65+ optv_correspondences is not None
66+ and hasattr (optv_correspondences , "correspondences" )
67+ and hasattr (optv_correspondences , "single_cam_correspondence" )
68+ and hasattr (optv_correspondences , "MatchedCoords" )
69+ )
70+
71+ HAS_NATIVE_ORIENTATION = (
72+ optv_orientation is not None
73+ and hasattr (optv_orientation , "point_positions" )
74+ and hasattr (optv_orientation , "multi_cam_point_positions" )
75+ and hasattr (optv_orientation , "external_calibration" )
76+ and hasattr (optv_orientation , "full_calibration" )
77+ and hasattr (optv_orientation , "match_detection_to_ref" )
78+ )
79+
80+ HAS_NATIVE_TRANSFORMS = (
81+ optv_transforms is not None
82+ and hasattr (optv_transforms , "convert_arr_pixel_to_metric" )
83+ and hasattr (optv_transforms , "convert_arr_metric_to_pixel" )
84+ )
85+
86+ HAS_NATIVE_IMGCOORD = (
87+ optv_imgcoord is not None
88+ and hasattr (optv_imgcoord , "image_coordinates" )
89+ and hasattr (optv_imgcoord , "flat_image_coordinates" )
90+ )
91+
92+ HAS_NATIVE_TRACKER = optv_tracker is not None and hasattr (optv_tracker , "Tracker" )
93+
94+ HAS_NATIVE_EPIPOLAR = optv_epipolar is not None and hasattr (optv_epipolar , "epipolar_curve" )
95+
5296HAS_NATIVE_SEGMENTATION = (
5397 optv_segmentation is not None
5498 and hasattr (optv_segmentation , "target_recognition" )
@@ -224,15 +268,33 @@ def should_use_native(feature_name: str | None = None) -> bool:
224268 if feature_name in {None , "" , "preprocess_image" }:
225269 return HAS_NATIVE_PREPROCESS
226270
271+ if feature_name == "correspondences" :
272+ return HAS_NATIVE_CORRESPONDENCES
273+
227274 if feature_name == "target_recognition" :
228275 return HAS_NATIVE_SEGMENTATION
229276
277+ if feature_name in {"orientation" , "point_positions" }:
278+ return HAS_NATIVE_ORIENTATION
279+
230280 if feature_name == "calibration" :
231281 return HAS_NATIVE_CALIBRATION
232282
283+ if feature_name == "transforms" :
284+ return HAS_NATIVE_TRANSFORMS
285+
286+ if feature_name == "imgcoord" :
287+ return HAS_NATIVE_IMGCOORD
288+
233289 if feature_name == "targets" :
234290 return HAS_NATIVE_TARGETS
235291
292+ if feature_name == "tracker" :
293+ return HAS_NATIVE_TRACKER
294+
295+ if feature_name == "epipolar" :
296+ return HAS_NATIVE_EPIPOLAR
297+
236298 return HAS_OPTV
237299
238300
0 commit comments