コード例 #1
0
		float FindLaplacianValue(
			const MatrixF& img,
			const Remapping& remapping,
			float gvalue,
			int level,
			int row,
			int col )
		{
			//find the total size we need
			int size = 3 * ( pow(2.0f,level+2) - 1 );
			int halfSize = size / 2;

			//find the corresponding point from that level to original image
			int rowTemp = row*pow(2.0f,level);
			int colTemp = col*pow(2.0f,level);

			//copy the whole block (replicating when necessary)
			MatrixF mat[2];
			MatrixF* dest0 = &(mat[0]);
			MatrixF* dest1 = &(mat[1]);

			Point topLeft( colTemp - halfSize, rowTemp - halfSize );
			Point bottomRight( colTemp + halfSize, rowTemp + halfSize );
			Copy( img, topLeft, bottomRight, *dest0 );
			RemapImage(*dest0, gvalue, remapping, *dest0);

			Pyramid::Gaussian( *dest0, *dest1, 0.4f );
			Copy( *dest1, Point(2,2), Point(dest1->Cols()-3,dest1->Rows()-3), *dest1);
			Decimate(*dest1,*dest1);

			for(int i = 0; i < level; ++i)
			{
				std::swap( dest0, dest1 );
				Pyramid::Gaussian( *dest0, *dest1, 0.4f );
				Copy( *dest1, Point(2,2), Point(dest1->Cols()-3,dest1->Rows()-3), *dest1);
				Decimate(*dest1,*dest1);
			}

			//expand
			assert( dest1->Rows() == 3 );
			assert( dest1->Cols() == 3 );
			ExpandOdd( *dest1, *dest1, 0.4f ); //now 5X5

			//we need to also reduce dest0
			Copy( *dest0, Point(2,2), Point(dest0->Cols()-3,dest0->Rows()-3), *dest0);
			MatrixF laplacian;
			Subtract(*dest0, *dest1, laplacian);
			return laplacian[laplacian.Rows()/2][laplacian.Cols()/2];
		}
コード例 #2
0
ファイル: chanfnc.c プロジェクト: gaorlov/DAAS
int  DoDecimateCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
    int i, dfact, ave;
    channelPtr chan, newchan;

    if (event == EVENT_COMMIT)
    {
        GetCtrlVal (panel, DECIMATE_CHANNELS, &i);
        GetCtrlVal (panel, DECIMATE_DFACT, &dfact);
        GetCtrlVal (panel, DECIMATE_AVE, &ave);

        chan = channellist_GetItem (i);

        newchan = channel_Create();
        if (newchan && channel_AllocMem (newchan, (int)(chan->pts/dfact)) &&
            (Decimate (chan->readings, chan->pts, dfact, ave, newchan->readings) == NoErr))
        {
            Fmt (newchan->label, "%s (decimated)", chan->label);
            Fmt (newchan->note, "%s\n%s\ndfact = %i\nave = %i\n",
                 chan->note, newchan->label, dfact, ave);
            channellist_AddChannel (newchan);
            return 1;
        }

        MessagePopup ("Decimate Channel Message", "Error decimating channel--function voided");
        if (newchan)
        {
            if (newchan->readings) free (newchan->readings);
            free (newchan);
        }
    }
    return 0;
}
コード例 #3
0
void AFTimeDataSerie::CalculateDataSerie(const size_t unWindowLength, double& dbTLo, double& dbTHi)
{
    // No calculation is needed: use existing datas.
    if(m_unLength != unWindowLength)
    {
        Destroy();
        m_unLength = unWindowLength;
        Init();
    }

    switch(m_nHandlerType)
    {
        case HT_RMS:       Rms(unWindowLength, dbTLo, dbTHi);      break;
        case HT_DECIMATE : Decimate(unWindowLength, dbTLo, dbTHi); break;
        default:           Decimate(unWindowLength, dbTLo, dbTHi); break;
    }

}
コード例 #4
0
ファイル: ThermalBand.cpp プロジェクト: Advi42/XCSoar
void
ThermalBand::CheckExpand(const ThermalBand& tb, bool update)
{
     assert(size());
     // check to see if ceiling will fit into range
     while (GetSliceIndex(tb.GetCeiling())+1 >= slices.capacity()) {
          Decimate(update);
     }
}
コード例 #5
0
void QmitkMeshDecimationView::CreateQtPartControl( QWidget *parent )
{
  // build up qt view, unless already done
  if ( !m_Controls )
  {
    // create GUI widgets from the Qt Designer's .ui file
    m_Controls = new Ui::QmitkMeshDecimationView;
    m_Controls->setupUi( parent );

    connect((QObject*)(m_Controls->Decimate), SIGNAL(clicked()), this, SLOT(Decimate()));
  }
}
コード例 #6
0
ファイル: bfin_sport_tdm.c プロジェクト: BackupGGCode/teebx
static int swdsp_Decimate(int16_t *Delay, int16_t *InBuffer, int16_t *OutBuffer, int Len) {
    return Decimate(SWDSP_SAMPLING_NTaps, SWDSP_LOWFOUR_FTaps, Delay, Len, InBuffer, OutBuffer);
}
コード例 #7
0
ファイル: BlockRandomizer.cpp プロジェクト: AllenTsui/CNTK
// Gets next sequences not exceeding sampleCount.
Sequences BlockRandomizer::GetNextSequences(size_t sampleCount)
{
    // Get next sequence descriptions.
    Sequences result;
    std::vector<RandomizedSequenceDescription> sequences;
    result.m_endOfEpoch = GetNextSequenceDescriptions(sampleCount, sequences);
    if (sequences.size() == 0)
    {
        return result;
    }

    // Decimate.
    std::vector<RandomizedSequenceDescription> decimated;
    decimated.reserve(sequences.size());
    Decimate(sequences, decimated);
    if (decimated.size() == 0)
    {
        return result;
    }

    if (m_verbosity >= Debug)
        fprintf(stderr, "BlockRandomizer::GetNextSequences(): getting %" PRIu64 " out of %" PRIu64 " sequences for %" PRIu64 " requested samples in sweep %" PRIu64 "\n",
            sequences.size(),
            decimated.size(),
            sampleCount,
            m_sweep);

    result.m_data.resize(m_streams.size(), std::vector<SequenceDataPtr>(decimated.size()));

    auto process = [&](int i) -> void {
        const auto& description = decimated[i];
        std::vector<SequenceDataPtr> sequence;
        auto it = m_chunks.find(description.m_chunk->m_chunkId);
        if (it == m_chunks.end())
        {
            LogicError("Invalid chunk requested.");
        }

        it->second->GetSequence(description.m_id, sequence);
        for (int j = 0; j < m_streams.size(); ++j)
        {
            result.m_data[j][i] = sequence[j];
        }
    };

    // TODO: This will be changed, when we move transformers under the randomizer, should not deal with multithreading here.
    if (m_multithreadedGetNextSequences)
    {
#pragma omp parallel for schedule(dynamic)
        for (int i = 0; i < decimated.size(); ++i)
            process(i);
    }
    else
    {
        for (int i = 0; i < decimated.size(); ++i)
            process(i);
    }

    m_sequenceRandomizer->ReleaseChunks();
    return result;
}