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
bb56ac4a
Commit
bb56ac4a
authored
Jun 27, 2013
by
hbristow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added delta builds of Matlab executables. Imgproc module now compiling
parent
136f205f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
9 deletions
+36
-9
OpenCVModule.cmake
cmake/OpenCVModule.cmake
+1
-1
CMakeLists.txt
modules/matlab/CMakeLists.txt
+1
-0
compile.cmake
modules/matlab/compile.cmake
+8
-6
gen_matlab.py
modules/matlab/generator/gen_matlab.py
+2
-0
parse_tree.py
modules/matlab/generator/parse_tree.py
+2
-1
template_map_base.cpp
modules/matlab/generator/templates/template_map_base.cpp
+1
-1
bridge.hpp
modules/matlab/include/bridge.hpp
+21
-0
No files found.
cmake/OpenCVModule.cmake
View file @
bb56ac4a
...
@@ -313,7 +313,7 @@ macro(ocv_glob_modules)
...
@@ -313,7 +313,7 @@ macro(ocv_glob_modules)
# TODO: Undo this change to build all modules
# TODO: Undo this change to build all modules
#file(GLOB __ocvmodules RELATIVE "${__path}" "${__path}/*")
#file(GLOB __ocvmodules RELATIVE "${__path}" "${__path}/*")
file
(
GLOB __ocvmodules RELATIVE
"
${
__path
}
"
"
${
__path
}
/core"
"
${
__path
}
/matlab"
)
file
(
GLOB __ocvmodules RELATIVE
"
${
__path
}
"
"
${
__path
}
/core"
"
${
__path
}
/
imgproc"
"
${
__path
}
/
matlab"
)
if
(
__ocvmodules
)
if
(
__ocvmodules
)
list
(
SORT __ocvmodules
)
list
(
SORT __ocvmodules
)
foreach
(
mod
${
__ocvmodules
}
)
foreach
(
mod
${
__ocvmodules
}
)
...
...
modules/matlab/CMakeLists.txt
View file @
bb56ac4a
...
@@ -159,6 +159,7 @@ add_custom_command(
...
@@ -159,6 +159,7 @@ add_custom_command(
add_custom_command
(
add_custom_command
(
OUTPUT
${
COMPILE_PROXY
}
OUTPUT
${
COMPILE_PROXY
}
COMMAND
${
CMAKE_COMMAND
}
-DMATLAB_MEX_SCRIPT=
${
MATLAB_MEX_SCRIPT
}
COMMAND
${
CMAKE_COMMAND
}
-DMATLAB_MEX_SCRIPT=
${
MATLAB_MEX_SCRIPT
}
-DMATLAB_MEXEXT=
${
MATLAB_MEXEXT
}
-DMEX_OPTS=
${
MEX_OPTS
}
-DMEX_OPTS=
${
MEX_OPTS
}
-DMEX_INCLUDE_DIRS=
"
${
MEX_INCLUDE_DIRS
}
"
-DMEX_INCLUDE_DIRS=
"
${
MEX_INCLUDE_DIRS
}
"
-DMEX_LIB_DIR=
${
MEX_LIB_DIR
}
-DMEX_LIB_DIR=
${
MEX_LIB_DIR
}
...
...
modules/matlab/compile.cmake
View file @
bb56ac4a
...
@@ -8,12 +8,14 @@ foreach(SOURCE_FILE ${SOURCE_FILES})
...
@@ -8,12 +8,14 @@ foreach(SOURCE_FILE ${SOURCE_FILES})
# strip out the filename
# strip out the filename
get_filename_component
(
FILENAME
${
SOURCE_FILE
}
NAME_WE
)
get_filename_component
(
FILENAME
${
SOURCE_FILE
}
NAME_WE
)
# compile the source file using mex
# compile the source file using mex
execute_process
(
if
(
NOT EXISTS
${
CMAKE_CURRENT_BINARY_DIR
}
/+cv/
${
FILENAME
}
.
${
MATLAB_MEXEXT
}
)
COMMAND
${
MATLAB_MEX_SCRIPT
}
${
MEX_OPTS
}
${
MEX_INCLUDE_DIRS_LIST
}
execute_process
(
${
MEX_LIB_DIR
}
${
MEX_LIBS
}
${
SOURCE_FILE
}
COMMAND
${
MATLAB_MEX_SCRIPT
}
${
MEX_OPTS
}
${
MEX_INCLUDE_DIRS_LIST
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/+cv
${
MEX_LIB_DIR
}
${
MEX_LIBS
}
${
SOURCE_FILE
}
ERROR_VARIABLE FAILED
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/+cv
)
ERROR_VARIABLE FAILED
)
endif
()
# TODO: If a mex file fails to cmpile, should we error out?
# TODO: If a mex file fails to cmpile, should we error out?
if
(
FAILED
)
if
(
FAILED
)
message
(
FATAL_ERROR
"Failed to compile
${
FILENAME
}
:
${
FAILED
}
"
)
message
(
FATAL_ERROR
"Failed to compile
${
FILENAME
}
:
${
FAILED
}
"
)
...
...
modules/matlab/generator/gen_matlab.py
View file @
bb56ac4a
...
@@ -12,9 +12,11 @@ class MatlabWrapperGenerator(object):
...
@@ -12,9 +12,11 @@ class MatlabWrapperGenerator(object):
name
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
file
))[
0
]
name
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
file
))[
0
]
ns
[
name
]
=
parser
.
parse
(
file
)
ns
[
name
]
=
parser
.
parse
(
file
)
print
ns
[
'imgproc'
]
# cleanify the parser output
# cleanify the parser output
parse_tree
=
ParseTree
()
parse_tree
=
ParseTree
()
parse_tree
.
build
(
ns
)
parse_tree
.
build
(
ns
)
print
parse_tree
# setup the template engine
# setup the template engine
jtemplate
=
Environment
(
loader
=
PackageLoader
(
'templates'
,
''
),
trim_blocks
=
True
,
lstrip_blocks
=
True
)
jtemplate
=
Environment
(
loader
=
PackageLoader
(
'templates'
,
''
),
trim_blocks
=
True
,
lstrip_blocks
=
True
)
...
...
modules/matlab/generator/parse_tree.py
View file @
bb56ac4a
from
string
import
join
from
string
import
join
from
textwrap
import
fill
from
textwrap
import
fill
from
filters
import
*
class
ParseTree
(
object
):
class
ParseTree
(
object
):
def
__init__
(
self
,
namespaces
=
None
):
def
__init__
(
self
,
namespaces
=
None
):
...
@@ -52,7 +53,7 @@ class Translator(object):
...
@@ -52,7 +53,7 @@ class Translator(object):
return
self
.
translateClass
(
defn
)
return
self
.
translateClass
(
defn
)
# --- function ---
# --- function ---
# functions either need to have input arguments, or not uppercase names
# functions either need to have input arguments, or not uppercase names
elif
defn
[
3
]
or
not
self
.
translateName
(
defn
[
0
])
.
isupper
():
elif
defn
[
3
]
or
not
self
.
translateName
(
defn
[
0
])
.
split
(
'_'
)[
0
]
.
isupper
():
return
self
.
translateFunction
(
defn
)
return
self
.
translateFunction
(
defn
)
# --- constant ---
# --- constant ---
else
:
else
:
...
...
modules/matlab/generator/templates/template_map_base.cpp
View file @
bb56ac4a
...
@@ -12,7 +12,7 @@ typedef std::unordered_map Map;
...
@@ -12,7 +12,7 @@ typedef std::unordered_map Map;
* from Matlab as, e.g.
* from Matlab as, e.g.
* cv.dft(x, xf, "DFT_FORWARD");
* cv.dft(x, xf, "DFT_FORWARD");
*
*
* Note that an alternative M
A
tlab class exists as well, so that functions
* Note that an alternative M
a
tlab class exists as well, so that functions
* can be called as, e.g.
* can be called as, e.g.
* cv.dft(x, xf, cv.DFT_FORWARD);
* cv.dft(x, xf, cv.DFT_FORWARD);
*
*
...
...
modules/matlab/include/bridge.hpp
View file @
bb56ac4a
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
typedef
std
::
vector
<
cv
::
Mat
>
vector_Mat
;
typedef
std
::
vector
<
cv
::
Mat
>
vector_Mat
;
typedef
std
::
vector
<
cv
::
Point
>
vector_Point
;
typedef
std
::
vector
<
cv
::
Point
>
vector_Point
;
typedef
std
::
vector
<
int
>
vector_int
;
typedef
std
::
vector
<
int
>
vector_int
;
typedef
std
::
vector
<
float
>
vector_float
;
void
conditionalError
(
bool
expr
,
const
std
::
string
&
str
)
{
void
conditionalError
(
bool
expr
,
const
std
::
string
&
str
)
{
...
@@ -127,6 +128,11 @@ public:
...
@@ -127,6 +128,11 @@ public:
vector_int
toVectorInt
()
{
return
vector_int
();
}
vector_int
toVectorInt
()
{
return
vector_int
();
}
operator
vector_int
()
{
return
toVectorInt
();
}
operator
vector_int
()
{
return
toVectorInt
();
}
// --------------------------- vector_float ----------------------------------
Bridge
&
operator
=
(
const
vector_float
&
obj
)
{
return
*
this
;
}
vector_float
toVectorFloat
()
{
return
vector_float
();
}
operator
vector_float
()
{
return
toVectorFloat
();
}
// --------------------------- string --------------------------------------
// --------------------------- string --------------------------------------
Bridge
&
operator
=
(
const
std
::
string
&
obj
)
{
return
*
this
;
}
Bridge
&
operator
=
(
const
std
::
string
&
obj
)
{
return
*
this
;
}
std
::
string
toString
()
{
return
""
;
}
std
::
string
toString
()
{
return
""
;
}
...
@@ -147,11 +153,26 @@ public:
...
@@ -147,11 +153,26 @@ public:
cv
::
Point
toPoint
()
{
return
cv
::
Point
();
}
cv
::
Point
toPoint
()
{
return
cv
::
Point
();
}
operator
cv
::
Point
()
{
return
toPoint
();
}
operator
cv
::
Point
()
{
return
toPoint
();
}
// -------------------------- Point2f ------------------------------------
Bridge
&
operator
=
(
const
cv
::
Point2f
&
obj
)
{
return
*
this
;
}
cv
::
Point2f
toPoint2f
()
{
return
cv
::
Point2f
();
}
operator
cv
::
Point2f
()
{
return
toPoint2f
();
}
// -------------------------- Point2d ------------------------------------
Bridge
&
operator
=
(
const
cv
::
Point2d
&
obj
)
{
return
*
this
;
}
cv
::
Point2d
toPoint2d
()
{
return
cv
::
Point2d
();
}
operator
cv
::
Point2d
()
{
return
toPoint2d
();
}
// -------------------------- Size ---------------------------------------
// -------------------------- Size ---------------------------------------
Bridge
&
operator
=
(
const
cv
::
Size
&
obj
)
{
return
*
this
;
}
Bridge
&
operator
=
(
const
cv
::
Size
&
obj
)
{
return
*
this
;
}
cv
::
Size
toSize
()
{
return
cv
::
Size
();
}
cv
::
Size
toSize
()
{
return
cv
::
Size
();
}
operator
cv
::
Size
()
{
return
toSize
();
}
operator
cv
::
Size
()
{
return
toSize
();
}
// -------------------------- Moments ---------------------------------------
Bridge
&
operator
=
(
const
cv
::
Moments
&
obj
)
{
return
*
this
;
}
cv
::
Moments
toMoments
()
{
return
cv
::
Moments
();
}
operator
cv
::
Moments
()
{
return
toMoments
();
}
// ------------------------ vector_Point ------------------------------------
// ------------------------ vector_Point ------------------------------------
Bridge
&
operator
=
(
const
vector_Point
&
obj
)
{
return
*
this
;
}
Bridge
&
operator
=
(
const
vector_Point
&
obj
)
{
return
*
this
;
}
vector_Point
toVectorPoint
()
{
return
vector_Point
();
}
vector_Point
toVectorPoint
()
{
return
vector_Point
();
}
...
...
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