mirror of
https://gitcode.com/gh_mirrors/ope/OpenFace.git
synced 2026-07-28 15:07:46 +00:00
* 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.
167 lines
4.4 KiB
C++
167 lines
4.4 KiB
C++
// 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_GCOMMON_HPP
|
|
#define OPENCV_GAPI_GCOMMON_HPP
|
|
|
|
#include <functional> // std::hash
|
|
#include <vector> // std::vector
|
|
#include <type_traits> // decay
|
|
|
|
#include <opencv2/gapi/opencv_includes.hpp>
|
|
|
|
#include "opencv2/gapi/util/any.hpp"
|
|
#include "opencv2/gapi/own/exports.hpp"
|
|
#include "opencv2/gapi/own/assert.hpp"
|
|
|
|
namespace cv {
|
|
|
|
namespace detail
|
|
{
|
|
// This is a trait-like structure to mark backend-specific compile arguments
|
|
// with tags
|
|
template<typename T> struct CompileArgTag;
|
|
template<typename T> struct CompileArgTag
|
|
{
|
|
static const char* tag() { return ""; };
|
|
};
|
|
}
|
|
|
|
// This definition is here because it is reused by both public(?) and internal
|
|
// modules. Keeping it here wouldn't expose public details (e.g., API-level)
|
|
// to components which are internal and operate on a lower-level entities
|
|
// (e.g., compiler, backends).
|
|
// FIXME: merge with ArgKind?
|
|
// FIXME: replace with variant[format desc]?
|
|
enum class GShape: int
|
|
{
|
|
GMAT,
|
|
GSCALAR,
|
|
GARRAY,
|
|
};
|
|
|
|
struct GCompileArg;
|
|
|
|
namespace detail {
|
|
template<typename T>
|
|
using is_compile_arg = std::is_same<GCompileArg, typename std::decay<T>::type>;
|
|
}
|
|
// CompileArg is an unified interface over backend-specific compilation
|
|
// information
|
|
// FIXME: Move to a separate file?
|
|
/** \addtogroup gapi_compile_args
|
|
* @{
|
|
*
|
|
* @brief Compilation arguments: a set of data structures which can be
|
|
* passed to control compilation process
|
|
*
|
|
* G-API comes with a number of graph compilation options which can be
|
|
* passed to cv::GComputation::apply() or
|
|
* cv::GComputation::compile(). Known compilation options are listed
|
|
* in this page, while extra backends may introduce their own
|
|
* compilation options (G-API transparently accepts _everything_ which
|
|
* can be passed to cv::compile_args(), it depends on underlying
|
|
* backends if an option would be interpreted or not).
|
|
*
|
|
* For example, if an example computation is executed like this:
|
|
*
|
|
* @snippet modules/gapi/samples/api_ref_snippets.cpp graph_decl_apply
|
|
*
|
|
* Extra parameter specifying which kernels to compile with can be
|
|
* passed like this:
|
|
*
|
|
* @snippet modules/gapi/samples/api_ref_snippets.cpp apply_with_param
|
|
*/
|
|
|
|
/**
|
|
* @brief Represents an arbitrary compilation argument.
|
|
*
|
|
* Any value can be wrapped into cv::GCompileArg, but only known ones
|
|
* (to G-API or its backends) can be interpreted correctly.
|
|
*
|
|
* Normally objects of this class shouldn't be created manually, use
|
|
* cv::compile_args() function which automatically wraps everything
|
|
* passed in (a variadic template parameter pack) into a vector of
|
|
* cv::GCompileArg objects.
|
|
*/
|
|
struct GAPI_EXPORTS GCompileArg
|
|
{
|
|
public:
|
|
std::string tag;
|
|
|
|
// FIXME: use decay in GArg/other trait-based wrapper before leg is shot!
|
|
template<typename T, typename std::enable_if<!detail::is_compile_arg<T>::value, int>::type = 0>
|
|
explicit GCompileArg(T &&t)
|
|
: tag(detail::CompileArgTag<typename std::decay<T>::type>::tag())
|
|
, arg(t)
|
|
{
|
|
}
|
|
|
|
template<typename T> T& get()
|
|
{
|
|
return util::any_cast<T>(arg);
|
|
}
|
|
|
|
template<typename T> const T& get() const
|
|
{
|
|
return util::any_cast<T>(arg);
|
|
}
|
|
|
|
private:
|
|
util::any arg;
|
|
};
|
|
|
|
using GCompileArgs = std::vector<GCompileArg>;
|
|
|
|
/**
|
|
* Wraps a list of arguments (a parameter pack) into a vector of
|
|
* compilation arguments (cv::GCompileArg).
|
|
*/
|
|
template<typename... Ts> GCompileArgs compile_args(Ts&&... args)
|
|
{
|
|
return GCompileArgs{ GCompileArg(args)... };
|
|
}
|
|
|
|
/**
|
|
* @brief Ask G-API to dump compiled graph in Graphviz format under
|
|
* the given file name.
|
|
*
|
|
* Specifies a graph dump path (path to .dot file to be generated).
|
|
* G-API will dump a .dot file under specified path during a
|
|
* compilation process if this flag is passed.
|
|
*/
|
|
struct graph_dump_path
|
|
{
|
|
std::string m_dump_path;
|
|
};
|
|
/** @} */
|
|
|
|
namespace detail
|
|
{
|
|
template<> struct CompileArgTag<cv::graph_dump_path>
|
|
{
|
|
static const char* tag() { return "gapi.graph_dump_path"; }
|
|
};
|
|
}
|
|
|
|
} // namespace cv
|
|
|
|
// std::hash overload for GShape
|
|
namespace std
|
|
{
|
|
template<> struct hash<cv::GShape>
|
|
{
|
|
size_t operator() (cv::GShape sh) const
|
|
{
|
|
return std::hash<int>()(static_cast<int>(sh));
|
|
}
|
|
};
|
|
} // namespace std
|
|
|
|
|
|
#endif // OPENCV_GAPI_GCOMMON_HPP
|