Skip to content

Commit

Permalink
check if noise or distortion render pass is null (#211)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 authored Mar 31, 2022
1 parent 836c306 commit eab2c87
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ImageBrownDistortionModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ void ImageBrownDistortionModel::SetCamera(rendering::CameraPtr _camera)
// add distortion pass
rendering::RenderPassPtr distortionPass =
rpSystem->Create<rendering::DistortionPass>();
if (!distortionPass)
{
ignwarn << "ImageBrownDistortionModel is not supported in "
<< engine->Name() << std::endl;
return;
}
this->dataPtr->distortionPass =
std::dynamic_pointer_cast<rendering::DistortionPass>(distortionPass);
this->dataPtr->distortionPass->SetK1(this->dataPtr->k1);
Expand Down
6 changes: 6 additions & 0 deletions src/ImageGaussianNoiseModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ void ImageGaussianNoiseModel::SetCamera(rendering::CameraPtr _camera)
// add gaussian noise pass
rendering::RenderPassPtr noisePass =
rpSystem->Create<rendering::GaussianNoisePass>();
if (!noisePass)
{
ignwarn << "ImageGaussianNoiseModel is not supported in "
<< engine->Name() << std::endl;
return;
}
this->dataPtr->gaussianNoisePass =
std::dynamic_pointer_cast<rendering::GaussianNoisePass>(noisePass);
this->dataPtr->gaussianNoisePass->SetMean(this->dataPtr->mean);
Expand Down

0 comments on commit eab2c87

Please sign in to comment.