1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using bbiwarg.Images;
- using bbiwarg.Output;
- using Emgu.CV;
- using Emgu.CV.Structure;
- using bbiwarg.Utility;
- namespace bbiwarg.Images
- {
- /// <summary>
- /// ConfidenceImage stores the raw confidence data read from the Camera as an <see cref="Image"/>.
- /// </summary>
- public class ConfidenceImage
- {
- /// <summary>
- /// the size of the confidence image
- /// </summary>
- public ImageSize Size { get; private set; }
- /// <summary>
- /// the confidence image
- /// </summary>
- public Image<Gray, Int16> Image { get; private set; }
- /// <summary>
- /// a mask image, which is 1 iff the the confidence value is greater than <see cref="Parameters.ConfidenceImageMinThreshold"/>
- /// </summary>
- public Image<Gray, byte> Mask { get; private set; }
- /// <summary>
- /// Constructs a new ConfidenceImage using the specified data and size.
- /// </summary>
- /// <param name="rawConfidenceData">pointer to raw confidence data</param>
- /// <param name="size">size of the confidence image</param>
- public ConfidenceImage(IntPtr rawConfidenceData, ImageSize size)
- {
- Size = size;
- Image = new Image<Gray, Int16>(Size.Width, Size.Height, size.Width * 2, rawConfidenceData);
- Mask = (Image.ThresholdBinary(new Gray(Parameters.ConfidenceImageMinThreshold), new Gray(1))).Convert<Gray, byte>();
- }
- }
- }
|