コード例 #1
0
        public Image <Rgba32> AddFilter(IImageFilter filter)
        {
            using (var context = new Context())
            {
                var acceleratorId = Accelerator.Accelerators.Where(a =>
                                                                   a.AcceleratorType == AcceleratorType.CPU)
                                    .FirstOrDefault();

                using (var accelerator = Accelerator.Create(context, acceleratorId))
                {
                    return(filter.PerformFilter(accelerator));
                }
            }
        }
コード例 #2
0
ファイル: AdaptiveWorkflow.cs プロジェクト: rbua/Magimage
        public Image<Rgba32> AddFilter(IImageFilter filter)
        {
            using (var context = new Context())
            {
                AcceleratorId acceleratorId = new AcceleratorId();
                if (Accelerator.Accelerators.Where(a => a.AcceleratorType == AcceleratorType.Cuda).Count() != 0)
                {
                    acceleratorId = Accelerator.Accelerators.Where(a =>
                    a.AcceleratorType == AcceleratorType.Cuda)
                        .FirstOrDefault();
                }
                else
                {
                    acceleratorId = Accelerator.Accelerators.Where(a => a.AcceleratorType == AcceleratorType.CPU).FirstOrDefault();
                }

                using (var accelerator = Accelerator.Create(context, acceleratorId))
                {
                    return filter.PerformFilter(accelerator);
                }
            }
        }