当前位置: 首页>>代码示例>>C++>>正文


C++ TrackList::size方法代码示例

本文整理汇总了C++中TrackList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackList::size方法的具体用法?C++ TrackList::size怎么用?C++ TrackList::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TrackList的用法示例。


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

示例1: loadTracks

bool loadTracks(const MultiviewTrackList<IndexSet>& index_tracks,
                const std::string& features_format,
                const std::vector<std::string>& views,
                MultiviewTrackList<FeatureSet>& tracks) {
  // Initialize list of empty tracks.
  int num_features = index_tracks.numTracks();
  int num_views = views.size();
  tracks = MultiviewTrackList<FeatureSet>(num_features, num_views);

  // Iterate through time (to avoid loading all features at once).
  MultiViewTimeIterator<IndexSet> iterator(index_tracks);

  while (!iterator.end()) {
    int time = iterator.time();

    for (int view = 0; view < num_views; view += 1) {
      // Get feature indices matched in this frame.
      std::map<int, IndexSet> subset;
      iterator.getView(view, subset);

      // Only load tracks if there were some features.
      if (!subset.empty()) {
        TrackList<SiftPosition> features;

        // Load features in this frame.
        std::string file;
        file = makeFrameFilename(features_format, views[view], time);
        SiftPositionReader reader;
        bool ok = loadTrackList(file, features, reader);
        if (!ok) {
          return false;
        }
        LOG(INFO) << "Loaded " << features.size() << " tracks for (" << view <<
            ", " << time << ")";

        // Iterate through features in this frame.
        std::map<int, IndexSet>::const_iterator it;
        for (it = subset.begin(); it != subset.end(); ++it) {
          int id = it->first;
          const IndexSet& indices = it->second;
          CHECK(id < num_features);

          IndexSet::const_iterator index;
          for (index = indices.begin(); index != indices.end(); ++index) {
            // Copy every point in the track.
            CHECK(*index < int(features.size()));
            const Track<SiftPosition>& track = features[*index];

            Track<SiftPosition>::const_iterator point;
            for (point = track.begin(); point != track.end(); ++point) {
              int t = point->first;
              const SiftPosition& x = point->second;

              tracks.track(id).view(view)[t].push_back(x);
            }
          }
        }
      }
    }

    iterator.next();
  }

  return true;
}
开发者ID:jvlmdr,项目名称:non-rigid-tracking,代码行数:65,代码来源:multiview_index_tracks_to_features.cpp

示例2: processAutomations

void Song::processAutomations(const TrackList &tracklist, MidiTime timeStart, fpp_t)
{
	AutomatedValueMap values;

	QSet<const AutomatableModel*> recordedModels;

	TrackContainer* container = this;
	int tcoNum = -1;

	switch (m_playMode)
	{
	case Mode_PlaySong:
		break;
	case Mode_PlayBB:
	{
		Q_ASSERT(tracklist.size() == 1);
		Q_ASSERT(tracklist.at(0)->type() == Track::BBTrack);
		auto bbTrack = dynamic_cast<BBTrack*>(tracklist.at(0));
		auto bbContainer = Engine::getBBTrackContainer();
		container = bbContainer;
		tcoNum = bbTrack->index();
	}
		break;
	default:
		return;
	}

	values = container->automatedValuesAt(timeStart, tcoNum);
	TrackList tracks = container->tracks();

	Track::tcoVector tcos;
	for (Track* track : tracks)
	{
		if (track->type() == Track::AutomationTrack) {
			track->getTCOsInRange(tcos, 0, timeStart);
		}
	}

	// Process recording
	for (TrackContentObject* tco : tcos)
	{
		auto p = dynamic_cast<AutomationPattern *>(tco);
		MidiTime relTime = timeStart - p->startPosition();
		if (p->isRecording() && relTime >= 0 && relTime < p->length())
		{
			const AutomatableModel* recordedModel = p->firstObject();
			p->recordValue(relTime, recordedModel->value<float>());

			recordedModels << recordedModel;
		}
	}

	// Apply values
	for (auto it = values.begin(); it != values.end(); it++)
	{
		if (! recordedModels.contains(it.key()))
		{
			it.key()->setAutomatedValue(it.value());
		}
	}
}
开发者ID:RebeccaDeField,项目名称:lmms,代码行数:61,代码来源:Song.cpp

示例3: main

