mirror of
https://github.com/karma-riuk/hdr_esim.git
synced 2024-11-23 14:47:50 +01:00
Found a way to unify the hdr_output_folder so that it's set across both
the publisher and the camera_simulator with just the flag
This commit is contained in:
parent
30950151dd
commit
e27602488d
@ -1,16 +1,14 @@
|
|||||||
#include "opencv2/imgcodecs.hpp"
|
#include "opencv2/imgcodecs.hpp"
|
||||||
|
|
||||||
|
#include <esim/common/hdr.hpp>
|
||||||
#include <esim/esim/camera_simulator.hpp>
|
#include <esim/esim/camera_simulator.hpp>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <ze/common/file_utils.hpp>
|
#include <ze/common/file_utils.hpp>
|
||||||
|
|
||||||
#define FRAME_DIR_PATH "/home/arno/sim_ws/out/frames"
|
|
||||||
|
|
||||||
static uint frame_number = 0;
|
static uint frame_number = 0;
|
||||||
static std::ofstream exposures_file_;
|
static std::ofstream exposures_file_;
|
||||||
static std::string output_folder = "/home/arno/sim_ws/out";
|
|
||||||
|
|
||||||
namespace event_camera_simulator {
|
namespace event_camera_simulator {
|
||||||
|
|
||||||
@ -69,7 +67,7 @@ namespace event_camera_simulator {
|
|||||||
static uint frame_number = 0;
|
static uint frame_number = 0;
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << output_folder << "/frames/frame_" << std::setfill('0')
|
ss << hdr_output_folder << "/frames/frame_" << std::setfill('0')
|
||||||
<< std::setw(5) << frame_number++ << ".exr";
|
<< std::setw(5) << frame_number++ << ".exr";
|
||||||
std::string frame_path = ss.str();
|
std::string frame_path = ss.str();
|
||||||
cv::imwrite(frame_path, *camera_image);
|
cv::imwrite(frame_path, *camera_image);
|
||||||
@ -80,7 +78,7 @@ namespace event_camera_simulator {
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
exposures_file_.open(
|
exposures_file_.open(
|
||||||
ze::joinPath(output_folder, "exposures.csv"),
|
ze::joinPath(hdr_output_folder, "exposures.csv"),
|
||||||
std::ios::app
|
std::ios::app
|
||||||
);
|
);
|
||||||
exposures_file_ << time << "," << frame_number << ","
|
exposures_file_ << time << "," << frame_number << ","
|
||||||
|
@ -9,10 +9,12 @@ catkin_simple()
|
|||||||
set(HEADERS
|
set(HEADERS
|
||||||
include/esim/common/types.hpp
|
include/esim/common/types.hpp
|
||||||
include/esim/common/utils.hpp
|
include/esim/common/utils.hpp
|
||||||
|
include/esim/common/hdr.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
src/utils.cpp
|
src/utils.cpp
|
||||||
|
src/hdr.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
cs_add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS})
|
cs_add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS})
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <gflags/gflags.h>
|
||||||
|
|
||||||
|
extern std::string hdr_output_folder;
|
9
event_camera_simulator/esim_common/src/hdr.cpp
Normal file
9
event_camera_simulator/esim_common/src/hdr.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include "esim/common/hdr.hpp"
|
||||||
|
|
||||||
|
DEFINE_string(
|
||||||
|
hdr_output_folder,
|
||||||
|
"/home/arno/sim_ws/out",
|
||||||
|
"Folder in which to output the events."
|
||||||
|
);
|
||||||
|
|
||||||
|
std::string hdr_output_folder = FLAGS_hdr_output_folder;
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
--path_to_output_bag=/tmp/out.bag
|
--path_to_output_bag=/tmp/out.bag
|
||||||
--path_to_data_folder=/tmp/tests/frames
|
--path_to_data_folder=/tmp/tests/frames
|
||||||
|
--hdr_output_folder=/home/arno/sim_ws/out
|
||||||
|
|
||||||
--ros_publisher_frame_rate=60
|
--ros_publisher_frame_rate=60
|
||||||
--exposure_time_ms=10.0
|
--exposure_time_ms=10.0
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "esim/common/types.hpp"
|
#include "esim/common/types.hpp"
|
||||||
#include "kindr/minimal/rotation-quaternion.h"
|
#include "kindr/minimal/rotation-quaternion.h"
|
||||||
|
|
||||||
|
#include <esim/common/hdr.hpp>
|
||||||
#include <esim/common/utils.hpp>
|
#include <esim/common/utils.hpp>
|
||||||
#include <esim/visualization/hdr_publisher.hpp>
|
#include <esim/visualization/hdr_publisher.hpp>
|
||||||
#include <gflags/gflags.h>
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <opencv2/highgui/highgui.hpp>
|
#include <opencv2/highgui/highgui.hpp>
|
||||||
@ -12,12 +12,6 @@
|
|||||||
#include <ze/common/path_utils.hpp>
|
#include <ze/common/path_utils.hpp>
|
||||||
#include <ze/common/time_conversions.hpp>
|
#include <ze/common/time_conversions.hpp>
|
||||||
|
|
||||||
DEFINE_string(
|
|
||||||
hdr_output_folder,
|
|
||||||
"/home/arno/sim_ws/out",
|
|
||||||
"Folder in which to output the events."
|
|
||||||
);
|
|
||||||
|
|
||||||
namespace event_camera_simulator {
|
namespace event_camera_simulator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,13 +74,13 @@ namespace event_camera_simulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Publisher::Ptr HdrPublisher::createFromGflags() {
|
Publisher::Ptr HdrPublisher::createFromGflags() {
|
||||||
if (FLAGS_hdr_output_folder == "") {
|
if (hdr_output_folder == "") {
|
||||||
LOG(WARNING) << "Empty output folder string: will not write "
|
LOG(WARNING) << "Empty output folder string: will not write "
|
||||||
"hdr files";
|
"hdr files";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::make_shared<HdrPublisher>(FLAGS_hdr_output_folder);
|
return std::make_shared<HdrPublisher>(hdr_output_folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
HdrPublisher::~HdrPublisher() {
|
HdrPublisher::~HdrPublisher() {
|
||||||
|
Loading…
Reference in New Issue
Block a user