• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ resample函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中resample函数的典型用法代码示例。如果您正苦于以下问题:C++ resample函数的具体用法?C++ resample怎么用?C++ resample使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了resample函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: my_audio_callback

static void my_audio_callback(void *userdata, unsigned char *stream, int len)
{
    if (!l_PluginInit)
        return;

    int newsamplerate = OutputFreq * 100 / speed_factor;
    int oldsamplerate = GameFreq;

    if (buffer_pos > (len * oldsamplerate) / newsamplerate)
    {
        int input_used;
        if (VolumeControlType == VOLUME_TYPE_SDL)
        {
            input_used = resample(buffer, buffer_pos, oldsamplerate, mixBuffer, len, newsamplerate);
            SDL_MixAudio(stream, mixBuffer, len, VolSDL);
        }
        else
        {
            input_used = resample(buffer, buffer_pos, oldsamplerate, stream, len, newsamplerate);
        }
        memmove(buffer, &buffer[input_used], buffer_pos - input_used);
        buffer_pos -= input_used;
    }
    else
    {
        underrun_count++;
        DebugMessage(M64MSG_VERBOSE, "Audio buffer underrun (%i).",underrun_count);
        memset(stream , 0, len);
        buffer_pos = 0;
    }
}
开发者ID:RDCH106,项目名称:n64oid,代码行数:31,代码来源:main.c


示例2: my_audio_callback

void my_audio_callback(void *userdata, Uint8 *stream, int len)
{
    int newsamplerate = OutputFreq * 100 / speed_factor;
    int oldsamplerate = GameFreq;

    if (buffer_pos > (len * oldsamplerate) / newsamplerate)
    {
        int input_used;
        if (VolumeControlType == VOLUME_TYPE_SDL)
        {
            input_used = resample(buffer, buffer_pos, oldsamplerate, mixBuffer, len, newsamplerate);
            SDL_MixAudio(stream, mixBuffer, len, VolSDL);
        }
        else
        {
            input_used = resample(buffer, buffer_pos, oldsamplerate, stream, len, newsamplerate);
        }
        memmove(buffer, &buffer[input_used], buffer_pos - input_used);
        buffer_pos -= input_used;
    }
    else
    {
#ifdef DEBUG
        underrun_count++;
        fprintf(stderr, "[JttL's SDL Audio plugin] Debug: Audio buffer underrun (%i).\n",underrun_count);
#endif
        memset(stream , 0, len);
        buffer_pos = 0;
    }
}
开发者ID:z00t,项目名称:n64iphone,代码行数:30,代码来源:main.c


示例3: streaming_up_down_test

static void streaming_up_down_test(const SRCParams &params)
{
  // Source noise
  Samples noise(noise_size);
  RNG(seed).fill_samples(noise, noise_size);
  // Upsampled buffer
  Samples buf1(size_t(double(noise_size + 1) * params.fd / params.fs) + 1);
  // Downsampled buffer
  Samples buf2(noise_size + 100);

  StreamingSRC src;

  BOOST_REQUIRE(src.open(params));
  size_t buf1_data = resample(src, noise, noise_size, buf1, buf1.size());

  BOOST_REQUIRE(src.open(SRCParams(params.fd, params.fs, params.a, params.q)));
  size_t buf2_data = resample(src, buf1, buf1_data, buf2, buf2.size());

  BOOST_CHECK(abs(int(buf2_data) - int(noise_size)) <= 1);

  // Resample introduces not more than -A dB of noise.
  // 2 resamples introduces twice more noise, -A + 6dB
  sample_t diff = diff_resampled(params, noise, buf2, MIN(noise_size, buf2_data));
  BOOST_MESSAGE("Transform: " << params.fs << "Hz <-> " << params.fd << "Hz Diff: " << value2db(diff) << " dB");
  BOOST_CHECK_LE(value2db(diff), -params.a + 7);
}
开发者ID:9060,项目名称:ac3filter.valib,代码行数:26,代码来源:test_src.cpp


示例4: done

