Beispiel #1
0
const QSize CameraDescription::GetImageSize() const
{
     /// @todo Add some error checking to video sequence creation?
    std::auto_ptr< VideoSequence > videoSequence( CreateVideoSequence( -1.0 ) );

    const int width  = videoSequence->GetFrameWidth();
    const int height = videoSequence->GetFrameHeight();

    return QSize( width, height );
}
int main(int argc, char * argv[]){
	
	char* usage = "openmp.out -x <dimX> -y <dimY> -z <Nfr> -np <Nparticles>";
	//check number of arguments
	if(argc != 9)
	{
		printf("%s\n", usage);
		return 0;
	}
	//check args deliminators
	if( strcmp( argv[1], "-x" ) ||  strcmp( argv[3], "-y" ) || strcmp( argv[5], "-z" ) || strcmp( argv[7], "-np" ) ) {
		printf( "%s\n",usage );
		return 0;
	}
	
	int IszX, IszY, Nfr, Nparticles;
	
	//converting a string to a integer
	if( sscanf( argv[2], "%d", &IszX ) == EOF ) {
	   printf("ERROR: dimX input is incorrect");
	   return 0;
	}
	
	if( IszX <= 0 ) {
		printf("dimX must be > 0\n");
		return 0;
	}
	
	//converting a string to a integer
	if( sscanf( argv[4], "%d", &IszY ) == EOF ) {
	   printf("ERROR: dimY input is incorrect");
	   return 0;
	}
	
	if( IszY <= 0 ) {
		printf("dimY must be > 0\n");
		return 0;
	}
	
	//converting a string to a integer
	if( sscanf( argv[6], "%d", &Nfr ) == EOF ) {
	   printf("ERROR: Number of frames input is incorrect");
	   return 0;
	}
	
	if( Nfr <= 0 ) {
		printf("number of frames must be > 0\n");
		return 0;
	}
	
	//converting a string to a integer
	if( sscanf( argv[8], "%d", &Nparticles ) == EOF ) {
	   printf("ERROR: Number of particles input is incorrect");
	   return 0;
	}
	
	if( Nparticles <= 0 ) {
		printf("Number of particles must be > 0\n");
		return 0;
	}
	//establish seed
	int * seed = (int *)malloc(sizeof(int)*Nparticles);
	int i;
	for(i = 0; i < Nparticles; i++)
		seed[i] = time(0)*i;
	//malloc matrix
	int * I = (int *)malloc(sizeof(int)*IszX*IszY*Nfr);
	long long start = get_time();
	//call video sequence
	videoSequence(I, IszX, IszY, Nfr, seed);
	long long endVideoSequence = get_time();
	printf("VIDEO SEQUENCE TOOK %f\n", elapsed_time(start, endVideoSequence));
	//call particle filter
	particleFilter(I, IszX, IszY, Nfr, seed, Nparticles);
	long long endParticleFilter = get_time();
	printf("PARTICLE FILTER TOOK %f\n", elapsed_time(endVideoSequence, endParticleFilter));
	printf("ENTIRE PROGRAM TOOK %f\n", elapsed_time(start, endParticleFilter));
	
	free(seed);
	free(I);
	return 0;
}
int main(int argc, char * argv[]){

  printf("Starting ...\n");
  init_timer(timer_ctrl, timer_counter_l, timer_counter_h);
  start_timer(timer_ctrl);

  int IszX, IszY, Nfr, Nparticles;
  /*
     char* usage = "naive.out -x <dimX> -y <dimY> -z <Nfr> -np <Nparticles>";
  //check number of arguments
  if(argc != 9)
  {
  printf("%s\n", usage);
  return 0;
  }
  //check args deliminators
  if( strcmp( argv[1], "-x" ) ||  strcmp( argv[3], "-y" ) || strcmp( argv[5], "-z" ) || strcmp( argv[7], "-np" ) ) {
  printf( "%s\n",usage );
  return 0;
  }

  //converting a string to a integer
  if( sscanf( argv[2], "%d", &IszX ) == EOF ) {
  printf("ERROR: dimX input is incorrect");
  return 0;
  }

  if( IszX <= 0 ) {
  printf("dimX must be > 0\n");
  return 0;
  }

  //converting a string to a integer
  if( sscanf( argv[4], "%d", &IszY ) == EOF ) {
  printf("ERROR: dimY input is incorrect");
  return 0;
  }

  if( IszY <= 0 ) {
  printf("dimY must be > 0\n");
  return 0;
  }

  //converting a string to a integer
  if( sscanf( argv[6], "%d", &Nfr ) == EOF ) {
  printf("ERROR: Number of frames input is incorrect");
  return 0;
  }

  if( Nfr <= 0 ) {
  printf("number of frames must be > 0\n");
  return 0;
  }

  //converting a string to a integer
  if( sscanf( argv[8], "%d", &Nparticles ) == EOF ) {
  printf("ERROR: Number of particles input is incorrect");
  return 0;
  }

  if( Nparticles <= 0 ) {
  printf("Number of particles must be > 0\n");
  return 0;
  }
  */
  IszX = 128;
  IszY = 128;
  Nfr = 10;
  Nparticles = 1700;
  //establish seed
  int * seed = (int *)malloc(sizeof(int)*Nparticles);
  int i;
  for(i = 0; i < Nparticles; i++)
    seed[i] = i;//time(0)*i;
  //malloc matrix
  int * I = (int *)malloc(sizeof(int)*IszX*IszY*Nfr);
  memset(I, 0, sizeof(int) * IszX * IszY * Nfr);

  //long long start = get_time();
  //call video sequence
  videoSequence(I, IszX, IszY, Nfr, seed);
  //long long endVideoSequence = get_time();
  //printf("VIDEO SEQUENCE TOOK %f\n", elapsed_time(start, endVideoSequence));
  //call particle filter
  int passed = particleFilter(I, IszX, IszY, Nfr, seed, Nparticles);
  //long long endParticleFilter = get_time();
  //printf("PARTICLE FILTER TOOK %f\n", elapsed_time(endVideoSequence, endParticleFilter));
  //printf("ENTIRE PROGRAM TOOK %f\n", elapsed_time(start, endParticleFilter));

  free(seed);
  free(I);

#ifdef VERIFY
  if (passed == 1) {
    printf("PASSED.\n");
  } else {
    printf("FAILED.\n");
  }
#endif

  stop_timer(timer_ctrl);
  printf("Execution time %lld us\n\r", elapsed_time());
}