int main(int argc, char** argv) {
  init(argc, argv);

  std::string descriptor_tracks_file = argv[1];
  std::string image_format = argv[2];
  std::string fund_mat_format = argv[3];
  std::string intrinsics_format = argv[4];
  std::string views_file = argv[5];
  int view1 = boost::lexical_cast<int>(argv[6]);
  int time = boost::lexical_cast<int>(argv[7]);
  std::string examples_file = argv[8];

  // Load descriptors tracks.
  TrackList<SiftFeature> features;
  SiftFeatureReader feature_reader;
  bool ok = loadTrackList(descriptor_tracks_file, features, feature_reader);
  CHECK(ok) << "Could not load descriptor tracks";
  LOG(INFO) << "Loaded " << features.size() << " features";

  // Load names of views.
  std::vector<std::string> view_names;
  ok = readLines(views_file, view_names);
  CHECK(ok) << "Could not load view names";
  int num_views = view_names.size();

  // Load intrinsics for main camera.
  CameraProperties camera1;
  std::string camera_file1 = makeViewFilename(intrinsics_format,
      view_names[view1]);
  CameraPropertiesReader camera_reader;
  ok = load(camera_file1, camera1, camera_reader);
  CHECK(ok) << "Could not load intrinsics for main camera";

  // For each view.
  for (int view2 = 0; view2 < num_views; view2 += 1) {
    if (view2 != view1) {
      // Load fundamental matrix.
      cv::Mat F;
      int i = view1;
      int j = view2;
      bool swap = false;
      if (view2 < view1) {
        std::swap(i, j);
        swap = true;
      }
      std::string fund_mat_file = makeViewPairFilename(fund_mat_format,
          view_names[i], view_names[j]);
      MatrixReader matrix_reader;
      ok = load(fund_mat_file, F, matrix_reader);
      CHECK(ok) << "Could not load fundamental matrix";
      if (swap) {
        F = F.t();
      }

      // Load camera properties.
      CameraProperties camera2;
      std::string camera_file2 = makeViewFilename(intrinsics_format,
          view_names[view2]);
      ok = load(camera_file2, camera2, camera_reader);
      CHECK(ok) << "Could not load intrinsics for second camera";

      std::vector<double> scales;
      scales.push_back(4);
      scales.push_back(8);
      scales.push_back(16);
      scales.push_back(32);
      scales.push_back(64);

      std::vector<double> angles;
      angles.push_back(0 * M_PI / 4.);
      angles.push_back(1 * M_PI / 4.);
      angles.push_back(2 * M_PI / 4.);
      angles.push_back(3 * M_PI / 4.);
      angles.push_back(4 * M_PI / 4.);
      angles.push_back(5 * M_PI / 4.);
      angles.push_back(6 * M_PI / 4.);
      angles.push_back(7 * M_PI / 4.);

      extractExamplesForView(features, F, camera1, camera2, image_format,
          view_names[view2], time, scales, angles);
    }
  }

  return 0;
}
开发者ID:jvlmdr,项目名称:non-rigid-tracking,代码行数:85,代码来源:extract_multiview_examples.cpp

示例4: processNextBuffer


//.........这里部分代码省略.........
				{
					maxTact = Engine::getBBTrackContainer()
							->lengthOfCurrentBB();
				}
				else if( m_playMode == Mode_PlayPattern &&
					m_loopPattern == true &&
					tl != NULL &&
					tl->loopPointsEnabled() == false )
				{
					maxTact = m_patternToPlay->length()
								.getTact();
				}

				// end of played object reached?
				if( m_playPos[m_playMode].getTact() + 1
								>= maxTact )
				{
					// then start from beginning and keep
					// offset
					ticks %= ( maxTact * MidiTime::ticksPerTact() );

					// wrap milli second counter
					setToTimeByTicks(ticks);

					m_vstSyncController.setAbsolutePosition( ticks );
				}
			}
			m_playPos[m_playMode].setTicks( ticks );

			if( checkLoop )
			{
				m_vstSyncController.startCycle(
					tl->loopBegin().getTicks(), tl->loopEnd().getTicks() );

				// if looping-mode is enabled and we have got
				// past the looping range, return to the
				// beginning of the range
				if( m_playPos[m_playMode] >= tl->loopEnd() )
				{
					m_playPos[m_playMode].setTicks( tl->loopBegin().getTicks() );
					setToTime(tl->loopBegin());
				}
				else if( m_playPos[m_playMode] == tl->loopEnd() - 1 )
				{
					emit updateSampleTracks();
				}
			}
			else
			{
				m_vstSyncController.stopCycle();
			}

			currentFrame = fmodf( currentFrame, framesPerTick );
			m_playPos[m_playMode].setCurrentFrame( currentFrame );
		}

		f_cnt_t framesToPlay =
			Engine::mixer()->framesPerPeriod() - framesPlayed;

		f_cnt_t framesLeft = ( f_cnt_t )framesPerTick -
						( f_cnt_t )currentFrame;
		// skip last frame fraction
		if( framesLeft == 0 )
		{
			++framesPlayed;
			m_playPos[m_playMode].setCurrentFrame( currentFrame
								+ 1.0f );
			continue;
		}
		// do we have samples left in this tick but these are less
		// than samples we have to play?
		if( framesLeft < framesToPlay )
		{
			// then set framesToPlay to remaining samples, the
			// rest will be played in next loop
			framesToPlay = framesLeft;
		}

		if( ( f_cnt_t ) currentFrame == 0 )
		{
			processAutomations(trackList, m_playPos[m_playMode], framesToPlay);

			// loop through all tracks and play them
			for( int i = 0; i < trackList.size(); ++i )
			{
				trackList[i]->play( m_playPos[m_playMode],
						framesToPlay,
						framesPlayed, tcoNum );
			}
		}

		// update frame-counters
		framesPlayed += framesToPlay;
		m_playPos[m_playMode].setCurrentFrame( framesToPlay +
								currentFrame );
		m_elapsedMilliSeconds += MidiTime::ticksToMilliseconds( framesToPlay / framesPerTick, getTempo());
		m_elapsedTacts = m_playPos[Mode_PlaySong].getTact();
		m_elapsedTicks = ( m_playPos[Mode_PlaySong].getTicks() % ticksPerTact() ) / 48;
	}
}
开发者ID:RebeccaDeField,项目名称:lmms,代码行数:101,代码来源:Song.cpp

