mirror of
https://gitcode.com/gh_mirrors/ope/OpenFace.git
synced 2026-08-01 08:17:45 +00:00
Feature/opencv4 (#706)
* Travis OpenCV4 update, testing Ubuntu with new OpenCV * Fix to Ubuntu travis * Another attempt at OpenCV 4.0 for Ubuntu * And another OpenCV attempt. * Simplifying the travis script * Ubuntu OpenCV 4 support. * Updating to OpenCV 4, for x64 windows. * Fixes to move to OpenCV 4 on windows. * Travis fix for OpenCV 4 on OSX * Renaming a lib. * Travis opencv4 fix. * Building OpenCV4 versions using appveyor. * Attempt mac travis fix. * Small travis fix. * Travis fix attempt. * First iteration in boost removal and upgrade to C++17 * Test with ocv 4.0 * Moving filesystem out of stdafx * Some more boost testing with cmake. * More CMAKE options * More compiler flag changes * Another attempt at compiler options. * Another attempt. * More filesystem stuff. * Linking to filesystem. * Cmake fix with target linking. * Attempting travis with g++-8 * Attempting to setup g++8 on travis linux. * Another travis change. * Adding OpenBLAS to travis and removing g++-8 * Fixing typo * More travis experiments. * More travis debugging. * A small directory change. * Adding some more travis changes. * travis typo fix. * Some reordering of travis, for cleaner yml * Removing `using namespace std` in order to avoid clash with byte and to make the code more consistent. * Working towards removing std::filesystem requirement, allow boost::filesystem as well. * Making boost an optional dependency * Fixing std issue. * Fixing cmake issue. * Fixing the precompiled header issue. * Another cmake boost fix. * Including missing files. * Removing unnecessary includes. * Removing more includes. * Changes to appveyor build, proper removal of VS2015 * If boost is present, do not need to link to filesystem. * Removing un-needed link library. * oops * Mac attempt at opencv4 travis. * Upgrading OCV to 4.1 on VS2018 * Downloading OpenCV binaries through a script * Triger an appveyor build. * Upgrading VS version. * Attempting VS2017 build * Adding win-32 libraries for OpenCV 4.1 * Adding OpenCV 32 bit libraries.
This commit is contained in:
committed by
GitHub
parent
330383fef7
commit
9147dfe2f3
20
lib/3rdParty/OpenCV/include/opencv2/gapi/fluid/core.hpp
vendored
Normal file
20
lib/3rdParty/OpenCV/include/opencv2/gapi/fluid/core.hpp
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
//
|
||||
// Copyright (C) 2018 Intel Corporation
|
||||
|
||||
|
||||
#ifndef OPENCV_GAPI_FLUID_CORE_HPP
|
||||
#define OPENCV_GAPI_FLUID_CORE_HPP
|
||||
|
||||
#include <opencv2/gapi/gkernel.hpp> // GKernelPackage
|
||||
#include <opencv2/gapi/own/exports.hpp> // GAPI_EXPORTS
|
||||
|
||||
namespace cv { namespace gapi { namespace core { namespace fluid {
|
||||
|
||||
GAPI_EXPORTS GKernelPackage kernels();
|
||||
|
||||
}}}}
|
||||
|
||||
#endif // OPENCV_GAPI_FLUID_CORE_HPP
|
||||
154
lib/3rdParty/OpenCV/include/opencv2/gapi/fluid/gfluidbuffer.hpp
vendored
Normal file
154
lib/3rdParty/OpenCV/include/opencv2/gapi/fluid/gfluidbuffer.hpp
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
//
|
||||
// Copyright (C) 2018 Intel Corporation
|
||||
|
||||
|
||||
#ifndef OPENCV_GAPI_FLUID_BUFFER_HPP
|
||||
#define OPENCV_GAPI_FLUID_BUFFER_HPP
|
||||
|
||||
#include <list>
|
||||
#include <numeric> // accumulate
|
||||
#include <ostream> // ostream
|
||||
#include <cstdint> // uint8_t
|
||||
|
||||
#include <opencv2/gapi/opencv_includes.hpp>
|
||||
#include <opencv2/gapi/own/mat.hpp>
|
||||
#include <opencv2/gapi/gmat.hpp>
|
||||
|
||||
#include "opencv2/gapi/util/optional.hpp"
|
||||
#include "opencv2/gapi/own/scalar.hpp"
|
||||
#include "opencv2/gapi/own/mat.hpp"
|
||||
|
||||
namespace cv {
|
||||
namespace gapi {
|
||||
namespace fluid {
|
||||
|
||||
struct Border
|
||||
{
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
// This constructor is required to support existing kernels which are part of G-API
|
||||
Border(int _type, cv::Scalar _val) : type(_type), value(to_own(_val)) {};
|
||||
#endif // !defined(GAPI_STANDALONE)
|
||||
Border(int _type, cv::gapi::own::Scalar _val) : type(_type), value(_val) {};
|
||||
int type;
|
||||
cv::gapi::own::Scalar value;
|
||||
};
|
||||
|
||||
using BorderOpt = util::optional<Border>;
|
||||
|
||||
bool operator == (const Border& b1, const Border& b2);
|
||||
|
||||
class GAPI_EXPORTS Buffer;
|
||||
|
||||
class GAPI_EXPORTS View
|
||||
{
|
||||
public:
|
||||
struct Cache
|
||||
{
|
||||
std::vector<const uint8_t*> m_linePtrs;
|
||||
GMatDesc m_desc;
|
||||
int m_border_size = 0;
|
||||
|
||||
inline const uint8_t* linePtr(int index) const
|
||||
{
|
||||
// "out_of_window" check:
|
||||
// user must not request the lines which are outside of specified kernel window
|
||||
GAPI_DbgAssert(index >= -m_border_size
|
||||
&& index < -m_border_size + static_cast<int>(m_linePtrs.size()));
|
||||
return m_linePtrs[index + m_border_size];
|
||||
}
|
||||
};
|
||||
|
||||
View() = default;
|
||||
|
||||
const inline uint8_t* InLineB(int index) const // -(w-1)/2...0...+(w-1)/2 for Filters
|
||||
{
|
||||
return m_cache->linePtr(index);
|
||||
}
|
||||
|
||||
template<typename T> const inline T* InLine(int i) const
|
||||
{
|
||||
const uint8_t* ptr = this->InLineB(i);
|
||||
return reinterpret_cast<const T*>(ptr);
|
||||
}
|
||||
|
||||
inline operator bool() const { return m_priv != nullptr; }
|
||||
bool ready() const;
|
||||
inline int length() const { return m_cache->m_desc.size.width; }
|
||||
int y() const;
|
||||
|
||||
inline const GMatDesc& meta() const { return m_cache->m_desc; }
|
||||
|
||||
class GAPI_EXPORTS Priv; // internal use only
|
||||
Priv& priv(); // internal use only
|
||||
const Priv& priv() const; // internal use only
|
||||
|
||||
View(Priv* p);
|
||||
|
||||
private:
|
||||
std::shared_ptr<Priv> m_priv;
|
||||
const Cache* m_cache;
|
||||
};
|
||||
|
||||
class GAPI_EXPORTS Buffer
|
||||
{
|
||||
public:
|
||||
struct Cache
|
||||
{
|
||||
std::vector<uint8_t*> m_linePtrs;
|
||||
GMatDesc m_desc;
|
||||
};
|
||||
|
||||
// Default constructor (executable creation stage,
|
||||
// all following initialization performed in Priv::init())
|
||||
Buffer();
|
||||
// Scratch constructor (user kernels)
|
||||
Buffer(const cv::GMatDesc &desc);
|
||||
|
||||
// Constructor for intermediate buffers (for tests)
|
||||
Buffer(const cv::GMatDesc &desc,
|
||||
int max_line_consumption, int border_size,
|
||||
int skew,
|
||||
int wlpi,
|
||||
BorderOpt border);
|
||||
// Constructor for in/out buffers (for tests)
|
||||
Buffer(const cv::gapi::own::Mat &data, bool is_input);
|
||||
|
||||
inline uint8_t* OutLineB(int index = 0)
|
||||
{
|
||||
return m_cache->m_linePtrs[index];
|
||||
}
|
||||
|
||||
template<typename T> inline T* OutLine(int index = 0)
|
||||
{
|
||||
uint8_t* ptr = this->OutLineB(index);
|
||||
return reinterpret_cast<T*>(ptr);
|
||||
}
|
||||
|
||||
int y() const;
|
||||
|
||||
int linesReady() const;
|
||||
void debug(std::ostream &os) const;
|
||||
inline int length() const { return m_cache->m_desc.size.width; }
|
||||
int lpi() const; // LPI for WRITER
|
||||
|
||||
inline const GMatDesc& meta() const { return m_cache->m_desc; }
|
||||
|
||||
View mkView(int borderSize, bool ownStorage);
|
||||
|
||||
class GAPI_EXPORTS Priv; // internal use only
|
||||
Priv& priv(); // internal use only
|
||||
const Priv& priv() const; // internal use only
|
||||
|
||||
private:
|
||||
std::shared_ptr<Priv> m_priv;
|
||||
const Cache* m_cache;
|
||||
};
|
||||
|
||||
} // namespace cv::gapi::fluid
|
||||
} // namespace cv::gapi
|
||||
} // namespace cv
|
||||
|
||||
#endif // OPENCV_GAPI_FLUID_BUFFER_HPP
|
||||
303
lib/3rdParty/OpenCV/include/opencv2/gapi/fluid/gfluidkernel.hpp
vendored
Normal file
303
lib/3rdParty/OpenCV/include/opencv2/gapi/fluid/gfluidkernel.hpp
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
//
|
||||
// Copyright (C) 2018 Intel Corporation
|
||||
|
||||
|
||||
#ifndef OPENCV_GAPI_FLUID_KERNEL_HPP
|
||||
#define OPENCV_GAPI_FLUID_KERNEL_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <opencv2/gapi/opencv_includes.hpp>
|
||||
#include <opencv2/gapi/gcommon.hpp>
|
||||
#include <opencv2/gapi/gkernel.hpp>
|
||||
#include <opencv2/gapi/garg.hpp>
|
||||
#include <opencv2/gapi/own/types.hpp>
|
||||
|
||||
#include <opencv2/gapi/fluid/gfluidbuffer.hpp>
|
||||
|
||||
// FIXME: namespace scheme for backends?
|
||||
namespace cv {
|
||||
|
||||
namespace gapi
|
||||
{
|
||||
namespace fluid
|
||||
{
|
||||
/**
|
||||
* \addtogroup gapi_std_backends G-API Standard backends
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Get a reference to Fluid backend.
|
||||
*
|
||||
* @sa gapi_std_backends
|
||||
*/
|
||||
GAPI_EXPORTS cv::gapi::GBackend backend();
|
||||
/** @} */
|
||||
} // namespace flud
|
||||
} // namespace gapi
|
||||
|
||||
|
||||
class GAPI_EXPORTS GFluidKernel
|
||||
{
|
||||
public:
|
||||
enum class Kind
|
||||
{
|
||||
Filter,
|
||||
Resize,
|
||||
NV12toRGB
|
||||
};
|
||||
|
||||
// This function is a generic "doWork" callback
|
||||
using F = std::function<void(const cv::GArgs&, const std::vector<gapi::fluid::Buffer*> &)>;
|
||||
|
||||
// This function is a generic "initScratch" callback
|
||||
using IS = std::function<void(const cv::GMetaArgs &, const cv::GArgs&, gapi::fluid::Buffer &)>;
|
||||
|
||||
// This function is a generic "resetScratch" callback
|
||||
using RS = std::function<void(gapi::fluid::Buffer &)>;
|
||||
|
||||
// This function describes kernel metadata inference rule.
|
||||
using M = std::function<GMetaArgs(const GMetaArgs &, const GArgs &)>;
|
||||
|
||||
// This function is a generic "getBorder" callback (extracts border-related data from kernel's input parameters)
|
||||
using B = std::function<gapi::fluid::BorderOpt(const GMetaArgs&, const GArgs&)>;
|
||||
|
||||
// FIXME: move implementations out of header file
|
||||
GFluidKernel() {}
|
||||
GFluidKernel(int w, Kind k, int l, bool scratch, const F& f, const IS &is, const RS &rs, const B& b)
|
||||
: m_window(w)
|
||||
, m_kind(k)
|
||||
, m_lpi(l)
|
||||
, m_scratch(scratch)
|
||||
, m_f(f)
|
||||
, m_is(is)
|
||||
, m_rs(rs)
|
||||
, m_b(b) {}
|
||||
|
||||
int m_window = -1;
|
||||
Kind m_kind;
|
||||
const int m_lpi = -1;
|
||||
const bool m_scratch = false;
|
||||
|
||||
const F m_f;
|
||||
const IS m_is;
|
||||
const RS m_rs;
|
||||
const B m_b;
|
||||
};
|
||||
|
||||
// FIXME!!!
|
||||
// This is the temporary and experimental API
|
||||
// which should be replaced by runtime roi-based scheduling
|
||||
struct GFluidOutputRois
|
||||
{
|
||||
std::vector<cv::gapi::own::Rect> rois;
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<> struct CompileArgTag<GFluidOutputRois>
|
||||
{
|
||||
static const char* tag() { return "gapi.fluid.outputRois"; }
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<class T> struct fluid_get_in;
|
||||
template<> struct fluid_get_in<cv::GMat>
|
||||
{
|
||||
static const cv::gapi::fluid::View& get(const cv::GArgs &in_args, int idx)
|
||||
{
|
||||
return in_args[idx].unsafe_get<cv::gapi::fluid::View>();
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct fluid_get_in<cv::GScalar>
|
||||
{
|
||||
// FIXME: change to return by reference when moved to own::Scalar
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
static const cv::Scalar get(const cv::GArgs &in_args, int idx)
|
||||
{
|
||||
return cv::gapi::own::to_ocv(in_args[idx].unsafe_get<cv::gapi::own::Scalar>());
|
||||
}
|
||||
#else
|
||||
static const cv::gapi::own::Scalar get(const cv::GArgs &in_args, int idx)
|
||||
{
|
||||
return in_args[idx].get<cv::gapi::own::Scalar>();
|
||||
}
|
||||
#endif // !defined(GAPI_STANDALONE)
|
||||
};
|
||||
template<class T> struct fluid_get_in
|
||||
{
|
||||
static const T& get(const cv::GArgs &in_args, int idx)
|
||||
{
|
||||
return in_args[idx].unsafe_get<T>();
|
||||
}
|
||||
};
|
||||
|
||||
template<bool, typename Impl, typename... Ins>
|
||||
struct scratch_helper;
|
||||
|
||||
template<typename Impl, typename... Ins>
|
||||
struct scratch_helper<true, Impl, Ins...>
|
||||
{
|
||||
// Init
|
||||
template<int... IIs>
|
||||
static void help_init_impl(const cv::GMetaArgs &metas,
|
||||
const cv::GArgs &in_args,
|
||||
gapi::fluid::Buffer &scratch_buf,
|
||||
detail::Seq<IIs...>)
|
||||
{
|
||||
Impl::initScratch(get_in_meta<Ins>(metas, in_args, IIs)..., scratch_buf);
|
||||
}
|
||||
|
||||
static void help_init(const cv::GMetaArgs &metas,
|
||||
const cv::GArgs &in_args,
|
||||
gapi::fluid::Buffer &b)
|
||||
{
|
||||
help_init_impl(metas, in_args, b, typename detail::MkSeq<sizeof...(Ins)>::type());
|
||||
}
|
||||
|
||||
// Reset
|
||||
static void help_reset(gapi::fluid::Buffer &b)
|
||||
{
|
||||
Impl::resetScratch(b);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Impl, typename... Ins>
|
||||
struct scratch_helper<false, Impl, Ins...>
|
||||
{
|
||||
static void help_init(const cv::GMetaArgs &,
|
||||
const cv::GArgs &,
|
||||
gapi::fluid::Buffer &)
|
||||
{
|
||||
GAPI_Assert(false);
|
||||
}
|
||||
static void help_reset(gapi::fluid::Buffer &)
|
||||
{
|
||||
GAPI_Assert(false);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> struct is_gmat_type
|
||||
{
|
||||
static const constexpr bool value = std::is_same<cv::GMat, T>::value;
|
||||
};
|
||||
|
||||
template<bool CallCustomGetBorder, typename Impl, typename... Ins>
|
||||
struct get_border_helper;
|
||||
|
||||
template<typename Impl, typename... Ins>
|
||||
struct get_border_helper<true, Impl, Ins...>
|
||||
{
|
||||
template<int... IIs>
|
||||
static gapi::fluid::BorderOpt get_border_impl(const GMetaArgs &metas,
|
||||
const cv::GArgs &in_args,
|
||||
cv::detail::Seq<IIs...>)
|
||||
{
|
||||
return util::make_optional(Impl::getBorder(cv::detail::get_in_meta<Ins>(metas, in_args, IIs)...));
|
||||
}
|
||||
|
||||
static gapi::fluid::BorderOpt help(const GMetaArgs &metas,
|
||||
const cv::GArgs &in_args)
|
||||
{
|
||||
return get_border_impl(metas, in_args, typename detail::MkSeq<sizeof...(Ins)>::type());
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Impl, typename... Ins>
|
||||
struct get_border_helper<false, Impl, Ins...>
|
||||
{
|
||||
static gapi::fluid::BorderOpt help(const cv::GMetaArgs &,
|
||||
const cv::GArgs &)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
template<typename, typename, typename, bool UseScratch>
|
||||
struct FluidCallHelper;
|
||||
|
||||
template<typename Impl, typename... Ins, typename... Outs, bool UseScratch>
|
||||
struct FluidCallHelper<Impl, std::tuple<Ins...>, std::tuple<Outs...>, UseScratch>
|
||||
{
|
||||
static_assert(all_satisfy<is_gmat_type, Outs...>::value, "return type must be GMat");
|
||||
|
||||
// Execution dispatcher ////////////////////////////////////////////////////
|
||||
template<int... IIs, int... OIs>
|
||||
static void call_impl(const cv::GArgs &in_args,
|
||||
const std::vector<gapi::fluid::Buffer*> &out_bufs,
|
||||
detail::Seq<IIs...>,
|
||||
detail::Seq<OIs...>)
|
||||
{
|
||||
Impl::run(fluid_get_in<Ins>::get(in_args, IIs)..., *out_bufs[OIs]...);
|
||||
}
|
||||
|
||||
static void call(const cv::GArgs &in_args,
|
||||
const std::vector<gapi::fluid::Buffer*> &out_bufs)
|
||||
{
|
||||
constexpr int numOuts = (sizeof...(Outs)) + (UseScratch ? 1 : 0);
|
||||
call_impl(in_args, out_bufs,
|
||||
typename detail::MkSeq<sizeof...(Ins)>::type(),
|
||||
typename detail::MkSeq<numOuts>::type());
|
||||
}
|
||||
|
||||
// Scratch buffer initialization dispatcher ////////////////////////////////
|
||||
static void init_scratch(const GMetaArgs &metas,
|
||||
const cv::GArgs &in_args,
|
||||
gapi::fluid::Buffer &b)
|
||||
{
|
||||
scratch_helper<UseScratch, Impl, Ins...>::help_init(metas, in_args, b);
|
||||
}
|
||||
|
||||
// Scratch buffer reset dispatcher /////////////////////////////////////////
|
||||
static void reset_scratch(gapi::fluid::Buffer &scratch_buf)
|
||||
{
|
||||
scratch_helper<UseScratch, Impl, Ins...>::help_reset(scratch_buf);
|
||||
}
|
||||
|
||||
static gapi::fluid::BorderOpt getBorder(const GMetaArgs &metas, const cv::GArgs &in_args)
|
||||
{
|
||||
// User must provide "init" callback if Window != 1
|
||||
// TODO: move to constexpr if when we enable C++17
|
||||
constexpr bool callCustomGetBorder = (Impl::Window != 1);
|
||||
return get_border_helper<callCustomGetBorder, Impl, Ins...>::help(metas, in_args);
|
||||
}
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
|
||||
template<class Impl, class K, bool UseScratch>
|
||||
class GFluidKernelImpl
|
||||
{
|
||||
static const int LPI = 1;
|
||||
static const auto Kind = GFluidKernel::Kind::Filter;
|
||||
using P = detail::FluidCallHelper<Impl, typename K::InArgs, typename K::OutArgs, UseScratch>;
|
||||
|
||||
public:
|
||||
using API = K;
|
||||
|
||||
static GFluidKernel kernel()
|
||||
{
|
||||
// FIXME: call() and getOutMeta() needs to be renamed so it is clear these
|
||||
// functions are internal wrappers, not user API
|
||||
return GFluidKernel(Impl::Window, Impl::Kind, Impl::LPI,
|
||||
UseScratch,
|
||||
&P::call, &P::init_scratch, &P::reset_scratch, &P::getBorder);
|
||||
}
|
||||
|
||||
static cv::gapi::GBackend backend() { return cv::gapi::fluid::backend(); }
|
||||
};
|
||||
|
||||
#define GAPI_FLUID_KERNEL(Name, API, Scratch) struct Name: public cv::GFluidKernelImpl<Name, API, Scratch>
|
||||
|
||||
} // namespace cv
|
||||
|
||||
#endif // OPENCV_GAPI_GCPUKERNEL_HPP
|
||||
20
lib/3rdParty/OpenCV/include/opencv2/gapi/fluid/imgproc.hpp
vendored
Normal file
20
lib/3rdParty/OpenCV/include/opencv2/gapi/fluid/imgproc.hpp
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
//
|
||||
// Copyright (C) 2018 Intel Corporation
|
||||
|
||||
|
||||
#ifndef OPENCV_GAPI_FLUID_IMGPROC_HPP
|
||||
#define OPENCV_GAPI_FLUID_IMGPROC_HPP
|
||||
|
||||
#include <opencv2/gapi/gkernel.hpp> // GKernelPackage
|
||||
#include <opencv2/gapi/own/exports.hpp> // GAPI_EXPORTS
|
||||
|
||||
namespace cv { namespace gapi { namespace imgproc { namespace fluid {
|
||||
|
||||
GAPI_EXPORTS GKernelPackage kernels();
|
||||
|
||||
}}}}
|
||||
|
||||
#endif // OPENCV_GAPI_FLUID_IMGPROC_HPP
|
||||
Reference in New Issue
Block a user