/// <summary> /// Prints tracks information. /// </summary> /// <param name="imgSource">Input image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="imgDest">Output image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="mode">Render mode. By default is CV_TRACK_RENDER_ID.</param> /// <param name="font">OpenCV font for print on the image.</param> public void Render(IplImage imgSource, IplImage imgDest, RenderTracksMode mode, CvFont font) { if (imgSource == null) { throw new ArgumentNullException(nameof(imgSource)); } if (imgDest == null) { throw new ArgumentNullException(nameof(imgDest)); } if (imgDest.Depth != BitDepth.U8) { throw new ArgumentException("imgDest.Depth != U8"); } if (imgDest.NChannels != 3) { throw new ArgumentException("imgDest.NChannels != 3"); } if ((mode & RenderTracksMode.Id) == RenderTracksMode.Id && font == null) { font = new CvFont(FontFace.HersheyDuplex, 0.5, 0.5, 0, 1); } if (mode != RenderTracksMode.None) { foreach (KeyValuePair <int, CvTrack> kv in this) { int key = kv.Key; CvTrack value = kv.Value; if ((mode & RenderTracksMode.Id) == RenderTracksMode.Id) { if (value.Inactive == 0) { Cv.PutText(imgDest, key.ToString(), value.Centroid, font, CvColor.Green); } } if ((mode & RenderTracksMode.BoundingBox) == RenderTracksMode.BoundingBox) { if (value.Inactive > 0) { Cv.Rectangle( imgDest, new CvPoint(value.MinX, value.MinY), new CvPoint(value.MaxX - 1, value.MaxY - 1), new CvColor(0, 0, 50)); } else { Cv.Rectangle( imgDest, new CvPoint(value.MinX, value.MinY), new CvPoint(value.MaxX - 1, value.MaxY - 1), new CvColor(0, 0, 255)); } } } } }
/// <summary> /// Prints tracks information. /// </summary> /// <param name="tracks">List of tracks.</param> /// <param name="imgSource">Input image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="imgDest">Output image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="mode">Render mode. By default is CV_TRACK_RENDER_ID.</param> public static void RenderTracks(CvTracks tracks, Mat imgSource, Mat imgDest, RenderTracksMode mode) { if (tracks == null) { throw new ArgumentNullException(nameof(tracks)); } tracks.Render(imgSource, imgDest, mode); }
/// <summary> /// Prints tracks information. /// </summary> /// <param name="tracks">List of tracks.</param> /// <param name="imgSource">Input image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="imgDest">Output image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="mode">Render mode. By default is CV_TRACK_RENDER_ID.</param> /// <param name="textColor"></param> /// <param name="fontFace"></param> /// <param name="fontScale"></param> /// <param name="thickness"></param> public static void RenderTracks(CvTracks tracks, Mat imgSource, Mat imgDest, RenderTracksMode mode, Scalar textColor, HersheyFonts fontFace = HersheyFonts.HersheySimplex, double fontScale = 1d, int thickness = 1) { if (tracks == null) { throw new ArgumentNullException(nameof(tracks)); } tracks.Render(imgSource, imgDest, mode, textColor, fontFace, fontScale, thickness); }
/// <summary> /// Prints tracks information. /// </summary> /// <param name="imgSource">Input image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="imgDest">Output image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="mode">Render mode. By default is CV_TRACK_RENDER_ID.</param> /// <param name="textColor"></param> /// <param name="fontFace"></param> /// <param name="fontScale"></param> /// <param name="thickness"></param> public void Render(Mat imgSource, Mat imgDest, RenderTracksMode mode, Scalar textColor, HersheyFonts fontFace = HersheyFonts.HersheySimplex, double fontScale = 1d, int thickness = 1) { if (imgSource == null) { throw new ArgumentNullException(nameof(imgSource)); } if (imgDest == null) { throw new ArgumentNullException(nameof(imgDest)); } if (imgDest.Type() != MatType.CV_8UC3) { throw new ArgumentException("imgDest.Depth != U8 || imgDest.NChannels != 3"); } if (mode != RenderTracksMode.None) { foreach (KeyValuePair <int, CvTrack> kv in this) { int key = kv.Key; CvTrack value = kv.Value; if ((mode & RenderTracksMode.Id) == RenderTracksMode.Id) { if (value.Inactive == 0) { Cv2.PutText(imgDest, key.ToString(), (Point)value.Centroid, fontFace, fontScale, textColor, thickness); } } if ((mode & RenderTracksMode.BoundingBox) == RenderTracksMode.BoundingBox) { if (value.Inactive > 0) { Cv2.Rectangle( imgDest, new Point(value.MinX, value.MinY), new Point(value.MaxX - 1, value.MaxY - 1), new Scalar(50, 0, 0)); } else { Cv2.Rectangle( imgDest, new Point(value.MinX, value.MinY), new Point(value.MaxX - 1, value.MaxY - 1), new Scalar(255, 0, 0)); } } } } }
/// <summary> /// Prints tracks information. /// </summary> /// <param name="tracks">List of tracks.</param> /// <param name="imgSource">Input image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="imgDest">Output image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="mode">Render mode. By default is CV_TRACK_RENDER_ID.</param> /// <param name="font">OpenCV font for print on the image.</param> public static void RenderTracks(CvTracks tracks, IplImage imgSource, IplImage imgDest, RenderTracksMode mode, CvFont font) { if (tracks == null) throw new ArgumentNullException("tracks"); if (imgSource == null) throw new ArgumentNullException("imgSource"); if (imgDest == null) throw new ArgumentNullException("imgDest"); IntPtr fontPtr = (font == null) ? IntPtr.Zero : font.CvPtr; CvBlobInvoke.cvb_cvRenderTracks(tracks.CvPtr, imgSource.CvPtr, imgDest.CvPtr, mode, fontPtr); }
/// <summary> /// Prints tracks information. /// </summary> /// <param name="tracks">List of tracks.</param> /// <param name="imgSource">Input image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="imgDest">Output image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="mode">Render mode. By default is CV_TRACK_RENDER_ID.</param> public static void RenderTracks(CvTracks tracks, IplImage imgSource, IplImage imgDest, RenderTracksMode mode) { RenderTracks(tracks, imgSource, imgDest, mode, null); }
/// <summary> /// Prints tracks information. /// </summary> /// <param name="tracks">List of tracks.</param> /// <param name="imgSource">Input image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="imgDest">Output image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="mode">Render mode. By default is CV_TRACK_RENDER_ID.</param> /// <param name="textColor"></param> /// <param name="fontFace"></param> /// <param name="fontScale"></param> /// <param name="thickness"></param> public static void RenderTracks(CvTracks tracks, Mat imgSource, Mat imgDest, RenderTracksMode mode, Scalar textColor, HersheyFonts fontFace = HersheyFonts.HersheySimplex, double fontScale = 1d, int thickness = 1) { if (tracks == null) throw new ArgumentNullException(nameof(tracks)); tracks.Render(imgSource, imgDest, mode, textColor, fontFace, fontScale, thickness); }
/// <summary> /// Prints tracks information. /// </summary> /// <param name="tracks">List of tracks.</param> /// <param name="imgSource">Input image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="imgDest">Output image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="mode">Render mode. By default is CV_TRACK_RENDER_ID.</param> public static void RenderTracks(CvTracks tracks, Mat imgSource, Mat imgDest, RenderTracksMode mode) { if (tracks == null) throw new ArgumentNullException(nameof(tracks)); tracks.Render(imgSource, imgDest, mode); }
/// <summary> /// Prints tracks information. /// </summary> /// <param name="tracks">List of tracks.</param> /// <param name="imgSource">Input image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="imgDest">Output image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="mode">Render mode. By default is CV_TRACK_RENDER_ID.</param> /// <param name="font">OpenCV font for print on the image.</param> public static void RenderTracks(CvTracks tracks, IplImage imgSource, IplImage imgDest, RenderTracksMode mode, CvFont font) { if (tracks == null) { throw new ArgumentNullException("tracks"); } tracks.Render(imgSource, imgDest, mode, font); }
/// <summary> /// Prints tracks information. /// </summary> /// <param name="imgSource">Input image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="imgDest">Output image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="mode">Render mode. By default is CV_TRACK_RENDER_ID.</param> public void Render(IplImage imgSource, IplImage imgDest, RenderTracksMode mode) { Render(imgSource, imgDest, mode, null); }
/// <summary> /// Prints tracks information. /// </summary> /// <param name="tracks">List of tracks.</param> /// <param name="imgSource">Input image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="imgDest">Output image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="mode">Render mode. By default is CV_TRACK_RENDER_ID.</param> /// <param name="font">OpenCV font for print on the image.</param> public static void RenderTracks(CvTracks tracks, IplImage imgSource, IplImage imgDest, RenderTracksMode mode, CvFont font) { if (tracks == null) throw new ArgumentNullException("tracks"); tracks.Render(imgSource, imgDest, mode, font); }
/// <summary> /// Prints tracks information. /// </summary> /// <param name="imgSource">Input image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="imgDest">Output image (depth=IPL_DEPTH_8U and num. channels=3).</param> /// <param name="mode">Render mode. By default is CV_TRACK_RENDER_ID.</param> public void Render(Mat imgSource, Mat imgDest, RenderTracksMode mode) { Render(imgSource, imgDest, mode, Scalar.Green); }