Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
6b88a21b
Commit
6b88a21b
authored
Jun 27, 2013
by
hbristow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added handling of constants equaling constants. e.g. FMT_DEFAULT = FMT_MATLAB
parent
c5720213
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
15 deletions
+17
-15
CMakeLists.txt
modules/matlab/CMakeLists.txt
+4
-0
filters.py
modules/matlab/generator/filters.py
+7
-0
gen_matlab.py
modules/matlab/generator/gen_matlab.py
+2
-1
gen_matlab_caller.py
modules/matlab/generator/gen_matlab_caller.py
+0
-14
template_map_base.m
modules/matlab/generator/templates/template_map_base.m
+4
-0
No files found.
modules/matlab/CMakeLists.txt
View file @
6b88a21b
...
...
@@ -194,3 +194,7 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+cv/private/
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/matlab/+cv/private
FILES_MATCHING PATTERN
"*.
${
MATLAB_MEXEXT
}
"
)
install
(
DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/matlab
FILES_MATCHING PATTERN
"cv.m"
)
modules/matlab/generator/filters.py
View file @
6b88a21b
...
...
@@ -43,6 +43,13 @@ def noutputs(args):
'''Counts the number of output arguments in the input list'''
return
len
(
outputs
(
args
))
def
convertibleToInt
(
string
):
try
:
int
(
string
)
return
True
except
ValueError
:
return
False
def
capitalizeFirst
(
text
):
return
text
[
0
]
.
upper
()
+
text
[
1
:]
...
...
modules/matlab/generator/gen_matlab.py
View file @
6b88a21b
...
...
@@ -20,6 +20,7 @@ class MatlabWrapperGenerator(object):
jtemplate
=
Environment
(
loader
=
PackageLoader
(
'templates'
,
''
),
trim_blocks
=
True
,
lstrip_blocks
=
True
)
# add the custom filters
jtemplate
.
filters
[
'convertibleToInt'
]
=
convertibleToInt
jtemplate
.
filters
[
'toUpperCamelCase'
]
=
toUpperCamelCase
jtemplate
.
filters
[
'toLowerCamelCase'
]
=
toLowerCamelCase
jtemplate
.
filters
[
'toUnderCase'
]
=
toUnderCase
...
...
@@ -79,7 +80,7 @@ class MatlabWrapperGenerator(object):
populatedm
=
tconstm
.
render
(
constants
=
const
)
with
open
(
output_map_dir
+
'/map.cpp'
,
'wb'
)
as
f
:
f
.
write
(
populatedc
)
with
open
(
output_
map_dir
+
'/map
.m'
,
'wb'
)
as
f
:
with
open
(
output_
dir
+
'/cv
.m'
,
'wb'
)
as
f
:
f
.
write
(
populatedm
)
...
...
modules/matlab/generator/gen_matlab_caller.py
deleted
100644 → 0
View file @
c5720213
#/usr/bin/env python
# add the hdr_parser to the path
import
sys
sys
.
path
.
append
(
sys
.
argv
[
1
])
# get the IO from the command line arguments
input_files
=
sys
.
argv
[
2
:
-
1
]
output_dir
=
sys
.
argv
[
-
1
]
# create the generator
from
gen_matlab
import
MatlabWrapperGenerator
mwg
=
MatlabWrapperGenerator
()
mwg
.
gen
(
input_files
,
output_dir
)
modules/matlab/generator/templates/template_map_base.m
View file @
6b88a21b
...
...
@@ -23,7 +23,11 @@
classdef
cv
properties
(
Constant
=
true
)
{% for key, val in constants.items() %}
{% if val|convertibleToInt %}
{{
key
}}
=
{{
val
}};
{% else %}
{{
key
}}
=
{{
constants
[
val
]}};
{% endif %}
{% endfor %}
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment