Commit c7813163 authored by Davis King's avatar Davis King

merged

parents a9e1c9e4 27274c17
......@@ -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. ***")
......
// 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_
......
......@@ -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_
// 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_
......
#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
*/
// 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_
......
// 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_
......
......@@ -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
{
......
// 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_
......
// 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_
......
......@@ -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)
......
// 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
......
// 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_
......
......@@ -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_
......@@ -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_
......
// 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
......
// 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
......
// 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_
......
......@@ -4,6 +4,7 @@
#define DLIB_VECTORSTReAMh_
#include "vectorstream/vectorstream.h"
#include "vectorstream/unserialize.h"
#endif // DLIB_VECTORSTReAMh_
......
// 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_
// Copyright (C) 2016 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#undef DLIB_uNSERIALIZE_ABSTRACT_Hh_
#ifdef DLIB_uNSERIALIZE_ABSTRACT_Hh_
#include "../serialize.h"
#include <iostream>
namespace dlib
{
class unserialize : public std::iostream
{
/*!
WHAT THIS OBJECT REPRESENTS
This is a tool that allows you to effectively put an object you just
deserialized from a stream back into the stream. Its use is best
illustrated via an example.
void example(std::istream& in)
{
// Suppose that in contains serialized copies of three "some_type"
// objects. You could read them as follows:
some_type obj1, obj2, obj3;
deserialize(obj1, in); // reads obj1 from stream.
deserialize(obj2, in); // reads obj2 from stream.
unserialize in2(obj2, in); // make the in2 stream that has obj2 at its front.
deserialize(obj2, in2); // reads obj2 from stream again.
deserialize(obj3, in2); // reads obj3 from stream.
}
The reason unserialize is useful is because it allows you to peek at the
next object in a stream and potentially do something different based on
what object is coming next, but still allowing subsequent deserialize()
statements to be undisturbed by the fact that you peeked at the data.
!*/
public:
template <typename T>
unserialize (
const T& item,
std::istream& in
);
/*!
requires
- T must be serializable
ensures
- The bytes in this stream begin with a serialized copy of item followed
immediately by the bytes in the given istream.
!*/
};
}
#endif // DLIB_uNSERIALIZE_ABSTRACT_Hh_
......@@ -58,6 +58,7 @@
<item>rand</item>
<item>median</item>
<item>running_stats</item>
<item>running_gradient</item>
<item>running_scalar_covariance</item>
<item>mean_sign_agreement</item>
<item>correlation</item>
......@@ -475,6 +476,20 @@
</component>
<!-- ************************************************************************* -->
<component cpp11="true">
<name>running_gradient</name>
<file>dlib/statistics/running_gradient.h</file>
<spec_file link="true">dlib/statistics/running_gradient_abstract.h</spec_file>
<description>
This object is a tool for estimating if a noisy sequence of numbers is
trending up or down and by how much. It does this by finding the least
squares fit of a line to the data and then allows you to perform a
statistical test on the slope of that line.
</description>
</component>
<!-- ************************************************************************* -->
<component>
......
......@@ -65,7 +65,7 @@ tell CMake which one you want it to use via the -G option.
<p>
In most cases, to use this library all you have to do is extract it somewhere, make
sure the folder <i>containing</i> the dlib folder is in your include path, and
finally add <a href="dlib/all/source.cpp.html">dlib/all/source.cpp</a> to your
finally add dlib/all/source.cpp to your
project. It is worth noting that most of dlib is "header-only" which means that, in
many cases, you don't actually have to build dlib/all/source.cpp into your
application. So if you don't get linker errors when you exclude dlib/all/source.cpp
......
......@@ -105,6 +105,14 @@ ul.tree li ul { margin-left:10px; padding:0px; }
li#term { list-style: none; }
span.cpp11
{
color: #008000;
font-family: sans-serif;
font-size: 0.8em;
margin-left: 0.3em;
}
div.include_file_more_details_wrapper
{
margin-top: 1em;
......
......@@ -34,6 +34,7 @@
<item>timeout</item>
<item>member_function_pointer</item>
<item>vectorstream</item>
<item>unserialize</item>
<item>bound_function_pointer</item>
<item>error</item>
<item>console_progress_indicator</item>
......@@ -403,6 +404,20 @@
</component>
<!-- ************************************************************************* -->
<component>
<name>unserialize</name>
<file>dlib/vectorstream.h</file>
<spec_file>dlib/vectorstream/unserialize_abstract.h</spec_file>
<description>
This object effectively allows you to peek at the next serialized
object in an istream. It does this by allowing you to read an object
and then put it back.
</description>
</component>
<!-- ************************************************************************* -->
<component>
......
......@@ -11,6 +11,19 @@
<!-- ************************************************************************************** -->
<current>
New Features:
Non-Backwards Compatible Changes:
Bug fixes:
Other:
</current>
<!-- ************************************************************************************** -->
<old name="18.18" date="Oct 28, 2015">
New Features:
- Added the set_ptrm() routine for assigning dlib::matrix objects to arbitrary
memory blocks.
......@@ -30,8 +43,7 @@ Other:
install target. Now dlib can be installed system wide by executing
'cmake PATH_TO_DLIB; make install'. This also includes installing the
appropriate scripts for CMake's find_package(dlib) to work.
</current>
</old>
<!-- ************************************************************************************** -->
......
......@@ -327,7 +327,8 @@
<div class="component" >
<a href="#top"><font size='2'><center>[top]</center></font></a>
<h1 style="margin:0px;"><xsl:value-of select="name"/></h1>
<h1 style="margin:0px;"><xsl:value-of select="name"/> <xsl:if test="@cpp11 = 'true'"><span class='cpp11'>(C++11)</span></xsl:if>
</h1>
<BR/>
<BR/>
<xsl:apply-templates select="description"/>
......
......@@ -257,6 +257,7 @@
<term file="linear_algebra.html" name="find_projective_transform" include="dlib/geometry.h"/>
<term file="linear_algebra.html" name="rotation_matrix" include="dlib/geometry.h"/>
<term file="algorithms.html" name="running_stats" include="dlib/statistics.h"/>
<term file="algorithms.html" name="running_gradient" include="dlib/statistics/running_gradient.h"/>
<term file="algorithms.html" name="running_scalar_covariance" include="dlib/statistics.h"/>
<term file="algorithms.html" name="mean_sign_agreement" include="dlib/statistics.h"/>
<term file="algorithms.html" name="correlation" include="dlib/statistics.h"/>
......@@ -1431,6 +1432,7 @@
<term link="other.html#dlib_testing_suite" name="unit testing"/>
<term file="other.html" name="logger" include="dlib/logger.h"/>
<term file="other.html" name="vectorstream" include="dlib/vectorstream.h"/>
<term file="other.html" name="unserialize" include="dlib/vectorstream.h"/>
<term file="other.html" name="member_function_pointer" include="dlib/member_function_pointer.h"/>
<term file="other.html" name="make_mfp" include="dlib/member_function_pointer.h"/>
<term file="other.html" name="bound_function_pointer" include="dlib/bound_function_pointer.h"/>
......
......@@ -265,7 +265,8 @@ def enqueue_output(out, queue):
def _log_buf(buf):
if not buf:
return
buf = buf.decode("latin-1")
if sys.stdout.encoding:
buf = buf.decode(sys.stdout.encoding)
buf = buf.rstrip()
lines = buf.splitlines()
for line in lines:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment