示例#1
0
        public async Task PrepareFolderAsync()
        {
            var folderName = Path.GetDirectoryName(f_StartName);
            var fileExt    = Path.GetExtension(f_StartName);
            var files      = Directory.GetFiles(folderName, $"*{fileExt}");

            foreach (var file in files)
            {
                var rawCluster = new RawCluster(
                    file,
                    Properties.Settings.Default.GaussianParam,
                    Properties.Settings.Default.BinarizationThreshold,
                    Properties.Settings.Default.MaxAspectRatio,
                    Properties.Settings.Default.MinPerimetherLen);
                await rawCluster.MakeCluster();

                var position = rawCluster.RelativeToPos(f_CurrentPosition);
                var pt       = new Emgu.CV.Structure.RotatedRect(
                    new System.Drawing.PointF((float)(position.X), (float)(position.Y)),
                    new System.Drawing.SizeF(),
                    0
                    );
                var markedElement = rawCluster.GetNearer(pt);

                rawCluster.CreateHexagon(markedElement);
                f_Hexagon.Add(rawCluster.Hexagon);
                f_CurrentPosition = rawCluster.GetRelativePosition(rawCluster.Hexagon.Center.Element.Center);
            }
            Application.Current.Dispatcher.Invoke(() =>
            {
                MessageBox.Show("Operation finished!");
            });
        }
示例#2
0
        private async Task PrepareFileAsync()
        {
            f_RawCluster = new RawCluster(
                f_CurrentFileName,
                Properties.Settings.Default.GaussianParam,
                Properties.Settings.Default.BinarizationThreshold,
                Properties.Settings.Default.MaxAspectRatio,
                Properties.Settings.Default.MinPerimetherLen);
            await f_RawCluster.MakeCluster();

            Dispatcher.Invoke(() => DrawUIObject(f_RawCluster.GetElements));
        }