Exemple #1
0
        public Task Init(byte[] imageData, Rectangle roi, EmguCvTrackingConfiguration.Algorithm algorithm) => Task.Run(() =>
        {
            switch (algorithm)
            {
            case EmguCvTrackingConfiguration.Algorithm.Boosting:
                _tracker = new TrackerBoosting();
                break;

            case EmguCvTrackingConfiguration.Algorithm.CSRT:
                _tracker = new TrackerCSRT();
                break;

            case EmguCvTrackingConfiguration.Algorithm.GOTURN:
                _tracker = new TrackerGOTURN();
                break;

            case EmguCvTrackingConfiguration.Algorithm.KCF:
                _tracker = new TrackerKCF();
                break;

            //case EmguCvTrackingConfiguration.Algorithm.MedianFlow:
            //	_tracker = new TrackerMedianFlow();
            //	break;
            case EmguCvTrackingConfiguration.Algorithm.MIL:
                _tracker = new TrackerMIL();
                break;

            case EmguCvTrackingConfiguration.Algorithm.MOSSE:
                _tracker = new TrackerMOSSE();
                break;

            case EmguCvTrackingConfiguration.Algorithm.TLD:
                _tracker = new TrackerTLD();
                break;

            default:
                throw new NotImplementedException($"Tracker of type {algorithm} is not yet supported.");
            }

            using (var mat = CreateMat(imageData))
            {
                _tracker.Init(mat, roi);
            }
        });
        public async Task <IEmguCvTracker> CreateEmguCvTracker(byte[] imageData, Rectangle roi, EmguCvTrackingConfiguration.Algorithm algorithm)
        {
            var tracker = new EmguCvTracker();
            await tracker.Init(imageData, roi, algorithm);

            return(tracker);
        }