HRESULT TaudioFilterResampleLavc::process(TfilterQueue::iterator it, TsampleFormat &fmt, void *samples, size_t numsamples, const TfilterSettingsAudio *cfg0)
{
    const TresampleSettings *cfg = (const TresampleSettings*)cfg0;
    if (is(fmt, cfg)) {
        if (!cfg->equal(old) || oldfreq != fmt.freq || oldnchannels != fmt.nchannels || oldsf != fmt.sf) {
            old = *cfg;
            oldfreq = fmt.freq;
            oldnchannels = fmt.nchannels;
            oldsf = fmt.sf;
            done();
            buffIn.clear();
            buffOut.clear();
            bool libsamplerateok = false;
            int mode = limit(cfg->mode, (int)TresampleSettings::RESAMPLE_LAVC_NORMAL, (int)TresampleSettings::RESAMPLE_LAVC_HIGHEST);
            TsampleFormat fmtOut = fmt;
            getOutputFmt(fmtOut, cfg);
            if (fmtOut.sf == TsampleFormat::SF_PCM16)
                for (unsigned int i = 0; i < fmt.nchannels; i++)
                    switch (mode) {
                        case TresampleSettings::RESAMPLE_LAVC_NORMAL :
                            ctxsInt[i] = new TreSampleContext<int16_t>(1, cfg->freq, fmt.freq, 16         , 10, 0, 1.0, 15);
                            break;
                        case TresampleSettings::RESAMPLE_LAVC_HIGH   :
                            ctxsInt[i] = new TreSampleContext<int16_t>(1, cfg->freq, fmt.freq, 16         , 10, 1, 1.0, 22);
                            break;
                        case TresampleSettings::RESAMPLE_LAVC_HIGHEST:
                            ctxsInt[i] = new TreSampleContext<int16_t>(1, cfg->freq, fmt.freq, int(16 * 2.2), 10, 1, 1.0, 22);
                            break;
                    }
            else
                for (unsigned int i = 0; i < fmt.nchannels; i++)
                    switch (mode) {
                        case TresampleSettings::RESAMPLE_LAVC_NORMAL :
                            ctxsFloat[i] = new TreSampleContext<float>(1, cfg->freq, fmt.freq, 16         , 10, 0, 1.0, 0);
                            break;
                        case TresampleSettings::RESAMPLE_LAVC_HIGH   :
                            ctxsFloat[i] = new TreSampleContext<float>(1, cfg->freq, fmt.freq, 16         , 10, 1, 1.0, 0);
                            break;
                        case TresampleSettings::RESAMPLE_LAVC_HIGHEST:
                            ctxsFloat[i] = new TreSampleContext<float>(1, cfg->freq, fmt.freq, int(16 * 2.2), 10, 1, 1.0, 0);
                            break;
                    }
        }

        if (ctxsInt[0]) {
            resample(fmt, (int16_t*&)samples, numsamples, cfg, ctxsInt);
        } else {
            resample(fmt, (float*&)samples, numsamples, cfg, ctxsFloat);
        }
    }
    return parent->deliverSamples(++it, fmt, samples, numsamples);
}
开发者ID:roadtome,项目名称:ffdshow_tryout,代码行数:52,代码来源:TaudioFilterResample.cpp


示例5: scaleAndBlur

