Ejemplo n.º 1
0
/* 
 * stop camera and discard context
 */
int StopCam(double *dContext)
{
    FlyCaptureError error;
    FlyCaptureContext context = (long)*dContext;
              
    if (*dContext ==-1)
    {
        printf("\nWrong camera number was entered during InitCam call");
        return;
    }
    
    error=flycaptureStop(context);
    if ( error != FLYCAPTURE_OK )
    {
        printf( "flycaptureStop: %s\n", flycaptureErrorToString( error ) );
        return 0;
    }


    error = flycaptureDestroyContext(context);
    if ( error != FLYCAPTURE_OK )
    {
        printf( "flycaptureDestroyContext: %s\n", flycaptureErrorToString( error ) );
        return 0;
    }
    
    printf("CAMERA STOPPED\n");
    
    return 1;     
}
Ejemplo n.º 2
0
void _HANDLE_ERROR(FlyCaptureError error, std::string function ) {
	   if( error != FLYCAPTURE_OK ) 
	   { 
		  printf( "%s: %s\n", function.c_str(), flycaptureErrorToString( error ) ); 
		  //char c;
		  //scanf("%c",&c);
		  return; 
	   } 
	}
Ejemplo n.º 3
0
void 
CTimeSliceDoc::grabAndCheckSync()
{
   unsigned nCamera;

   //
   // Grab an image from each camera.
   //
   for( nCamera = 0; nCamera < m_uiNumCameras; nCamera++ )
   {
      CameraInfo& camera = m_arCameraInfo[ nCamera ];
      
      camera.m_error = ::flycaptureLockNext( camera.m_context, &camera.m_image );
      if( camera.m_error != FLYCAPTURE_OK )
      {
         TRACE( 
            "flycaptureLockNext() failed with %s", 
            ::flycaptureErrorToString( camera.m_error ) );
      }
      
      camera.m_imageProcessed.pixelFormat = FLYCAPTURE_BGRU;
      
      camera.m_error = flycaptureConvertImage( 
         camera.m_context, 
         &camera.m_image.image, 
         &camera.m_imageProcessed );
      if( camera.m_error != FLYCAPTURE_OK )
      {
         TRACE( 
            "flycaptureConvertImage() returned an error (\"%s\")\n",
            flycaptureErrorToString( camera.m_error ) );
         continue;
      }
      
   }
   
   //
   // Check if the images are synchronized.
   //
#ifdef COUNT_OUT_OF_SYNC
   for( nCamera = 1; nCamera < m_uiNumCameras; nCamera++ )
   {
      int iDeltaFrom0 =      
         abs( (int)( (  
            m_arCameraInfo[ nCamera ].m_image.image.timeStamp.ulCycleSeconds * 8000 +
            m_arCameraInfo[ nCamera ].m_image.image.timeStamp.ulCycleCount ) -
         (  m_arCameraInfo[ 0       ].m_image.image.timeStamp.ulCycleSeconds * 8000 +
            m_arCameraInfo[ 0       ].m_image.image.timeStamp.ulCycleCount ) ) );

      if( ( iDeltaFrom0 % ( 128 * 8000 - 1 ) ) > SYNC_TOLERANCE )
      {
         m_uiOutOfSyncImages++;
         break;
      }
   }
#endif

   //
   // Check the sequence numbers to see if we have missed an image.
   //
   for( nCamera = 0; nCamera < m_uiNumCameras; nCamera++ )
   {
      CameraInfo& camera = m_arCameraInfo[ nCamera ];
      
      if( camera.m_uiPrevSeqNum != 0 )
      {
         int iDelta = camera.m_image.uiSeqNum - camera.m_uiPrevSeqNum;
         //ASSERT( iDelta > 0 );
         
         if( iDelta > 1 )
         {
            m_uiMissedImages += ( iDelta - 1 );
         }
      }
      
      camera.m_uiPrevSeqNum = camera.m_image.uiSeqNum;
   }
}