Exemple #1
0
 protected void Dispose(bool IsDisposing)
 {
     if (_background != null)
     {
         _background.Dispose();
         _background = null;
     }
     if (_foreground != null)
     {
         _foreground.Dispose();
         _foreground = null;
     }
     if (_thresholded != null)
     {
         _thresholded.Dispose();
         _thresholded = null;
     }
     if (_calc1 != null)
     {
         _calc1.Dispose();
         _calc1 = null;
     }
     if (_strel != null)
     {
         _strel.Dispose();
         _strel = null;
     }
     if (_angleStore != null)
     {
         System.Runtime.InteropServices.Marshal.FreeHGlobal((IntPtr)_angleStore);
         _angleStore = null;
     }
 }
Exemple #2
0
 /// <summary>
 /// Creates a new tail tracker
 /// </summary>
 /// <param name="regionToTrack">The ROI in which we should track the tail</param>
 /// <param name="tailStart">The designated starting point of the tail</param>
 /// <param name="tailEnd">The designated end point of the tail</param>
 /// <param name="nsegments">The number of tail segments to track btw. start and end</param>
 public TailTracker(IppiSize imageSize, IppiPoint tailStart, IppiPoint tailEnd, int nsegments)
 {
     _threshold = 20;
     _morphSize = 8;
     _frameRate = 200;
     _strel     = BWImageProcessor.GenerateDiskMask(_morphSize);
     _nSegments = 5;
     _imageSize = imageSize;
     _tailStart = tailStart;
     _tailEnd   = tailEnd;
     //set up our track regions based on the tail positions
     DefineTrackRegions();
     NSegments = nsegments;
     InitializeImageBuffers(); //set up image buffers
     InitializeScanPoints();   //create scan points appropriate for the tail parameters
     //Initialize our angle store for tracking (size never changes)
     _angleStore = (int *)System.Runtime.InteropServices.Marshal.AllocHGlobal(900 * 4);
 }