int TrackerTLDImpl::Pexpert::additionalExamples(std::vector<Mat_<uchar> >& examplesForModel, std::vector<Mat_<uchar> >& examplesForEnsemble)
{
    examplesForModel.clear();
    examplesForEnsemble.clear();
    examplesForModel.reserve(100);
    examplesForEnsemble.reserve(100);

    std::vector<Rect2d> closest, scanGrid;
    Mat scaledImg, blurredImg;

    double scale = scaleAndBlur(img_, cvRound(log(1.0 * resultBox_.width / (initSize_.width)) / log(SCALE_STEP)),
                                scaledImg, blurredImg, GaussBlurKernelSize, SCALE_STEP);
    TLDDetector::generateScanGrid(img_.rows, img_.cols, initSize_, scanGrid);
    getClosestN(scanGrid, Rect2d(resultBox_.x / scale, resultBox_.y / scale, resultBox_.width / scale, resultBox_.height / scale), 10, closest);

    for( int i = 0; i < (int)closest.size(); i++ )
    {
        for( int j = 0; j < 10; j++ )
        {
            Point2f center;
            Size2f size;
            Mat_<uchar> standardPatch(STANDARD_PATCH_SIZE, STANDARD_PATCH_SIZE), blurredPatch(initSize_);
            center.x = (float)(closest[i].x + closest[i].width * (0.5 + rng.uniform(-0.01, 0.01)));
            center.y = (float)(closest[i].y + closest[i].height * (0.5 + rng.uniform(-0.01, 0.01)));
            size.width = (float)(closest[i].width * rng.uniform((double)0.99, (double)1.01));
            size.height = (float)(closest[i].height * rng.uniform((double)0.99, (double)1.01));
            float angle = (float)rng.uniform(-5.0, 5.0);

            for( int y = 0; y < standardPatch.rows; y++ )
            {
                for( int x = 0; x < standardPatch.cols; x++ )
                {
                    standardPatch(x, y) += (uchar)rng.gaussian(5.0);
                }
            }
#ifdef BLUR_AS_VADIM
            GaussianBlur(standardPatch, blurredPatch, GaussBlurKernelSize, 0.0);
            resize(blurredPatch, blurredPatch, initSize_);
#else
            resample(blurredImg, RotatedRect(center, size, angle), blurredPatch);
#endif
            resample(scaledImg, RotatedRect(center, size, angle), standardPatch);
            examplesForModel.push_back(standardPatch);
            examplesForEnsemble.push_back(blurredPatch);
        }
    }
    return 0;
}
开发者ID:rokm,项目名称:opencv_contrib,代码行数:48,代码来源:tldTracker.cpp


示例6: apnea_plots

/*************************************************
********************FOR GUI***********************
*************************************************/
QVector<QVector<double>> sleep_apnea::sleep_apnea_plots(QVector<unsigned int> tab_R_peaks)
{
    //getting data
    QVector<QVector<double>>tab_RR,tab_RR_new,tab_res;
    QVector<QVector<double>>h_amp(2);
    QVector<QVector<double>>h_freq(2);
    QVector<QVector<double>> apnea_plots(3);

    tab_RR=RR_intervals(tab_R_peaks);
    tab_RR_new=averange_filter(tab_RR);
    tab_res=resample(tab_RR_new);
    HP_LP_filter(tab_res);
    hilbert(tab_res,h_amp,h_freq);
    freq_amp_filter(h_freq,h_amp);
    median_filter(h_freq,h_amp);

    //resizing output
    apnea_plots[0].resize(h_amp[0].size());
    apnea_plots[1].resize(h_amp[1].size());
    apnea_plots[2].resize(h_freq[1].size());
    //writing output
    int i;
    for(i=0;i<apnea_plots[0].size();i++)apnea_plots[0][i]=h_amp[0][i];
    for(i=0;i<apnea_plots[1].size();i++)apnea_plots[1][i]=h_amp[1][i];
    for(i=0;i<apnea_plots[2].size();i++)apnea_plots[2][i]=h_freq[1][i];
    return apnea_plots;
}
开发者ID:adamsze,项目名称:ProjektEKG,代码行数:30,代码来源:sleep_apnea.cpp


示例7: algorithm_particle_filter

