コード例 #1
0
        public NeedleResult GetNeedle(NeedleKey needle)
        {
            NeedleResult result = null;

            needles.TryGetValue(needle, out result);
            return(result);
        }
コード例 #2
0
        public override void Run()
        {
            var cached = true;

            this.searchResult = state.GetOrAddNeedle(needle, () =>
            {
                cached            = false;
                var image         = state.Image(needle.Key).Clone();
                var magnification = 0.1;
                image.Resize(new Percentage(magnification * 100));

                var result = FindHighEntropyStrip(image, needle.Gravity, NeedleSize * magnification, this);

                result.Point.X /= magnification;
                result.Point.Y /= magnification;
                return(result);
            });

            var resultLabel = $"Not found ({searchResult.Entropy})";

            if (searchResult.MeetsThreshold())
            {
                resultLabel = $"Found at ({searchResult.Point}), {searchResult.Entropy}";
            }
            Complete(resultLabel, cached);
        }