Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
display_utils.py
1
35
36
from
typing
import
List, Optional
37
38
from
visp.core
import
Display
39
40
VISP_DISPLAY_CLS_MAP = {
41
'x'
:
None
,
42
'opencv'
:
None
,
43
'gtk'
:
None
,
44
'win32'
:
None
,
45
'gdi'
:
None
,
46
}
47
48
try
:
49
from
visp.gui
import
DisplayX
50
VISP_DISPLAY_CLS_MAP[
'x'
] = DisplayX
51
except
ImportError:
52
pass
53
54
try
:
55
from
visp.gui
import
DisplayOpenCV
56
VISP_DISPLAY_CLS_MAP[
'opencv'
] = DisplayOpenCV
57
except
ImportError:
58
pass
59
60
try
:
61
from
visp.gui
import
DisplayGTK
62
VISP_DISPLAY_CLS_MAP[
'gtk'
] = DisplayGTK
63
except
ImportError:
64
pass
65
66
try
:
67
from
visp.gui
import
DisplayWin32
68
VISP_DISPLAY_CLS_MAP[
'win32'
] = DisplayWin32
69
except
ImportError:
70
pass
71
72
try
:
73
from
visp.gui
import
DisplayGDI
74
VISP_DISPLAY_CLS_MAP[
'gdi'
] = DisplayGDI
75
except
ImportError:
76
pass
77
78
VISP_DEFAULT_DISPLAY_PREFERENCE = [
'x'
,
'opencv'
,
'gtk'
,
'win32'
,
'gdi'
]
79
80
81
def
get_display
(preferences: Optional[List[str]] =
None
) -> Optional[Display]:
82
'''
83
Get a new ViSP display instance, dependending on what display driver is available.
84
85
:param preference: An optional list of preferred backends to use.
86
The backends are tested in the order they are specified, and the first match is instanciated.
87
If preference is None, a default list of display is used. This list contains all basic displays.
88
The specified values are case insensitive and may include. See VISP_DEFAULT_DISPLAY_PREFERENCE for the available options
89
90
:return: a new instance of a ViSP display if one of the requested backend has been found, None otherwise
91
'''
92
93
final_prefs: List[str] = preferences
if
preferences
is
not
None
else
VISP_DEFAULT_DISPLAY_PREFERENCE
94
for
preference
in
final_prefs:
95
pref_key = preference.lower()
96
display_opt = VISP_DISPLAY_CLS_MAP.get(pref_key)
97
if
display_opt
is
not
None
:
98
return
display_opt()
99
return
None
visp.python.display_utils.get_display
Optional[Display] get_display(Optional[List[str]] preferences=None)
Definition
display_utils.py:81
modules
python
bindings
visp
python
display_utils.py
Generated by
1.17.0