예제 #1
0
static void set_( ChunkData& d, boost::posix_time::ptime& t, const Pylon::GrabResult& result, Pylon::CBaslerGigECamera& camera )
{
    parser->AttachBuffer( ( unsigned char* ) result.Buffer(), result.GetPayloadSize() );
    d.timestamp = t;
    d.frames = camera.ChunkFramecounter.GetValue();
    d.ticks = camera.ChunkTimestamp.GetValue();
    d.line_trigger_ignored = camera.ChunkLineTriggerIgnoredCounter.GetValue();
    d.frame_trigger_ignored = camera.ChunkFrameTriggerIgnoredCounter.GetValue();
    d.line_trigger_end_to_end = camera.ChunkLineTriggerEndToEndCounter.GetValue();
    d.frame_trigger = camera.ChunkFrameTriggerCounter.GetValue();
    d.frames_per_trigger = camera.ChunkFramesPerTriggerCounter.GetValue();
    parser->DetachBuffer();
}
예제 #2
0
  bool convertFrom(Pylon::GrabResult Result) {
    const struct Pylon::SImageFormat format=getInFormat(Result);
    bool init=false;

#ifdef HAVE_LIBPYLONUTILITY
    if(!converter)init=true;
    if(converter && !converter->IsInitialized())init=true;
#endif

    if(format!=inFormat)init=true;
    
    if(init) {
      makeConverter(format);
      inFormat=format;      
    }


    image.xsize=inFormat.Width;
    image.ysize=inFormat.Height;
    image.reallocate();
    
    if(0) {; 
#ifdef HAVE_LIBPYLONUTILITY
    } else if(converter) {
      const struct Pylon::SOutputImageFormat oformat=getOutFormat(image);
      converter->Convert(image.data,
                         image.xsize*image.ysize*image.csize,
                         Result.Buffer(),
                         Result.GetPayloadSize(),
                         format,
                         oformat);
#endif
    } else {
      if(image.format==GL_RGBA)
        image.fromRGBA(reinterpret_cast<unsigned char*>(Result.Buffer()));
      else
        image.fromGray(reinterpret_cast<unsigned char*>(Result.Buffer()));
    }
    return true;
  }