mirror of
https://github.com/karma-riuk/hdr_esim.git
synced 2024-11-16 11:20:25 +01:00
Do not publish corrupted images when timestamp < exposure_time (#17)
This commit is contained in:
parent
1241667c33
commit
73cecac7d1
@ -42,6 +42,7 @@ public:
|
|||||||
|
|
||||||
void publishData(const SimulatorData &sim_data,
|
void publishData(const SimulatorData &sim_data,
|
||||||
const EventsVector &events,
|
const EventsVector &events,
|
||||||
|
bool camera_simulator_success,
|
||||||
const ImagePtrVector &camera_images);
|
const ImagePtrVector &camera_images);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -18,6 +18,8 @@ void Simulator::dataProviderCallback(const SimulatorData &sim_data)
|
|||||||
{
|
{
|
||||||
CHECK_EQ(event_simulators_.size(), num_cameras_);
|
CHECK_EQ(event_simulators_.size(), num_cameras_);
|
||||||
|
|
||||||
|
bool camera_simulator_success;
|
||||||
|
|
||||||
if(sim_data.images_updated)
|
if(sim_data.images_updated)
|
||||||
{
|
{
|
||||||
EventsVector events(num_cameras_);
|
EventsVector events(num_cameras_);
|
||||||
@ -36,14 +38,14 @@ void Simulator::dataProviderCallback(const SimulatorData &sim_data)
|
|||||||
corrupted_camera_images_[i]->setTo(0.);
|
corrupted_camera_images_[i]->setTo(0.);
|
||||||
}
|
}
|
||||||
|
|
||||||
camera_simulators_[i].imageCallback(*sim_data.images[i], time, corrupted_camera_images_[i]);
|
camera_simulator_success = camera_simulators_[i].imageCallback(*sim_data.images[i], time, corrupted_camera_images_[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// publish the simulation data + events
|
// publish the simulation data + events
|
||||||
{
|
{
|
||||||
auto t = timers_event_simulator_[TimerEventSimulator::visualization].timeScope();
|
auto t = timers_event_simulator_[TimerEventSimulator::visualization].timeScope();
|
||||||
publishData(sim_data, events, corrupted_camera_images_);
|
publishData(sim_data, events, camera_simulator_success, corrupted_camera_images_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -51,13 +53,14 @@ void Simulator::dataProviderCallback(const SimulatorData &sim_data)
|
|||||||
{
|
{
|
||||||
// just forward the simulation data to the publisher
|
// just forward the simulation data to the publisher
|
||||||
auto t = timers_event_simulator_[TimerEventSimulator::visualization].timeScope();
|
auto t = timers_event_simulator_[TimerEventSimulator::visualization].timeScope();
|
||||||
publishData(sim_data, {}, corrupted_camera_images_);
|
publishData(sim_data, {}, camera_simulator_success, corrupted_camera_images_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Simulator::publishData(const SimulatorData& sim_data,
|
void Simulator::publishData(const SimulatorData& sim_data,
|
||||||
const EventsVector& events,
|
const EventsVector& events,
|
||||||
|
bool camera_simulator_success,
|
||||||
const ImagePtrVector& camera_images)
|
const ImagePtrVector& camera_images)
|
||||||
{
|
{
|
||||||
if(publishers_.empty())
|
if(publishers_.empty())
|
||||||
@ -106,11 +109,14 @@ void Simulator::publishData(const SimulatorData& sim_data,
|
|||||||
{
|
{
|
||||||
publisher->imageCallback(sim_data.images, time);
|
publisher->imageCallback(sim_data.images, time);
|
||||||
|
|
||||||
// the images should be timestamped at mid-exposure (unless it is not possible)
|
if(camera_simulator_success && time >= exposure_time_)
|
||||||
const Time mid_exposure_time = (time >= 0.5 * exposure_time_) ? time - 0.5 * exposure_time_ : time;
|
{
|
||||||
|
// the images should be timestamped at mid-exposure
|
||||||
|
const Time mid_exposure_time = time - 0.5 * exposure_time_;
|
||||||
publisher->imageCorruptedCallback(camera_images, mid_exposure_time);
|
publisher->imageCorruptedCallback(camera_images, mid_exposure_time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(sim_data.depthmaps_updated)
|
if(sim_data.depthmaps_updated)
|
||||||
{
|
{
|
||||||
for(const Publisher::Ptr& publisher : publishers_)
|
for(const Publisher::Ptr& publisher : publishers_)
|
||||||
|
Loading…
Reference in New Issue
Block a user