1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Drawing;
- using Emgu.CV;
- using Emgu.CV.Structure;
- namespace bbiwarg.Graphics
- {
- class OutputImage
- {
- public Image<Rgb, byte> Image { get; private set; }
- public OutputImage(int width, int height)
- {
- Image = new Image<Rgb, byte>(width, height);
- }
- public void drawLineSegment(bbiwarg.Utility.LineSegment2D lineSegment, byte r, byte g, byte b, int thickness = 1)
- {
- Image.Draw(new LineSegment2D(lineSegment.P1, lineSegment.P2), new Rgb(r, g, b), thickness);
- }
- public void drawContour(Contour<Point> contour, byte r, byte g, byte b, int thickness = 1)
- {
- Image.Draw(contour, new Rgb(r, g, b), thickness);
- }
- public void drawPoints(Seq<Point> points, byte r, byte g, byte b, int thickness = 1)
- {
- Image.Draw(points, new Rgb(r, g, b), thickness);
- }
- public void drawPixel(int x, int y, byte r, byte g, byte b)
- {
- Image.Data[y, x, 0] = r;
- Image.Data[y, x, 1] = g;
- Image.Data[y, x, 2] = b;
- }
- public void fillCircle(int x, int y, float radius, byte r, byte g, byte b)
- {
- Image.Draw(new CircleF(new PointF(x, y), radius), new Rgb(r, g, b), 0);
- }
- }
- }
|