Example #1
0
void CFilterVarianceApp::FilterContinue(void)
   {
   // update progress counter
   DisplayTileProgress(0, 100, m_nIteration, m_sData->nScale==0 ? 2 : 1);

   // get this tile for processing
   libbase::matrix<double> in, out;
   GetPixelMatrix(in);

   // get variance for each pixel
   libimage::variancefilter<double> filter(m_sData->nRadius);
   filter.process(in, out);

   switch(m_nIteration)
      {
      case 0:
         // if we don't want auto-scaling, scale this tile & write back
         if(m_sData->nScale != 0)
            {
            out *= m_sData->nScale;
            libimage::limiter<double> lim(0,1);
            lim.process(out);
            SetPixelMatrix(out);
            }
         else
            {
            // otherwise, to be able to normalize later, update scale info
            const double dScale = out.max();
            if(m_dScale < dScale)
               m_dScale = dScale;
            }
         break;

      case 1:
         // normalize based on scale found earlier & write back
         out /= m_dScale;
         libimage::limiter<double> lim(0,1);
         lim.process(out);
         SetPixelMatrix(out);
         break;
      }

   // select the next rectangle based on the given tile suggestions
   CPSPlugIn::FilterContinue();
   // if we need to do a second iteration
   if(m_nIteration==0 && m_sData->nScale==0 && IterationDone())
      {
      m_nIteration++;
      IterationStart();
      }
   }
Example #2
0
void CFilterEnergyApp::FilterContinue(void)
   {
   // update progress counter
   DisplayTileProgress(0);

   // get this tile for processing
   libbase::matrix<double> in;
   GetPixelMatrix(in);

   // update the statistics
   rv.insert(in);

   // select the next rectangle based on the given tile suggestions
   CPSPlugIn::FilterContinue();
   }
Example #3
0
void CFilterATMApp::FilterContinue(void)
   {
   // update progress counter
   DisplayTileProgress(0);

   // do the processing for this tile
   libbase::matrix<double> in, out;
   GetPixelMatrix(in);
   atmfilter<double>::process(in, out);
   if(m_sData->bKeepNoise)
      {
      out *= -1;
      out += in;
      out += 0.5;
      libimage::limiter<double> lim(0,1);
      lim.process(out);
      }
   SetPixelMatrix(out);

   // select the next rectangle based on the given tile suggestions
   CPSPlugIn::FilterContinue();
   }