示例5: main

int main(int argc, char** argv) {
  init(argc, argv);

  if (argc != 3) {
    google::ShowUsageWithFlags(argv[0]);
    return 1;
  }

  std::string tracks_file = argv[1];
  std::string image_format = argv[2];
  std::string output_format = FLAGS_output_format;

  bool ok;

  TrackList<DrawerPointer> tracks;

  if (FLAGS_similarity) {
    // Load tracks.
    TrackList<SiftPosition> sift_tracks;
    SiftPositionReader feature_reader;
    ok = loadTrackList(tracks_file, sift_tracks, feature_reader);
    CHECK(ok) << "Could not load tracks";

    // Convert SIFT features to generic drawable features.
    siftPositionTracksToDrawers(sift_tracks, tracks);
  } else if (FLAGS_scale) {
    // Load tracks.
    TrackList<ScaleSpacePosition> scale_tracks;
    ScaleSpacePositionReader feature_reader;
    ok = loadTrackList(tracks_file, scale_tracks, feature_reader);
    CHECK(ok) << "Could not load tracks";

    // Convert SIFT features to generic drawable features.
    scaleFeatureTracksToDrawers(scale_tracks, tracks, FLAGS_radius);
  } else {
    // Load tracks.
    TrackList<cv::Point2d> point_tracks;
    ImagePointReader<double> feature_reader;
    ok = loadTrackList(tracks_file, point_tracks, feature_reader);
    CHECK(ok) << "Could not load tracks";

    // Convert SIFT features to generic drawable features.
    translationTracksToDrawers(point_tracks, tracks, FLAGS_radius);
  }

  LOG(INFO) << "Loaded " << tracks.size() << " tracks";

  // Make a list of random colors.
  typedef std::vector<cv::Scalar> ColorList;
  ColorList colors;
  for (int i = 0; i < int(tracks.size()); i += 1) {
    colors.push_back(randomColor(BRIGHTNESS, SATURATION));
  }

  // Iterate through frames in which track was observed.
  TrackListTimeIterator<DrawerPointer> frame(tracks, 0);

  while (!frame.end()) {
    // Get the current time.
    int t = frame.t();

    // Load the image.
    cv::Mat color_image;
    cv::Mat gray_image;
    ok = readImage(makeFilename(image_format, t), color_image, gray_image);
    CHECK(ok) << "Could not read image";

    // Get the features.
    typedef std::map<int, DrawerPointer> FeatureSet;
    FeatureSet features;
    frame.getPoints(features);

    // Draw each one with its color.
    drawFeatures(color_image, features, colors);

    if (FLAGS_save) {
      std::string output_file = makeFilename(output_format, t);
      ok = cv::imwrite(output_file, color_image);
      CHECK(ok) << "Could not save image";
    }

    if (FLAGS_display) {
      cv::imshow("tracks", color_image);
      cv::waitKey(10);
    }

    ++frame;
  }

  return 0;
}
开发者ID:jvlmdr,项目名称:non-rigid-tracking,代码行数:91,代码来源:visualize_tracks.cpp


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