mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
Add support for enums into rst ocv domain
This commit is contained in:
parent
ff7b604a25
commit
2fe7482b73
56
doc/ocv.py
56
doc/ocv.py
@ -1080,6 +1080,17 @@ class DefinitionParser(object):
|
||||
value = None
|
||||
return MemberObjDefExpr(name, visibility, static, typename, value)
|
||||
|
||||
def parse_enum_member_object(self):
|
||||
visibility, static = self._parse_visibility_static()
|
||||
typename = None
|
||||
name = self._parse_type()
|
||||
self.skip_ws()
|
||||
if self.skip_string('='):
|
||||
value = self.read_rest().strip()
|
||||
else:
|
||||
value = None
|
||||
return MemberObjDefExpr(name, visibility, static, typename, value)
|
||||
|
||||
def parse_function(self):
|
||||
visibility, static = self._parse_visibility_static()
|
||||
if self.skip_word('explicit'):
|
||||
@ -1185,6 +1196,8 @@ class OCVObject(ObjectDescription):
|
||||
def add_target_and_index(self, sigobj, sig, signode):
|
||||
theid = sig#obj.get_id()
|
||||
theid = re.sub(r" +", " ", theid)
|
||||
if self.objtype == 'emember':
|
||||
theid = re.sub(r" ?=.*", "", theid)
|
||||
theid = re.sub(r"=[^,()]+\([^)]*?\)[^,)]*(,|\))", "\\1", theid)
|
||||
theid = re.sub(r"=\w*[^,)(]+(,|\))", "\\1", theid)
|
||||
theid = theid.replace("( ", "(").replace(" )", ")")
|
||||
@ -1298,6 +1311,25 @@ class OCVTypeObject(OCVObject):
|
||||
signode += nodes.Text(' ')
|
||||
self.attach_name(signode, obj.name)
|
||||
|
||||
class OCVEnumObject(OCVObject):
|
||||
|
||||
def get_index_text(self, name):
|
||||
if self.objtype == 'enum':
|
||||
return _('%s (enum)') % name
|
||||
return ''
|
||||
|
||||
def parse_definition(self, parser):
|
||||
return parser.parse_type_object()
|
||||
|
||||
def describe_signature(self, signode, obj):
|
||||
self.attach_modifiers(signode, obj)
|
||||
signode += addnodes.desc_annotation('enum ', 'enum ')
|
||||
if obj.typename is not None:
|
||||
self.attach_type(signode, obj.typename)
|
||||
signode += nodes.Text(' ')
|
||||
self.attach_name(signode, obj.name)
|
||||
|
||||
|
||||
class OCVMemberObject(OCVObject):
|
||||
ismember = True
|
||||
|
||||
@ -1314,12 +1346,20 @@ class OCVMemberObject(OCVObject):
|
||||
|
||||
def describe_signature(self, signode, obj):
|
||||
self.attach_modifiers(signode, obj)
|
||||
self.attach_type(signode, obj.typename)
|
||||
signode += nodes.Text(' ')
|
||||
if obj.typename:
|
||||
self.attach_type(signode, obj.typename)
|
||||
signode += nodes.Text(' ')
|
||||
self.attach_name(signode, obj.name)
|
||||
if obj.value is not None:
|
||||
signode += nodes.Text(u' = ' + obj.value)
|
||||
|
||||
class OCVEnumMemberObject(OCVMemberObject):
|
||||
def parse_definition(self, parser):
|
||||
# parent_class = self.env.temp_data.get('ocv:parent')
|
||||
# if parent_class is None:
|
||||
# parser.fail("missing parent structure/class")
|
||||
return parser.parse_enum_member_object()
|
||||
|
||||
class OCVFunctionObject(OCVObject):
|
||||
|
||||
def attach_function(self, node, func):
|
||||
@ -1453,7 +1493,9 @@ class OCVDomain(Domain):
|
||||
'pyfunction': ObjType(l_('pyfunction'), 'pyfunc'),
|
||||
'pyoldfunction': ObjType(l_('pyoldfunction'), 'pyoldfunc'),
|
||||
'member': ObjType(l_('member'), 'member'),
|
||||
'type': ObjType(l_('type'), 'type')
|
||||
'emember': ObjType(l_('emember'), 'emember'),
|
||||
'type': ObjType(l_('type'), 'type'),
|
||||
'enum': ObjType(l_('enum'), 'enum')
|
||||
}
|
||||
|
||||
directives = {
|
||||
@ -1465,7 +1507,9 @@ class OCVDomain(Domain):
|
||||
'pyfunction': OCVPyModulelevel,
|
||||
'pyoldfunction': OCVPyOldModulelevel,
|
||||
'member': OCVMemberObject,
|
||||
'emember': OCVEnumMemberObject,
|
||||
'type': OCVTypeObject,
|
||||
'enum': OCVEnumObject,
|
||||
'namespace': OCVCurrentNamespace
|
||||
}
|
||||
roles = {
|
||||
@ -1480,7 +1524,9 @@ class OCVDomain(Domain):
|
||||
'pyfunc' : OCVPyXRefRole(),
|
||||
'pyoldfunc' : OCVPyXRefRole(),
|
||||
'member': OCVXRefRole(),
|
||||
'type': OCVXRefRole()
|
||||
'emember': OCVXRefRole(),
|
||||
'type': OCVXRefRole(),
|
||||
'enum': OCVXRefRole()
|
||||
}
|
||||
initial_data = {
|
||||
'objects': {}, # fullname -> docname, objtype
|
||||
@ -1568,7 +1614,9 @@ class OCVDomain(Domain):
|
||||
'pyfunction': _('Python function'),
|
||||
'pyoldfunction': _('Legacy Python function'),
|
||||
'member': _('C++ member'),
|
||||
'emember': _('enum member'),
|
||||
'type': _('C/C++ type'),
|
||||
'enum': _('C/C++ enum'),
|
||||
'namespace': _('C++ namespace'),
|
||||
}.get(type.lname, _('%s %s') % (self.label, type.lname))
|
||||
|
||||
|
@ -47,20 +47,19 @@ Any subsequent API call to this device will reinitialize the device.
|
||||
|
||||
gpu::FeatureSet
|
||||
---------------
|
||||
Enumeration providing GPU computing features. ::
|
||||
Enumeration providing GPU computing features.
|
||||
|
||||
enum FeatureSet
|
||||
{
|
||||
FEATURE_SET_COMPUTE_10,
|
||||
FEATURE_SET_COMPUTE_11,
|
||||
FEATURE_SET_COMPUTE_12,
|
||||
FEATURE_SET_COMPUTE_13,
|
||||
FEATURE_SET_COMPUTE_20,
|
||||
FEATURE_SET_COMPUTE_21,
|
||||
GLOBAL_ATOMICS,
|
||||
SHARED_ATOMICS,
|
||||
NATIVE_DOUBLE
|
||||
};
|
||||
.. ocv:enum:: gpu::FeatureSet
|
||||
|
||||
.. ocv:emember:: FEATURE_SET_COMPUTE_10
|
||||
.. ocv:emember:: FEATURE_SET_COMPUTE_11
|
||||
.. ocv:emember:: FEATURE_SET_COMPUTE_12
|
||||
.. ocv:emember:: FEATURE_SET_COMPUTE_13
|
||||
.. ocv:emember:: FEATURE_SET_COMPUTE_20
|
||||
.. ocv:emember:: FEATURE_SET_COMPUTE_21
|
||||
.. ocv:emember:: GLOBAL_ATOMICS
|
||||
.. ocv:emember:: SHARED_ATOMICS
|
||||
.. ocv:emember:: NATIVE_DOUBLE
|
||||
|
||||
|
||||
gpu::TargetArchs
|
||||
@ -73,7 +72,7 @@ The following method checks whether the module was built with the support of the
|
||||
|
||||
.. ocv:function:: static bool gpu::TargetArchs::builtWith( FeatureSet feature_set )
|
||||
|
||||
:param feature_set: Features to be checked. See :ocv:class:`gpu::FeatureSet`.
|
||||
:param feature_set: Features to be checked. See :ocv:enum:`gpu::FeatureSet`.
|
||||
|
||||
There is a set of methods to check whether the module contains intermediate (PTX) or binary GPU code for the given architecture(s):
|
||||
|
||||
@ -197,7 +196,7 @@ Provides information on GPU feature support.
|
||||
|
||||
.. ocv:function:: bool gpu::DeviceInfo::supports( FeatureSet feature_set ) const
|
||||
|
||||
:param feature_set: Features to be checked. See :ocv:class:`gpu::FeatureSet`.
|
||||
:param feature_set: Features to be checked. See :ocv:enum:`gpu::FeatureSet`.
|
||||
|
||||
This function returns ``true`` if the device has the specified GPU feature. Otherwise, it returns ``false`` .
|
||||
|
||||
|
@ -985,41 +985,51 @@ Class for reading video from files.
|
||||
gpu::VideoReader_GPU::Codec
|
||||
---------------------------
|
||||
|
||||
Video codecs supported by :ocv:class:`gpu::VideoReader_GPU` . ::
|
||||
Video codecs supported by :ocv:class:`gpu::VideoReader_GPU` .
|
||||
|
||||
enum Codec
|
||||
{
|
||||
MPEG1 = 0,
|
||||
MPEG2,
|
||||
MPEG4,
|
||||
VC1,
|
||||
H264,
|
||||
JPEG,
|
||||
H264_SVC,
|
||||
H264_MVC,
|
||||
.. ocv:enum:: gpu::VideoReader_GPU::Codec
|
||||
|
||||
Uncompressed_YUV420 = (('I'<<24)|('Y'<<16)|('U'<<8)|('V')), // Y,U,V (4:2:0)
|
||||
Uncompressed_YV12 = (('Y'<<24)|('V'<<16)|('1'<<8)|('2')), // Y,V,U (4:2:0)
|
||||
Uncompressed_NV12 = (('N'<<24)|('V'<<16)|('1'<<8)|('2')), // Y,UV (4:2:0)
|
||||
Uncompressed_YUYV = (('Y'<<24)|('U'<<16)|('Y'<<8)|('V')), // YUYV/YUY2 (4:2:2)
|
||||
Uncompressed_UYVY = (('U'<<24)|('Y'<<16)|('V'<<8)|('Y')), // UYVY (4:2:2)
|
||||
};
|
||||
.. ocv:emember:: MPEG1 = 0
|
||||
.. ocv:emember:: MPEG2
|
||||
.. ocv:emember:: MPEG4
|
||||
.. ocv:emember:: VC1
|
||||
.. ocv:emember:: H264
|
||||
.. ocv:emember:: JPEG
|
||||
.. ocv:emember:: H264_SVC
|
||||
.. ocv:emember:: H264_MVC
|
||||
|
||||
.. ocv:emember:: Uncompressed_YUV420 = (('I'<<24)|('Y'<<16)|('U'<<8)|('V'))
|
||||
|
||||
Y,U,V (4:2:0)
|
||||
|
||||
.. ocv:emember:: Uncompressed_YV12 = (('Y'<<24)|('V'<<16)|('1'<<8)|('2'))
|
||||
|
||||
Y,V,U (4:2:0)
|
||||
|
||||
.. ocv:emember:: Uncompressed_NV12 = (('N'<<24)|('V'<<16)|('1'<<8)|('2'))
|
||||
|
||||
Y,UV (4:2:0)
|
||||
|
||||
.. ocv:emember:: Uncompressed_YUYV = (('Y'<<24)|('U'<<16)|('Y'<<8)|('V'))
|
||||
|
||||
YUYV/YUY2 (4:2:2)
|
||||
|
||||
.. ocv:emember:: Uncompressed_UYVY = (('U'<<24)|('Y'<<16)|('V'<<8)|('Y'))
|
||||
|
||||
UYVY (4:2:2)
|
||||
|
||||
|
||||
gpu::VideoReader_GPU::ChromaFormat
|
||||
----------------------------------
|
||||
|
||||
Chroma formats supported by :ocv:class:`gpu::VideoReader_GPU` . ::
|
||||
Chroma formats supported by :ocv:class:`gpu::VideoReader_GPU` .
|
||||
|
||||
enum ChromaFormat
|
||||
{
|
||||
Monochrome=0,
|
||||
YUV420,
|
||||
YUV422,
|
||||
YUV444,
|
||||
};
|
||||
.. ocv:enum:: gpu::VideoReader_GPU::ChromaFormat
|
||||
|
||||
.. ocv:emember:: Monochrome = 0
|
||||
.. ocv:emember:: YUV420
|
||||
.. ocv:emember:: YUV422
|
||||
.. ocv:emember:: YUV444
|
||||
|
||||
|
||||
gpu::VideoReader_GPU::FormatInfo
|
||||
@ -1037,7 +1047,6 @@ Struct providing information about video file format. ::
|
||||
};
|
||||
|
||||
|
||||
|
||||
gpu::VideoReader_GPU::VideoReader_GPU
|
||||
-------------------------------------
|
||||
Constructors.
|
||||
|
@ -221,15 +221,13 @@ Implementation of the camera parameters refinement algorithm which minimizes sum
|
||||
|
||||
detail::WaveCorrectKind
|
||||
-----------------------
|
||||
.. ocv:class:: detail::WaveCorrectKind
|
||||
Wave correction kind.
|
||||
|
||||
Wave correction kind. ::
|
||||
.. ocv:enum:: detail::WaveCorrectKind
|
||||
|
||||
.. ocv:emember:: WAVE_CORRECT_HORIZ
|
||||
.. ocv:emember:: WAVE_CORRECT_VERT
|
||||
|
||||
enum CV_EXPORTS WaveCorrectKind
|
||||
{
|
||||
WAVE_CORRECT_HORIZ,
|
||||
WAVE_CORRECT_VERT
|
||||
};
|
||||
|
||||
detail::waveCorrect
|
||||
-------------------
|
||||
@ -239,4 +237,4 @@ Tries to make panorama more horizontal (or vertical).
|
||||
|
||||
:param rmats: Camera rotation matrices.
|
||||
|
||||
:param kind: Correction kind, see :ocv:class:`detail::WaveCorrectKind`.
|
||||
:param kind: Correction kind, see :ocv:enum:`detail::WaveCorrectKind`.
|
||||
|
Loading…
Reference in New Issue
Block a user