forked from ucla-vision/xivo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
94 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Type traits and TMP facilities. | ||
// Author: Xiaohan Fei ([email protected]) | ||
#include <type_traits> | ||
|
||
namespace xivo { | ||
// type traits utilities | ||
template <class T> | ||
using plain = typename std::remove_cv<typename std::remove_reference<T>::type>::type; | ||
|
||
} // namespace xivo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
// Author: Xiaohan Fei ([email protected]) | ||
#pragma once | ||
#include "alias.h" | ||
#include "traits.h" | ||
|
||
// stl | ||
#include <chrono> | ||
|
@@ -274,4 +275,37 @@ void WriteMatrixToFile(const std::string &filename, | |
ostream.close(); | ||
} | ||
|
||
namespace impl { | ||
|
||
// implementation details | ||
template <typename T> | ||
std::enable_if_t<std::is_same<plain<T>, std::string>::value, const char*> | ||
StrArgPass(T &arg) { | ||
// std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
return arg.c_str(); | ||
} | ||
|
||
template <typename T> | ||
std::enable_if_t<!std::is_same<plain<T>, std::string>::value, T> | ||
StrArgPass(T&& arg) { | ||
// std::cout << __PRETTY_FUNCTION__ << std::endl; | ||
return arg; | ||
} | ||
|
||
} // namespace impl | ||
|
||
|
||
constexpr int kStrBufSize = 512; | ||
template <typename... Args> | ||
std::string StrFormat(const char *format, Args... args) { | ||
char buf[kStrBufSize]; | ||
if (snprintf(&buf[0], kStrBufSize, format, impl::StrArgPass(args)...) < 0) { | ||
LOG(FATAL) << "failed to format string!!!"; | ||
} | ||
return buf; | ||
} | ||
|
||
std::vector<std::string> StrSplit(const std::string &str, char delimiter); | ||
|
||
|
||
} // namespace xivo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ | |
// Author: Xiaohan Fei ([email protected]) | ||
#include <fstream> | ||
|
||
#include "absl/strings/str_format.h" | ||
#include "absl/strings/str_join.h" | ||
#include "glog/logging.h" | ||
#include "opencv2/video/video.hpp" | ||
#include "opencv2/xfeatures2d.hpp" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.