Browse Source

Minor bug fix for MotionDetection Example.

EMGUCV_3_1
Canming Huang 9 years ago
parent
commit
215ecc89d1
  1. 1
      Emgu.CV.Example/MotionDetection/Form1.cs
  2. 7
      Emgu.CV/Cvb/CvBlobDetector.cs
  3. 17
      Emgu.Util/Toolbox.cs

1
Emgu.CV.Example/MotionDetection/Form1.cs

@ -82,6 +82,7 @@ namespace MotionDetection
//create the motion image
Mat motionImage = new Mat(motionMask.Size.Height, motionMask.Size.Width, DepthType.Cv8U, 3);
motionImage.SetTo(new MCvScalar(0));
//display the motion pixels in blue (first channel)
//motionImage[0] = motionMask;
CvInvoke.InsertChannel(motionMask, motionImage, 0);

7
Emgu.CV/Cvb/CvBlobDetector.cs

@ -25,11 +25,8 @@ namespace Emgu.CV.Cvb
private uint[,] _data;
private GCHandle _dataHandle;
#if NETFX_CORE
private static int _sizeOfUInt32 = Marshal.SizeOf<UInt32>();
#else
private static int _sizeOfUInt32 = Marshal.SizeOf(typeof(UInt32));
#endif
private static int _sizeOfUInt32 = Toolbox.SizeOf<UInt32>();
/// <summary>
/// Detect blobs from input image.
/// </summary>

17
Emgu.Util/Toolbox.cs

@ -105,8 +105,23 @@ namespace Emgu.Util
using (StringReader stringReader = new StringReader(xmlString))
return (T) (new XmlSerializer(typeof(T))).Deserialize(stringReader);
}
#endregion
#endregion
#endif
/// <summary>
/// Similar to Marshal.SizeOf function
/// </summary>
/// <typeparam name="T">The type</typeparam>
/// <returns>The size of T in bytes</returns>
public static int SizeOf<T>()
{
#if NETFX_CORE
return Marshal.SizeOf<T>();
#else
return Marshal.SizeOf(typeof(T));
#endif
}
/*
/// <summary>
/// Read a text file to an array of string, each row are separated using by the input separator

Loading…
Cancel
Save