1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Emgu.CV;
- using Emgu.CV.Structure;
- using bbiwarg.Utility;
- using bbiwarg.Detectors.Fingers;
- namespace bbiwarg.Images
- {
- public enum FingerImageState {
- none = 0,
- possibleFingerSlice = 1,
- fingerSlice = 2,
- fingerDetected = 3,
- fingerTracked = 4
- }
- class FingerImage
- {
- private Image<Gray, byte> image;
- public FingerImage(int width, int height) {
- image = new Image<Gray, byte>(width, height);
- }
- public FingerImageState getStateAt(int x, int y) {
- return (FingerImageState)image.Data[y, x, 0];
- }
- public void drawFinger(Finger finger, FingerImageState state) {
- FingerSliceTrail trail = finger.SliceTrail;
- for (int i = 0; i < trail.NumSlices; i++) {
- drawLine(trail[i].Line, FingerImageState.fingerSlice);
- }
- drawLine(finger.LineSegment, state);
- }
- public void drawLine(Utility.LineSegment2D line, FingerImageState state)
- {
- image.Draw(new LineSegment2DF(line.P1, line.P2), new Gray((byte)state), 1);
- }
- }
- }
|