Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
032e5e3f
Commit
032e5e3f
authored
Feb 03, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
dd603855
64c7e966
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
6 deletions
+32
-6
cmake_find_blas.txt
dlib/cmake_find_blas.txt
+7
-5
call_matlab.h
dlib/matlab/call_matlab.h
+8
-0
cmake_mex_wrapper
dlib/matlab/cmake_mex_wrapper
+2
-0
mex_wrapper.cpp
dlib/matlab/mex_wrapper.cpp
+15
-1
No files found.
dlib/cmake_find_blas.txt
View file @
032e5e3f
...
@@ -49,10 +49,6 @@ if (UNIX)
...
@@ -49,10 +49,6 @@ if (UNIX)
include(CheckLibraryExists)
include(CheckLibraryExists)
# Don't try to use the Intel MKL when we are building a MATLAB mex file
# since it will usually conflict with MATLAB's copy of the MKL and cause
# problems.
if (NOT BUILDING_MATLAB_MEX_FILE)
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt
# file first since this way avoids linking bugs in some cases.
# file first since this way avoids linking bugs in some cases.
find_library(mkl_rt mkl_rt ${mkl_search_path})
find_library(mkl_rt mkl_rt ${mkl_search_path})
...
@@ -65,6 +61,13 @@ if (UNIX)
...
@@ -65,6 +61,13 @@ if (UNIX)
set(lapack_found 1)
set(lapack_found 1)
set(found_intel_mkl 1)
set(found_intel_mkl 1)
message(STATUS "Found Intel MKL BLAS/LAPACK library")
message(STATUS "Found Intel MKL BLAS/LAPACK library")
if (BUILDING_MATLAB_MEX_FILE)
message(STATUS "\n!!!! Don't forget to set the BLAS_VERSION and LAPACK_VERSION environment variables to !!!!\n!!!! ${blas_libraries} so MATLAB doesn't explode when you run this mex file !!!!\n")
endif()
endif()
if (BUILDING_MATLAB_MEX_FILE)
return()
endif()
endif()
if (NOT found_intel_mkl)
if (NOT found_intel_mkl)
...
@@ -86,7 +89,6 @@ if (UNIX)
...
@@ -86,7 +89,6 @@ if (UNIX)
message(STATUS "Found Intel MKL BLAS/LAPACK library")
message(STATUS "Found Intel MKL BLAS/LAPACK library")
endif()
endif()
endif()
endif()
endif()
# try to find some other LAPACK libraries if we didn't find the MKL
# try to find some other LAPACK libraries if we didn't find the MKL
...
...
dlib/matlab/call_matlab.h
View file @
032e5e3f
...
@@ -8,6 +8,14 @@
...
@@ -8,6 +8,14 @@
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
void
check_for_ctrl_c
();
/*!
ensures
- If the user of MATLAB has pressed ctrl+c then this function will throw an
exception.
!*/
// ----------------------------------------------------------------------------------------
class
matlab_struct
class
matlab_struct
{
{
...
...
dlib/matlab/cmake_mex_wrapper
View file @
032e5e3f
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
cmake_minimum_required(VERSION 2.8.4)
cmake_minimum_required(VERSION 2.8.4)
set(BUILDING_MATLAB_MEX_FILE true)
set(BUILDING_MATLAB_MEX_FILE true)
set(CMAKE_POSITION_INDEPENDENT_CODE True)
# Find MATLAB's include directory and needed libraries
# Find MATLAB's include directory and needed libraries
find_program(MATLAB_EXECUTABLE matlab PATHS
find_program(MATLAB_EXECUTABLE matlab PATHS
...
@@ -67,6 +68,7 @@ INCLUDE(InstallRequiredSystemLibraries)
...
@@ -67,6 +68,7 @@ INCLUDE(InstallRequiredSystemLibraries)
MACRO(add_mex_function name )
MACRO(add_mex_function name )
ADD_LIBRARY(${name} MODULE ${name}.cpp )
ADD_LIBRARY(${name} MODULE ${name}.cpp )
# Change the output file extension to a mex extension.
# Change the output file extension to a mex extension.
if (WIN32)
if (WIN32)
set_target_properties(${name} PROPERTIES SUFFIX ".mexw64")
set_target_properties(${name} PROPERTIES SUFFIX ".mexw64")
...
...
dlib/matlab/mex_wrapper.cpp
View file @
032e5e3f
...
@@ -253,6 +253,8 @@ namespace mex_binding
...
@@ -253,6 +253,8 @@ namespace mex_binding
// -------------------------------------------------------
// -------------------------------------------------------
struct
user_hit_ctrl_c
{};
struct
invalid_args_exception
struct
invalid_args_exception
{
{
invalid_args_exception
(
const
std
::
string
&
msg_
)
:
msg
(
msg_
)
{}
invalid_args_exception
(
const
std
::
string
&
msg_
)
:
msg
(
msg_
)
{}
...
@@ -897,7 +899,7 @@ namespace mex_binding
...
@@ -897,7 +899,7 @@ namespace mex_binding
}
}
else
if
(
is_same_type
<
dlib
::
rgb_pixel
,
type
>::
value
)
else
if
(
is_same_type
<
dlib
::
rgb_pixel
,
type
>::
value
)
{
{
mwSize
dims
[
3
]
=
{(
unsigned
long
)
item
.
nr
(),
(
unsigned
long
)
item
.
nc
(),
3
};
mwSize
dims
[
3
]
=
{(
mwSize
)
item
.
nr
(),
(
mwSize
)
item
.
nc
(),
3
};
plhs
=
mxCreateNumericArray
(
3
,
dims
,
mxUINT8_CLASS
,
mxREAL
);
plhs
=
mxCreateNumericArray
(
3
,
dims
,
mxUINT8_CLASS
,
mxREAL
);
assign_image_to_matlab
((
dlib
::
uint8
*
)
mxGetData
(
plhs
),
item
);
assign_image_to_matlab
((
dlib
::
uint8
*
)
mxGetData
(
plhs
),
item
);
...
@@ -1573,6 +1575,10 @@ namespace mex_binding
...
@@ -1573,6 +1575,10 @@ namespace mex_binding
mexErrMsgIdAndTxt
(
"mex_function:validate_and_populate_arg"
,
mexErrMsgIdAndTxt
(
"mex_function:validate_and_populate_arg"
,
(
"Input"
+
e
.
msg
).
c_str
());
(
"Input"
+
e
.
msg
).
c_str
());
}
}
catch
(
user_hit_ctrl_c
&
)
{
// do nothing, just return to matlab
}
catch
(
dlib
::
error
&
e
)
catch
(
dlib
::
error
&
e
)
{
{
mexErrMsgIdAndTxt
(
"mex_function:error"
,
mexErrMsgIdAndTxt
(
"mex_function:error"
,
...
@@ -2371,6 +2377,14 @@ void call_matlab (
...
@@ -2371,6 +2377,14 @@ void call_matlab (
call_matlab
(
"feval"
,
funct
);
call_matlab
(
"feval"
,
funct
);
}
}
extern
"C"
bool
utIsInterruptPending
();
void
check_for_ctrl_c
(
)
{
if
(
utIsInterruptPending
())
throw
mex_binding
::
user_hit_ctrl_c
();
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
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