std::vector<moving_objects3_particle_t>
algorithm_particle_filter(std::vector<moving_objects3_particle_t> particle_set_t_1,
		carmen_velodyne_projected_on_ground_message velodyne_projected_on_ground,
		double delta_time)
{
	std::vector<moving_objects3_particle_t> particle_set_t;

	double total_weight = 0.0;

	std::vector<moving_objects3_particle_t>::iterator it = particle_set_t_1.begin();
	std::vector<moving_objects3_particle_t>::iterator end = particle_set_t_1.end();
	for (; it != end; ++it)
	{
		moving_objects3_particle_t particle_t;
		// Motion Model
		particle_t = sample_motion_model((*it), delta_time);

		// Measurement Model -> RANSAC
		// cost = measurement_model(particle_t, velodyne_projected_on_ground);

		// Weighing particles
		particle_t.weight = get_particle_weight(particle_t, velodyne_projected_on_ground);
		total_weight += particle_t.weight;

		particle_set_t.push_back(particle_t);
	}

	// normalize particles weight
	normalize_weights(particle_set_t, total_weight);

	// resample
	particle_set_t = resample(particle_set_t);

	return particle_set_t;
}
开发者ID:LCAD-UFES,项目名称:carmen_lcad,代码行数:35,代码来源:moving_objects3_particle_filter.cpp


示例8: DBG

unsigned int AmAudio::resampleOutput(unsigned char* buffer, unsigned int s, int input_sample_rate, int output_sample_rate)
{
  if ((input_sample_rate == output_sample_rate) 
      && !output_resampling_state.get()) {
    return s;
  }

  if (!output_resampling_state.get()) {
#ifdef USE_INTERNAL_RESAMPLER
    if (AmConfig::ResamplingImplementationType == AmAudio::INTERNAL_RESAMPLER) {
      DBG("using internal resampler for output");
      output_resampling_state.reset(new AmInternalResamplerState());
    } else
#endif
#ifdef USE_LIBSAMPLERATE
      if (AmConfig::ResamplingImplementationType == AmAudio::LIBSAMPLERATE) {
	output_resampling_state.reset(new AmLibSamplerateResamplingState());
      } else
#endif
	{
	  return s;
	}
  }

  return resample(*output_resampling_state, buffer, s, input_sample_rate, output_sample_rate);
}
开发者ID:FihlaTV,项目名称:sems-amr,代码行数:26,代码来源:AmAudio.cpp


示例9: likelihood

    void ParticleFilter::observation_density_reweight(cv::Mat& input)
    {
      // Reweight every particle in model by its observation density
      for(int i = 0; i < N; i++)
      {
        particle_model[i].prevWeight = particle_model[i].weight;
        particle_model[i].weight *= likelihood(input, particle_model[i]);
      }

      // Normalize weights
      double sum = 0.0;
      for(int i = 0; i < N; i++) sum += particle_model[i].weight;
      double normFactor = 1.0/sum;
      if(sum == 0.0) normFactor = 0.0;
      for(int i = 0; i < N; i++) particle_model[i].weight *= normFactor;

      // Compute Neff (effective particle number)
      sum = 0.0;
      for(int i = 0; i < N; i++) sum += pow(particle_model[i].weight, 2);
      neff = 1.0/sum;
      if(sum == 0) neff = 0.0;
       ROS_INFO("Neff = %f", neff);

      if(neff < N * 0.04)
      {
        is_dead_ = true;
      }
      else if(neff < N * 0.75)
      {
        resample();
        observation_density_reweight(input);
      }

    }
开发者ID:Kyate,项目名称:human_tracker,代码行数:34,代码来源:particle_filter.cpp


示例10: resample

 void
 GenericAudioMixer::pushBuffer(const uint8_t* const data, size_t size, IMetadata& metadata)
 {
     AudioBufferMetadata & inMeta = static_cast<AudioBufferMetadata&>(metadata);
     
     if(inMeta.size() >= 5) {
         const auto inSource = inMeta.getData<kAudioMetadataSource>() ;
         
         auto lSource = inSource.lock();
         if(lSource) {
             
             auto hash = std::hash<std::shared_ptr<ISource> > ()(lSource);
             
             auto ret = resample(data, size, inMeta);
             if(ret->size() > 0) {
                 // push buffer
                 uint8_t *p;
                 size_t rsize = ret->read(&p, ret->size());
                 m_inBuffer[hash]->put(p, rsize);
                 
             } else {
                 // use data provided
                 m_inBuffer[hash]->put(const_cast<uint8_t*>(data), size);
                 
             }
             
         }
     }
 }
