mirror of
https://github.com/karma-riuk/hdr_esim.git
synced 2025-07-02 08:58:14 +02:00
Added the possibility to get the hdr rgb images from a data provider.
For now only made it work with 'from_folder' and 'opengl_renderer'
This commit is contained in:
@ -1,4 +1,11 @@
|
||||
#include "esim/imp_multi_objects_2d/object.hpp"
|
||||
#include "opencv2/imgcodecs.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
#include "opencv2/imgproc/types_c.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <esim/data_provider/data_provider_from_folder.hpp>
|
||||
#include <iostream>
|
||||
#include <opencv2/imgcodecs/imgcodecs.hpp>
|
||||
#include <ze/cameras/camera_impl.hpp>
|
||||
#include <ze/common/file_utils.hpp>
|
||||
@ -40,6 +47,11 @@ namespace event_camera_simulator {
|
||||
sim_data_.images.emplace_back(ImagePtr(new Image(
|
||||
cv::Size(camera_rig_->at(0).width(), camera_rig_->at(0).height())
|
||||
)));
|
||||
sim_data_.images_rgb.emplace_back(ImageRGBPtr(new ImageRGB(
|
||||
camera_rig_->at(0).width(),
|
||||
camera_rig_->at(0).height(),
|
||||
CV_32FC3
|
||||
)));
|
||||
|
||||
sim_data_.camera_rig = camera_rig_;
|
||||
sim_data_.images_updated = true;
|
||||
@ -74,12 +86,17 @@ namespace event_camera_simulator {
|
||||
|
||||
const std::string& path_to_image =
|
||||
ze::joinPath(path_to_data_folder_, items[1]);
|
||||
cv::Mat image = cv::imread(path_to_image, 0);
|
||||
cv::Mat image = cv::imread(path_to_image);
|
||||
CHECK(image.data)
|
||||
<< "Could not load image from file: " << path_to_image;
|
||||
|
||||
VLOG(3) << "Read image from file: " << path_to_image;
|
||||
image.convertTo(
|
||||
image.copyTo(*sim_data_.images_rgb[0]);
|
||||
|
||||
cv::Mat image_gray = image;
|
||||
cv::cvtColor(image, image_gray, CV_BGR2GRAY);
|
||||
|
||||
image_gray.convertTo(
|
||||
*sim_data_.images[0],
|
||||
cv::DataType<ImageFloatType>::type,
|
||||
1. / 255.
|
||||
|
@ -103,11 +103,15 @@ namespace event_camera_simulator {
|
||||
);
|
||||
|
||||
sim_data_.images.emplace_back(ImagePtr(new Image(size)));
|
||||
sim_data_.images_rgb.emplace_back(
|
||||
ImageRGBPtr(new ImageRGB(size, CV_32FC3))
|
||||
);
|
||||
sim_data_.depthmaps.emplace_back(DepthmapPtr(new Depthmap(size)));
|
||||
sim_data_.optic_flows.emplace_back(OpticFlowPtr(new OpticFlow(size))
|
||||
);
|
||||
|
||||
sim_data_.images[i]->setTo(0);
|
||||
sim_data_.images_rgb[i]->setTo(0);
|
||||
sim_data_.depthmaps[i]->setTo(0);
|
||||
sim_data_.optic_flows[i]->setTo(0);
|
||||
}
|
||||
@ -241,6 +245,7 @@ namespace event_camera_simulator {
|
||||
sim_data_.groundtruth.linear_velocity_obj_,
|
||||
sim_data_.groundtruth.angular_velocity_obj_,
|
||||
sim_data_.images[i],
|
||||
sim_data_.images_rgb[i],
|
||||
sim_data_.depthmaps[i],
|
||||
sim_data_.optic_flows[i]
|
||||
);
|
||||
@ -249,6 +254,7 @@ namespace event_camera_simulator {
|
||||
sim_data_.groundtruth.T_W_B * camera_rig_->T_B_C(i),
|
||||
sim_data_.groundtruth.T_W_OBJ_,
|
||||
sim_data_.images[i],
|
||||
sim_data_.images_rgb[i],
|
||||
sim_data_.depthmaps[i]
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user