Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
c7813163
Commit
c7813163
authored
Jan 23, 2016
by
Davis King
Browse files
merged
parents
a9e1c9e4
27274c17
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
263 additions
and
26 deletions
+263
-26
dlib/CMakeLists.txt
dlib/CMakeLists.txt
+22
-14
dlib/algs.h
dlib/algs.h
+5
-0
dlib/all/source.cpp
dlib/all/source.cpp
+7
-0
dlib/bridge.h
dlib/bridge.h
+6
-0
dlib/dlib_basic_cpp_build_tutorial.txt
dlib/dlib_basic_cpp_build_tutorial.txt
+13
-0
dlib/gui_widgets.h
dlib/gui_widgets.h
+5
-0
dlib/image_io.h
dlib/image_io.h
+5
-0
dlib/image_loader/load_image.h
dlib/image_loader/load_image.h
+29
-6
dlib/image_processing.h
dlib/image_processing.h
+5
-0
dlib/image_transforms.h
dlib/image_transforms.h
+5
-0
dlib/matlab/cmake_mex_wrapper
dlib/matlab/cmake_mex_wrapper
+17
-5
dlib/opencv.h
dlib/opencv.h
+4
-0
dlib/platform.h
dlib/platform.h
+5
-0
dlib/smart_pointers/shared_ptr.h
dlib/smart_pointers/shared_ptr.h
+10
-0
dlib/smart_pointers/shared_ptr_thread_safe.h
dlib/smart_pointers/shared_ptr_thread_safe.h
+11
-1
dlib/svm.h
dlib/svm.h
+5
-0
dlib/svm_threaded.h
dlib/svm_threaded.h
+5
-0
dlib/threads.h
dlib/threads.h
+5
-0
dlib/vectorstream.h
dlib/vectorstream.h
+1
-0
dlib/vectorstream/unserialize.h
dlib/vectorstream/unserialize.h
+98
-0
No files found.
dlib/CMakeLists.txt
View file @
c7813163
...
...
@@ -190,21 +190,29 @@ if (NOT TARGET dlib)
set
(
dlib_needed_libraries
${
pthreadlib
}
)
if
(
NOT DLIB_NO_GUI_SUPPORT
)
find_library
(
xlib X11
)
# Make sure X11 is in the include path. Note that we look for
# Xlocale.h rather than Xlib.h because it avoids finding a partial
# copy of the X11 headers on systems with anaconda installed.
find_path
(
xlib_path Xlocale.h
PATHS
/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include
/opt/local/include
PATH_SUFFIXES X11
)
if
(
xlib AND xlib_path
)
get_filename_component
(
x11_path
${
xlib_path
}
PATH CACHE
)
include_directories
(
${
x11_path
}
)
set
(
dlib_needed_libraries
${
dlib_needed_libraries
}
${
xlib
}
)
find_package
(
X11 QUIET
)
if
(
X11_FOUND
)
include_directories
(
${
X11_INCLUDE_DIR
}
)
set
(
dlib_needed_libraries
${
dlib_needed_libraries
}
${
X11_LIBRARIES
}
)
else
()
find_library
(
xlib X11
)
# Make sure X11 is in the include path. Note that we look for
# Xlocale.h rather than Xlib.h because it avoids finding a partial
# copy of the X11 headers on systems with anaconda installed.
find_path
(
xlib_path Xlocale.h
PATHS
/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include
/opt/local/include
PATH_SUFFIXES X11
)
if
(
xlib AND xlib_path
)
get_filename_component
(
x11_path
${
xlib_path
}
PATH CACHE
)
include_directories
(
${
x11_path
}
)
set
(
dlib_needed_libraries
${
dlib_needed_libraries
}
${
xlib
}
)
set
(
X11_FOUND 1
)
endif
()
endif
()
if
(
NOT X11_FOUND
)
message
(
" *****************************************************************************"
)
message
(
" *** DLIB GUI SUPPORT DISABLED BECAUSE X11 DEVELOPMENT LIBRARIES NOT FOUND ***"
)
message
(
" *** Make sure XQuartz is installed if you want GUI support. ***"
)
...
...
dlib/algs.h
View file @
c7813163
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifdef DLIB_ALL_SOURCE_END
#include "dlib_basic_cpp_build_tutorial.txt"
#endif
#ifndef DLIB_ALGs_
#define DLIB_ALGs_
...
...
dlib/all/source.cpp
View file @
c7813163
...
...
@@ -3,6 +3,10 @@
#ifndef DLIB_ALL_SOURCe_
#define DLIB_ALL_SOURCe_
#if defined(DLIB_ALGs_) || defined(DLIB_PLATFORm_)
#include "../dlib_basic_cpp_build_tutorial.txt"
#endif
// ISO C++ code
#include "../base64/base64_kernel_1.cpp"
#include "../bigint/bigint_kernel_1.cpp"
...
...
@@ -80,5 +84,8 @@
#endif // DLIB_ISO_CPP_ONLY
#define DLIB_ALL_SOURCE_END
#endif // DLIB_ALL_SOURCe_
dlib/bridge.h
View file @
c7813163
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifdef DLIB_ALL_SOURCE_END
#include "dlib_basic_cpp_build_tutorial.txt"
#endif
#ifndef DLIB_BRIdGE_
#define DLIB_BRIdGE_
...
...
dlib/dlib_basic_cpp_build_tutorial.txt
0 → 100644
View file @
c7813163
#error "Don't write #include <dlib/all/source.cpp> in your code."
/*
In C++, it is generally an error to #include .cpp files. This is because it
can lead to what are called multiply defined symbol errors. Therefore, you
should compile dlib/all/source.cpp into your application just like you would
compile any other .cpp file.
If you are using Visual Studio you add .cpp files to your application using
the solution explorer window. Specifically, right click on Source Files,
then select Add -> Existing Item and select the .cpp files you want to add.
For general information on compiling dlib see http://dlib.net/compile.html
*/
dlib/gui_widgets.h
View file @
c7813163
// Copyright (C) 2005 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifdef DLIB_ALL_SOURCE_END
#include "dlib_basic_cpp_build_tutorial.txt"
#endif
#ifndef DLIB_GUI_WIDGETs_
#define DLIB_GUI_WIDGETs_
...
...
dlib/image_io.h
View file @
c7813163
// Copyright (C) 2006 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifdef DLIB_ALL_SOURCE_END
#include "dlib_basic_cpp_build_tutorial.txt"
#endif
#ifndef DLIB_IMAGe_IO_
#define DLIB_IMAGe_IO_
...
...
dlib/image_loader/load_image.h
View file @
c7813163
...
...
@@ -9,6 +9,7 @@
#include "jpeg_loader.h"
#include "image_loader.h"
#include <fstream>
#include <sstream>
namespace
dlib
{
...
...
@@ -71,15 +72,37 @@ namespace dlib
if
(
im_type
==
image_file_type
::
JPG
)
{
throw
image_load_error
(
"Unable to load image in file "
+
file_name
+
".
\n
"
+
"You must #define DLIB_JPEG_SUPPORT and link to libjpeg to read JPEG files.
\n
"
+
"Do this by following the instructions at http://dlib.net/compile.html."
);
std
::
ostringstream
sout
;
sout
<<
"Unable to load image in file "
+
file_name
+
".
\n
"
+
"You must #define DLIB_JPEG_SUPPORT and link to libjpeg to read JPEG files.
\n
"
+
"Do this by following the instructions at http://dlib.net/compile.html.
\n\n
"
;
#ifdef _MSC_VER
sout
<<
"Note that you must cause DLIB_JPEG_SUPPORT to be defined for your entire project.
\n
"
;
sout
<<
"So don't #define it in one file, add it to the C/C++->Preprocessor->Preprocessor Definitions
\n
"
;
sout
<<
"field in Visual Studio's Property Pages window so it takes effect for your entire application."
;
#else
sout
<<
"Note that you must cause DLIB_JPEG_SUPPORT to be defined for your entire project.
\n
"
;
sout
<<
"So don't #define it in one file, use a compiler switch like -DDLIB_JPEG_SUPPORT
\n
"
;
sout
<<
"so it takes effect for your entire application."
;
#endif
throw
image_load_error
(
sout
.
str
());
}
else
if
(
im_type
==
image_file_type
::
PNG
)
{
throw
image_load_error
(
"Unable to load image in file "
+
file_name
+
".
\n
"
+
"You must #define DLIB_PNG_SUPPORT and link to libpng to read PNG files.
\n
"
+
"Do this by following the instructions at http://dlib.net/compile.html."
);
std
::
ostringstream
sout
;
sout
<<
"Unable to load image in file "
+
file_name
+
".
\n
"
+
"You must #define DLIB_PNG_SUPPORT and link to libpng to read PNG files.
\n
"
+
"Do this by following the instructions at http://dlib.net/compile.html.
\n\n
"
;
#ifdef _MSC_VER
sout
<<
"Note that you must cause DLIB_PNG_SUPPORT to be defined for your entire project.
\n
"
;
sout
<<
"So don't #define it in one file, add it to the C/C++->Preprocessor->Preprocessor Definitions
\n
"
;
sout
<<
"field in Visual Studio's Property Pages window so it takes effect for your entire application.
\n
"
;
#else
sout
<<
"Note that you must cause DLIB_PNG_SUPPORT to be defined for your entire project.
\n
"
;
sout
<<
"So don't #define it in one file, use a compiler switch like -DDLIB_PNG_SUPPORT
\n
"
;
sout
<<
"so it takes effect for your entire application."
;
#endif
throw
image_load_error
(
sout
.
str
());
}
else
{
...
...
dlib/image_processing.h
View file @
c7813163
// Copyright (C) 2011 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifdef DLIB_ALL_SOURCE_END
#include "dlib_basic_cpp_build_tutorial.txt"
#endif
#ifndef DLIB_IMAGE_PROCESSInG_H_h_
#define DLIB_IMAGE_PROCESSInG_H_h_
...
...
dlib/image_transforms.h
View file @
c7813163
// Copyright (C) 2006 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifdef DLIB_ALL_SOURCE_END
#include "dlib_basic_cpp_build_tutorial.txt"
#endif
#ifndef DLIB_IMAGE_TRANSFORMs_
#define DLIB_IMAGE_TRANSFORMs_
...
...
dlib/matlab/cmake_mex_wrapper
View file @
c7813163
...
...
@@ -20,6 +20,14 @@ set(MATLAB_LIB_FOLDERS
"${MATLAB_HOME}/extern/lib/win64/microsoft"
"${MATLAB_HOME}/bin/glnxa64"
)
# If there is a MATLAB_HOME environment variable then look there as well.
if (DEFINED ENV{MATLAB_HOME})
set(MATLAB_LIB_FOLDERS
"$ENV{MATLAB_HOME}/extern/lib/win64/microsoft"
"$ENV{MATLAB_HOME}/bin/glnxa64"
${MATLAB_LIB_FOLDERS}
)
endif()
# Find the MATLAB libraries that need to get linked into the mex file
if (WIN32)
find_library(MATLAB_MEX_LIBRARY libmex PATHS ${MATLAB_LIB_FOLDERS} )
...
...
@@ -31,14 +39,18 @@ else()
find_library(MATLAB_ENG_LIBRARY eng PATHS ${MATLAB_LIB_FOLDERS} )
endif()
set(MATLAB_LIBRARIES ${MATLAB_MEX_LIBRARY} ${MATLAB_MX_LIBRARY} ${MATLAB_ENG_LIBRARY})
INCLUDE_DIRECTORIES("${MATLAB_HOME}/extern/include")
# Figure out the path to MATLAB's mex.h so we can add it to the include search path.
find_path(mex_header_path mex.h
PATHS "$ENV{MATLAB_HOME}/extern/include"
"${MATLAB_HOME}/extern/include"
)
INCLUDE_DIRECTORIES(${mex_header_path})
# Determine the path to cmake_mex_wrapper file so we can add it to the include search path..
string(REGEX REPLACE "cmake_mex_wrapper$" "" dlib_matlab_binding_path ${CMAKE_CURRENT_LIST_FILE})
INCLUDE_DIRECTORIES("${dlib_matlab_binding_path}")
# Determine the path to dlib so we can add it to the include search path.
string(REGEX REPLACE "cmake_mex_wrapper$" "" dlib_path ${CMAKE_CURRENT_LIST_FILE})
INCLUDE_DIRECTORIES(${dlib_path}/../..)
# Also add dlib to the include search path
INCLUDE_DIRECTORIES(${dlib_matlab_binding_path}/../..)
ADD_DEFINITIONS(-DMATLAB_MEX_FILE)
...
...
dlib/opencv.h
View file @
c7813163
// Copyright (C) 2009 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifdef DLIB_ALL_SOURCE_END
#include "dlib_basic_cpp_build_tutorial.txt"
#endif
#ifndef DLIB_OPEnCV_HEADER
#define DLIB_OPEnCV_HEADER
...
...
dlib/platform.h
View file @
c7813163
// Copyright (C) 2006 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifdef DLIB_ALL_SOURCE_END
#include "dlib_basic_cpp_build_tutorial.txt"
#endif
#ifndef DLIB_PLATFORm_
#define DLIB_PLATFORm_
...
...
dlib/smart_pointers/shared_ptr.h
View file @
c7813163
...
...
@@ -10,6 +10,12 @@
#include "../algs.h"
#include "shared_ptr_abstract.h"
// Don't warn about the use of std::auto_ptr in this file. There is a pragma at the end of
// this file that re-enables the warning.
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
namespace
dlib
{
...
...
@@ -521,5 +527,9 @@ namespace dlib
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#endif // DLIB_SHARED_PTr_
dlib/smart_pointers/shared_ptr_thread_safe.h
View file @
c7813163
...
...
@@ -11,6 +11,13 @@
#include "shared_ptr_thread_safe_abstract.h"
#include "../threads/threads_kernel.h"
// Don't warn about the use of std::auto_ptr in this file. There is a pragma at the end of
// this file that re-enables the warning.
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
namespace
dlib
{
...
...
@@ -257,7 +264,6 @@ namespace dlib
}
}
template
<
typename
Y
>
explicit
shared_ptr_thread_safe
(
std
::
auto_ptr
<
Y
>&
r
...
...
@@ -491,6 +497,10 @@ namespace dlib
// ----------------------------------------------------------------------------------------
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}
#endif // DLIB_SHARED_THREAD_SAFE_PTr_
...
...
dlib/svm.h
View file @
c7813163
// Copyright (C) 2007 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifdef DLIB_ALL_SOURCE_END
#include "dlib_basic_cpp_build_tutorial.txt"
#endif
#ifndef DLIB_SVm_HEADER
#define DLIB_SVm_HEADER
...
...
dlib/svm_threaded.h
View file @
c7813163
// Copyright (C) 2008 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifdef DLIB_ALL_SOURCE_END
#include "dlib_basic_cpp_build_tutorial.txt"
#endif
#ifndef DLIB_SVm_THREADED_HEADER
#define DLIB_SVm_THREADED_HEADER
...
...
dlib/threads.h
View file @
c7813163
// Copyright (C) 2003 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifdef DLIB_ALL_SOURCE_END
#include "dlib_basic_cpp_build_tutorial.txt"
#endif
#ifndef DLIB_THREADs_
#define DLIB_THREADs_
...
...
dlib/vectorstream.h
View file @
c7813163
...
...
@@ -4,6 +4,7 @@
#define DLIB_VECTORSTReAMh_
#include "vectorstream/vectorstream.h"
#include "vectorstream/unserialize.h"
#endif // DLIB_VECTORSTReAMh_
...
...
dlib/vectorstream/unserialize.h
0 → 100644
View file @
c7813163
// Copyright (C) 2016 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_uNSERIALIZE_Hh_
#define DLIB_uNSERIALIZE_Hh_
#include "unserialize_abstract.h"
#include "../serialize.h"
#include "../algs.h"
#include "vectorstream.h"
namespace
dlib
{
class
unserialize
:
public
std
::
istream
{
class
mystreambuf
:
public
std
::
streambuf
{
typedef
std
::
vector
<
char
>::
size_type
size_type
;
size_type
read_pos
;
// buffer[read_pos] == next byte to read from buffer
public:
std
::
vector
<
char
>
buffer
;
std
::
istream
&
str
;
template
<
typename
T
>
mystreambuf
(
const
T
&
item
,
std
::
istream
&
str_
)
:
read_pos
(
0
),
str
(
str_
)
{
// put the item into our buffer.
vectorstream
vstr
(
buffer
);
serialize
(
item
,
vstr
);
}
// ------------------------ INPUT FUNCTIONS ------------------------
int_type
underflow
(
)
{
if
(
read_pos
<
buffer
.
size
())
return
static_cast
<
unsigned
char
>
(
buffer
[
read_pos
]);
else
return
str
.
peek
();
}
int_type
uflow
(
)
{
if
(
read_pos
<
buffer
.
size
())
return
static_cast
<
unsigned
char
>
(
buffer
[
read_pos
++
]);
else
return
str
.
get
();
}
std
::
streamsize
xsgetn
(
char
*
s
,
std
::
streamsize
n
)
{
if
(
read_pos
<
buffer
.
size
())
{
const
size_type
num
=
std
::
min
<
size_type
>
(
n
,
buffer
.
size
()
-
read_pos
);
std
::
memcpy
(
s
,
&
buffer
[
read_pos
],
num
);
read_pos
+=
num
;
return
num
;
}
else
{
return
str
.
rdbuf
()
->
sgetn
(
s
,
n
);
}
return
0
;
}
};
public:
template
<
typename
T
>
unserialize
(
const
T
&
item
,
std
::
istream
&
str
)
:
std
::
istream
(
&
buf
),
buf
(
item
,
str
)
{}
private:
mystreambuf
buf
;
};
}
#endif // DLIB_uNSERIALIZE_Hh_
Prev
1
2
Next
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