开发者ID:amitkumar3968,项目名称:VideoCore,代码行数:29,代码来源:GenericAudioMixer.cpp


示例11: if

//-----------------------------------------------------------------------------
void MainWindow::keyPressEvent(QKeyEvent* e)
{
    if ((e->key() == Qt::Key_W) || (e->key()==Qt::Key_Up))
        m_frontDown=true;
    else if ((e->key() == Qt::Key_S) || (e->key()==Qt::Key_Down))
        m_backDown=true;
    else if ((e->key() == Qt::Key_A) || (e->key()==Qt::Key_Left))
        m_leftDown=true;
    else if ((e->key() == Qt::Key_D) || (e->key()==Qt::Key_Right))
        m_rightDown=true;
    else if (e->key() == Qt::Key_R)
    {
        initStates();
    }
    else if (e->key() == Qt::Key_1)
        resample();
    else if (e->key() == Qt::Key_2)
        drift();
    else if (e->key() == Qt::Key_3)
        diffuse();
    else if (e->key() == Qt::Key_4)
        measure();
    else if (e->key() == Qt::Key_Tab)
        changeRunMode();
    else
        e->ignore();
}
开发者ID:stwirth,项目名称:libPF,代码行数:28,代码来源:MainWindow.cpp


示例12: audioedit_delete_selection

int audioedit_delete_selection(struct view *v)
{
    int rc = -1;
    long first, last;
    char undo_label[200];

    get_region_of_interest(&first, &last, v);

    sprintf(undo_label, "Delete audio data from %ld to %ld.", first, last);
    if (start_save_undo(undo_label, v) < 0)
        return -1;
    rc = save_undo_data_remove(first, last, 1);
    close_undo();
    if (rc == 1) /* canceled */
        return -1;

    begin_operation("Deleting audio data") ;
    rc = soundfile_remove_samples(first, last - first + 1, 1);
    end_operation();

    if (rc == 0) {
        adjust_view(v);
        v->selection_region = FALSE;
        resample(first, prefs.n_samples-1);
    }
    return rc;
}
开发者ID:AlisterH,项目名称:gwc,代码行数:27,代码来源:audio_edit.c


示例13: MEMMAN_NEW_ARRAY

void t_audio_rx::post_media_peer_rx_3way(unsigned char *media, int len,
		unsigned short peer_sample_rate) 
{
	mtx_3way.lock();

	if (!is_3way) {
		// This is not a 3-way call. This is not necessarily an
		// error condition. The 3rd party may be in the process of
		// leaving the conference.
		// Simply discard the posted media
		mtx_3way.unlock();
		return;
	}
	
	if (peer_sample_rate != audio_encoder->get_sample_rate()) {
		// Resample media from peer to sample rate of this receiver
		int output_len = (len / 2) * audio_encoder->get_sample_rate() / peer_sample_rate;
		short *output_buf = new short[output_len];
		MEMMAN_NEW_ARRAY(output_buf);
		int resample_len = resample((short *)media, len / 2, peer_sample_rate,
					output_buf, output_len, audio_encoder->get_sample_rate());
		media_3way_peer_rx->add((unsigned char *)output_buf, resample_len * 2);
		MEMMAN_DELETE_ARRAY(output_buf);
		delete [] output_buf;
	} else {
		media_3way_peer_rx->add(media, len);
	}

	mtx_3way.unlock();
}
开发者ID:gwozniak,项目名称:twinkle,代码行数:30,代码来源:audio_rx.cpp


示例14: MEMMAN_NEW_ARRAY

void t_audio_tx::post_media_peer_tx_3way(unsigned char *media, int len,
		unsigned short peer_sample_rate) 
{
	mtx_3way.lock();

	if (!is_3way || !is_3way_mixer) {
		mtx_3way.unlock();
		return;
	}
	
	if (peer_sample_rate != sc_sample_rate) {
		// Resample media from peer to sample rate of this transmitter
		int output_len = (len / 2) * sc_sample_rate / peer_sample_rate;
		short *output_buf = new short[output_len];
		MEMMAN_NEW_ARRAY(output_buf);
		int resample_len = resample((short *)media, len / 2, peer_sample_rate,
					output_buf, output_len, sc_sample_rate);
		media_3way_peer_tx->add((unsigned char *)output_buf, resample_len * 2);
		MEMMAN_DELETE_ARRAY(output_buf);
		delete [] output_buf;
	} else {
		media_3way_peer_tx->add(media, len);
	}

	mtx_3way.unlock();
}
开发者ID:gwozniak,项目名称:twinkle,代码行数:26,代码来源:audio_tx.cpp


示例15: DBG_BLOCK

//------------------------------------------------------------------------------
//! Append anim2 at the end of anim1 (no blending whatsoever).
//! If rates differ, the rate of anim1 is used for the final animation.
RCP<SkeletalAnimation>
Puppeteer::concatenate(
   SkeletalAnimation* anim1,
   SkeletalAnimation* anim2
)
{
   DBG_BLOCK( os_pup, "Puppeteer::concatenate(" << anim1 << ", " << anim2 << ")" );
   anim1->makeRelative();
   anim2->makeRelative();
   RCP<SkeletalAnimation> anim = anim1->clone();
   if( anim2->numPoses() > 0 )
   {
      RCP<SkeletalAnimation> animToAppend;
      if( anim1->rate() == anim2->rate() )
      {
         animToAppend = anim2;
      }
      else
      {
         animToAppend = resample( anim2, anim1->rate() );
      }
      // Remove the first animation's last frame (a copy of frame 0).
      uint np1 = anim->numPoses() - 1;
      anim->removePose( np1 );
      // Add the second animation's poses.
      uint np2 = animToAppend->numPoses();
      anim->reservePoses( np1 + np2 );
      for( uint p = 0; p < np2; ++p )
      {
         anim->addPose( animToAppend->pose(p)->clone().ptr() );
      }
   }
   return anim;
}
开发者ID:LudoSapiens,项目名称:Dev,代码行数:37,代码来源:Puppeteer.cpp


示例16: getMeasurementProbability

void ParticleFilterLocalizer::update(const Measurements& measurements) {
    Particle* particle;
    float maxProbability = -1;

    for (unsigned int i = 0; i < particles.size(); i++) {
        particle = particles[i];

		Util::confineField(particle->x, particle->y);

        particle->probability = getMeasurementProbability(particle, measurements);

        if (maxProbability == -1 || particle->probability > maxProbability) {
            maxProbability = particle->probability;
        }
    }

	if (maxProbability == 0) {
		return;
	}

    for (unsigned int i = 0; i < particles.size(); i++) {
		particles[i]->probability /= maxProbability;
    }

    resample();
}
开发者ID:Sean3Don,项目名称:Soccerbot,代码行数:26,代码来源:ParticleFilterLocalizer.cpp


示例17: resample

void PosEst::estimate(Scene *scene_, Model *model_, MatrixXf boundBox, float gridSize, int cnt)
{
    if(DEBUG_ALGORITHM) cout<<cnt<<endl;
    model = model_;
    scene = scene_;

    double lastT = pcl::getTime();

    resample(var_trans, var_rot);
    if(DEBUG_ALGORITHM) cout<<"resample time : "<<pcl::getTime()-lastT<<endl;

    lastT = pcl::getTime();
    weight(boundBox, gridSize);
    if(DEBUG_ALGORITHM) cout<<"weight time : "<<pcl::getTime()-lastT<<endl;


    //    if (!(m_finalParticle.x==m_finalParticle.x && m_finalParticle.y==m_finalParticle.y && m_finalParticle.z == m_finalParticle.z &&
    //          m_finalParticle.roll == m_finalParticle.roll && m_finalParticle.pitch == m_finalParticle.pitch && m_finalParticle.yaw == m_finalParticle.yaw))
    //        m_finalParticle = m_lastFinalParticle;
    //    Eigen::Affine3f finaltrans = finalParticle.toEigenMatrix();
    if(DEBUG_ALGORITHM) cout<<"finaltrans is : " <<finalParticle<<endl;
    //    CloudPtr out (new Cloud);
    //    transformPointCloud(*m_modelOrig, *out, finaltrans);
    //    return out;

    // convert finalparticle to pos_updated

    pos_updated = finalParticle;

}
开发者ID:AIS-Bonn,项目名称:vismotcoord,代码行数:30,代码来源:posest.cpp


