Commit b50e5a4a authored by Cresson Remi's avatar Cresson Remi
Browse files

ENH: add BandMathX expression in bonus

parent ee7cc452
No related merge requests found
Showing with 13 additions and 0 deletions
+13 -0
...@@ -404,6 +404,8 @@ private: ...@@ -404,6 +404,8 @@ private:
FloatVectorImageType::PixelType gain, offset; FloatVectorImageType::PixelType gain, offset;
gain.SetSize(refImage->GetNumberOfComponentsPerPixel()); gain.SetSize(refImage->GetNumberOfComponentsPerPixel());
offset.SetSize(refImage->GetNumberOfComponentsPerPixel()); offset.SetSize(refImage->GetNumberOfComponentsPerPixel());
std::stringstream exp;
exp << "{";
for (unsigned int band = 0 ; band < refImage->GetNumberOfComponentsPerPixel() ; band++) for (unsigned int band = 0 ; band < refImage->GetNumberOfComponentsPerPixel() ; band++)
{ {
float meanY = m_StatsFilter->GetMeans().at(band)[0][0]; float meanY = m_StatsFilter->GetMeans().at(band)[0][0];
...@@ -417,9 +419,20 @@ private: ...@@ -417,9 +419,20 @@ private:
otbAppLogINFO("Band " << band << " gain: " << b1 << " bias: " << b0); otbAppLogINFO("Band " << band << " gain: " << b1 << " bias: " << b0);
if (band>0)
exp << ";";
exp << "im1b" << band << "*" << b1;
if (b0>0)
exp << "+" << b0;
else
exp << "" << b0;
gain[band] = b1; gain[band] = b1;
offset[band] = b0; offset[band] = b0;
} }
exp << "}";
otbAppLogINFO("BandMathX expression: " << exp.str());
if (this->HasValue("out")) if (this->HasValue("out"))
{ {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment