Add miniglog

This commit is contained in:
Kalman
2018-11-16 16:30:13 +08:00
parent 8331b8415d
commit 2096f93a92
80 changed files with 1948 additions and 313 deletions

View File

@@ -43,10 +43,6 @@ message(STATUS "CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
# packages
LIST(APPEND CMAKE_PREFIX_PATH ${PRO_DIR}/third_party/glog/_build)
find_package(glog REQUIRED)
message(STATUS "Found glog: ${glog_VERSION}")
LIST(APPEND CMAKE_PREFIX_PATH ${PRO_DIR}/_install/lib/cmake)
find_package(mynteye REQUIRED)
message(STATUS "Found mynteye: ${mynteye_VERSION}")

View File

@@ -14,7 +14,6 @@
#include "dataset/dataset.h"
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <glog/logging.h>
#include <iomanip>
#include <limits>
@@ -22,6 +21,7 @@
#include <utility>
#include "mynteye/files.h"
#include "mynteye/logger.h"
#define FULL_PRECISION \
std::fixed << std::setprecision(std::numeric_limits<double>::max_digits10)
@@ -62,7 +62,7 @@ void Dataset::SaveStreamData(
<< std::endl;
if (data.frame) {
std::stringstream ss;
ss << writer->outdir << OS_SEP << std::dec
ss << writer->outdir << MYNTEYE_OS_SEP << std::dec
<< std::setw(IMAGE_FILENAME_WIDTH) << std::setfill('0') << seq << ".png";
if (data.frame->format() == Format::GREY) {
cv::Mat img(
@@ -120,15 +120,15 @@ Dataset::writer_t Dataset::GetStreamWriter(const Stream &stream) {
writer_t writer = std::make_shared<Writer>();
switch (stream) {
case Stream::LEFT: {
writer->outdir = outdir_ + OS_SEP "left";
writer->outdir = outdir_ + MYNTEYE_OS_SEP "left";
} break;
case Stream::RIGHT: {
writer->outdir = outdir_ + OS_SEP "right";
writer->outdir = outdir_ + MYNTEYE_OS_SEP "right";
} break;
default:
LOG(FATAL) << "Unsupported stream: " << stream;
}
writer->outfile = writer->outdir + OS_SEP "stream.txt";
writer->outfile = writer->outdir + MYNTEYE_OS_SEP "stream.txt";
files::mkdir(writer->outdir);
writer->ofs.open(writer->outfile, std::ofstream::out);
@@ -145,7 +145,7 @@ Dataset::writer_t Dataset::GetMotionWriter() {
if (motion_writer_ == nullptr) {
writer_t writer = std::make_shared<Writer>();
writer->outdir = outdir_;
writer->outfile = writer->outdir + OS_SEP "motion.txt";
writer->outfile = writer->outdir + MYNTEYE_OS_SEP "motion.txt";
files::mkdir(writer->outdir);
writer->ofs.open(writer->outfile, std::ofstream::out);

View File

@@ -15,14 +15,13 @@
#include <opencv2/core/core.hpp>
#include <glog/logging.h>
#include <map>
#include <vector>
#include "mynteye/device.h"
#include "mynteye/files.h"
#include "mynteye/types.h"
#include "mynteye/logger.h"
#include "internal/types.h"
@@ -230,16 +229,16 @@ void DeviceWriter::SaveAllInfos(const std::string &dir) {
if (!files::mkdir(dir)) {
LOG(FATAL) << "Create directory failed: " << dir;
}
SaveDeviceInfo(*device_->GetInfo(), dir + OS_SEP "device.info");
SaveDeviceInfo(*device_->GetInfo(), dir + MYNTEYE_OS_SEP "device.info");
SaveImgParams(
*device_->GetInfo(), device_->GetImgParams(), dir + OS_SEP "img.params");
*device_->GetInfo(), device_->GetImgParams(), dir + MYNTEYE_OS_SEP "img.params");
auto &&m_in = device_->GetMotionIntrinsics();
SaveImuParams(
{
false, m_in.accel, m_in.gyro,
device_->GetMotionExtrinsics(Stream::LEFT),
},
dir + OS_SEP "imu.params");
dir + MYNTEYE_OS_SEP "imu.params");
}
namespace {

View File

@@ -32,7 +32,7 @@ int main(int argc, char *argv[]) {
if (!device)
return 1;
dir.append(OS_SEP "SN").append(device->GetInfo()->serial_number);
dir.append(MYNTEYE_OS_SEP "SN").append(device->GetInfo()->serial_number);
tools::DeviceWriter writer(device);
writer.SaveAllInfos(dir);