示例18: resample

	Path2D GeometricRecognizer::normalizePath(Path2D points)
	{
		/* Recognition algorithm from 
			http://faculty.washington.edu/wobbrock/pubs/uist-07.1.pdf
			Step 1: Resample the Point Path
			Step 2: Rotate Once Based on the "Indicative Angle"
			Step 3: Scale and Translate
			Step 4: Find the Optimal Angle for the Best Score
		*/
		// TODO: Switch to $N algorithm so can handle 1D shapes

		//--- Make everyone have the same number of points (anchor points)
		points = resample(points);
		//--- Pretend that all gestures began moving from right hand side
		//---  (degree 0). Makes matching two items easier if they're
		//---  rotated the same
		if (getRotationInvariance())
			points = rotateToZero(points);
		//--- Pretend all shapes are the same size. 
		//--- Note that since this is a square, our new shape probably
		//---  won't be the same aspect ratio
		points = scaleToSquare(points);
		//--- Move the shape until its center is at 0,0 so that everyone
		//---  is in the same coordinate system
		points = translateToOrigin(points);

		return points;
	}
开发者ID:LiYuandong,项目名称:Cocos2dxTestProject,代码行数:28,代码来源:GeometricRecognizer.cpp


示例19: low_variance_sampler

static void 
low_variance_sampler(carmen_fused_odometry_particle *xt, carmen_fused_odometry_parameters *fused_odometry_parameters)
{		
/*	int m;
	double sum_weights = 0.0;
	double sum_sqr_weight = 0.0;
	//double Neff;

	for (m = 0; m < num_particles; m++)
		sum_weights += xt[m].weight; // @@@ Alberto: O peso das particulas nao esta de acordo com a probabilidade; por isso tem que normalizar.

	for (m = 0; m < num_particles; m++)
		sum_sqr_weight += (xt[m].weight / sum_weights) * (xt[m].weight / sum_weights);

	Neff = 1.0 / sum_sqr_weight;

	//printf("Neff = %lf\n", Neff);
	if (Neff < (num_particles * 0.90)) // Selective resampling: see Grisetti, Stachniss and Burgard
	{	// Nao estamos utilizando selective resample por causa de nao estarmos computando o peso das paticulas precisamente
*/
	if (fabs(ut.v) > fused_odometry_parameters->minimum_speed_for_correction)
	{
		resample(xt);
	}
}
开发者ID:LCAD-UFES,项目名称:carmen_lcad,代码行数:25,代码来源:fused_odometry.cpp


示例20: cf_new_track

static void cf_new_track(input_stream_t *source) {
  static int skipnext = 0;
  static input_stream_t lasttrack;
  int filesecs;

  if (lasttrack.samplerate && lasttrack.samplerate != source->samplerate) {
    if (resample(lasttrack.samplerate, source->samplerate) < 0)
      skipnext = 1;
  }

  memcpy(&lasttrack, source, sizeof(lasttrack));

  /* turn off crossfading for tracks less than twice the length of the fade */
  if (skipnext) {
    skipnext = 0;
    return;
  }

  if (source->filesize && source->bitrate) {
    filesecs = source->filesize / (source->bitrate * 128);
    if (filesecs < 10 || filesecs <= Fadelen * 2) {
      ices_log_debug("crossfade: not fading short track of %d secs", filesecs);
      skipnext = 1;
      return;
    }
  }

  NewTrack = FadeSamples;
}
开发者ID:9060,项目名称:icecast-uo-aga,代码行数:29,代码来源:crossfade.c



注:本文中的resample函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ resched函数代码示例发布时间:2022-05-30
下一篇:
C++ res_trk_check_for_sec_session函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap