public void CatchShootExceptionTest() { ShootingException exception = new ShootingException(); IImageHandler imageHandler = (IImageHandler)_mockery.NewMock(typeof(IImageHandler)); IShootParameters parameters = (IShootParameters)_mockery.NewMock(typeof(IShootParameters)); Expect.Once.On(_camera).Method("LockUI").WithNoArguments(); Expect.Once.On(parameters).Method("ApplyTo").With(_camera); Expect.Once.On(_camera).Method("Shoot").WithNoArguments().Will(Throw.Exception(exception)); Expect.Once.On(_camera).Method("UnlockUI").WithNoArguments(); CameraProcessor processor = new CameraProcessor(_camera, _cameraInfo); try { //processor.MakeAShoot(parameters, imageHandler); Assert.Fail(); } catch (Exception anException) { Assert.AreEqual(exception, anException); } _mockery.VerifyAllExpectationsHaveBeenMet(); }
public AvatarsController(IImageHandler imageHandler, IUserService userService, IHubContext <ChatHub> hubContext, IConnectionMapping <string> connectionMapping) { this.imageHandler = imageHandler; this.userService = userService; this.hubContext = hubContext; this.connectionMapping = connectionMapping; }
public void InputImageChanged() { if (Input == null) { Output?.FreeComputingDevice(); Output = null; OnImageUpdated(new ImageUpdatedEventData(true)); return; } if (Input != _oldInput) { if (_oldInput != null) { _oldInput.ImageUpdated -= InputOnImageUpdated; } Input.ImageUpdated += InputOnImageUpdated; _oldInput = Input; } if (Output != null && Output.SizeEquals(Input)) { return; } Output = ImageHandler.Create("fft result", Input.Width, Input.Height, ImageFormat.RealImaginative, ImagePixelFormat.Float); Output.UploadToComputingDevice(); OnImageUpdated(new ImageUpdatedEventData(true)); Process(); }
public Fourier(int width, int height) { _width = width; _height = height; _n = width; // n должно быть четным if (_n % 2 != 0) { _n--; } _m = OddDenominator(_n); // нечетный делитель ширины изображения _l = _n / _m; // четный делитель ширины изображения _t = PowerOfTwo(_l); _transposed = ImageHandler.Create("transponed", height, width, ImageFormat.RealImaginative, ImagePixelFormat.Float); _app = Singleton.Get <OpenClApplication>(); _splitFftKernel = _app.Program.CreateKernel("splitFft"); _mergeFftKernel = _app.Program.CreateKernel("mergeFft"); _spinFactKernel = _app.Program.CreateKernel("spinFact"); _butterflyKernel = _app.Program.CreateKernel("butterfly"); _bitReverseKernel = _app.Program.CreateKernel("bitReverseKernel"); _tmpBuffer = new ComputeBuffer <Vector2>(_app.ComputeContext, ComputeMemoryFlags.None, width * height); _tmpBuffer2 = new ComputeBuffer <Vector2>(_app.ComputeContext, ComputeMemoryFlags.None, width * height); _spinFactBuffer = new ComputeBuffer <Vector2>(_app.ComputeContext, ComputeMemoryFlags.None, _n / 2); GenerateSpinFactor(); }
public void FastTransform(IImageHandler input, IImageHandler output = null) { using (new Timer("Fast transform")) { if (output == null) { _app.Acquire(input, _transposed); } else { _app.Acquire(input, output, _transposed); } Pass(input, output); ImageUtils.Transpose(output ?? input, _transposed); Pass(_transposed); ImageUtils.Transpose(_transposed, output ?? input); // ImageUtils.CyclicShift(output); if (output == null) { _app.Release(input, _transposed); } else { _app.Release(input, output, _transposed); } } }
public static Bitmap Generate(IImageHandler imageHandler) { if (imageHandler.OpenGlTextureId.HasValue) { using (new Timer("Get Reduced Image")) { var app = Singleton.Get <OpenClApplication>(); int workSize = (int)Math.Floor(Math.Min((float)imageHandler.Width / ThumbnailWidth, (float)imageHandler.Height / ThumbnailHeight)); var bufferWidth = imageHandler.Width / workSize; var bufferHeight = imageHandler.Height / workSize; var buffer = new float[bufferHeight * bufferWidth]; var computeBuffer = new ComputeBuffer <float>(app.ComputeContext, ComputeMemoryFlags.WriteOnly, buffer); app.Acquire(imageHandler); app.ExecuteKernel("reduce", bufferWidth, bufferHeight, imageHandler, computeBuffer, workSize, imageHandler.Width, imageHandler.Height, bufferWidth); app.Queue.ReadFromBuffer(computeBuffer, ref buffer, true, null); app.Release(imageHandler); return(Generate(ImageUtils.BitmapFromArray(buffer, bufferWidth, bufferHeight))); } } return(Generate(imageHandler.ToBitmap())); }
public MemeService(IMemeRepository memeRepository, IMapper mapper, IImageHandler imageHandler) { _memeRepository = memeRepository; _mapper = mapper; _imageHandler = imageHandler; }
public ImageController(DatabaseContext context, IImageHandler imageHandler, IOptions <CloudinaryKeys> options) { _imageHandler = imageHandler; _options = options; _context = context; Console.WriteLine(_options.Value.CloudName); }
public void Compute(IImageHandler input, IImageHandler output, float wavelength, float distance, float objectSize, bool cyclicShift) { if (input.Width != _width || input.Height != _height) { throw new InvalidOperationException("Неожиданные размеры изображения."); } if (wavelength != _wavelength || distance != _distance || objectSize != _objectSize) { _wavelength = wavelength; _distance = distance; _objectSize = objectSize; App.ExecuteKernel("freshnelGenerateInnerMultipliers", _width, 1, _freshnelInnerMultipliersX, _wavelength / 1000f, _distance * 1000f, (float)_width, _objectSize * 1000f); App.ExecuteKernel("freshnelGenerateInnerMultipliers", _height, 1, _freshnelInnerMultipliersY, _wavelength / 1000f, _distance * 1000f, (float)_height, _objectSize * 1000f); } App.ExecuteKernel("freshnelMultiplyInner", _width, _height, input, output, _freshnelInnerMultipliersX, _freshnelInnerMultipliersY); Fourier.Transform(output); App.ExecuteKernel("freshnelMultiplyInner", _width, _height, output, output, _freshnelInnerMultipliersX, _freshnelInnerMultipliersY); if (cyclicShift) { ImageUtils.CyclicShift(output); } }
public void StartListenTakeImage(ICameraInfo cameraInfo, IImageHandler imageHandler) { ICamera camera = GetCameraProcessor(cameraInfo).Camera; camera.SaveToValue = (uint)SaveToEnum.Save_by_downloading_to_a_host_computer; camera.SetDownloadImageHandler(imageHandler); }
public static void MapBackground(IImageHandler handler, IImage image) { handler.UpdateValue(nameof(IViewHandler.ContainerView)); handler.ToPlatform().UpdateBackground(image); handler.ToPlatform().UpdateOpacity(image); }
public ProfileController(IProfileObjectsRepository r, IFollowingObjectsRepository followingRepository, UserManager <IdentityUser> userManager, IImageHandler imageHandler) { _profileRepository = r; _followingRepository = followingRepository; _userManager = userManager; _imageHandler = imageHandler; }
public UsersController(IUsersQueryProcessor query, IMapper mapper, IImageHandler imageHandler, ISecurityContext context, ILeaguesQueryProcessor leaguesQueryProcessor) { _query = query; _mapper = mapper; _imageHandler = imageHandler; _context = context; _leaguesQueryProcessor = leaguesQueryProcessor; }
public NewsController(INewsService newsService, ICategoryService categoryService, IImageHandler imageHandler, IImageService imageService, IMapper mapper) { NewsService = newsService; CategoryService = categoryService; ImageHandler = imageHandler; ImageService = imageService; Mapper = mapper; }
public static Task MapSourceAsync(IImageHandler handler, IImage image) { if (handler.PlatformView == null) return Task.CompletedTask; handler.PlatformView.Clear(); return handler.SourceLoader.UpdateImageSourceAsync(); }
public ServicesController(ServicesContext context, IResponce responce, IConfiguration configuration, IImageHandler imageHandler) { _context = context; _responce = responce; _configuration = configuration; _imageHandler = imageHandler; }
public LoginController(ILoginQueryProcessor query, IMapper mapper, IImageHandler imageHandler, ISecurityContext context, IUsersQueryProcessor userQuery) { _query = query; _mapper = mapper; _imageHandler = imageHandler; _context = context; _userQuery = userQuery; }
public ImagesController(IImageHandler imageHandler, IIndividualsRepository repository, IImageWriter imageWriter) { _imageHandler = imageHandler; _repository = repository; _imageWriter = imageWriter; }
private void SendShootCommand(IImageHandler imageHandler, uint command, int value) { CameraAlreadyDisposedException.ThrowIf(_disposed); lock (_synchronizationObject) { SDKHelper.CheckError(EDSDK.EdsSendCommand(_pointer, command, value)); _imageHandler = imageHandler; } }
public ImageWorkspacePanelItemController(IImageHandler imageHandler, WorkspacePanelItem view) : base(view) { ImageHandler = imageHandler; if (ImageHandler != null) { ImageHandler.ImageUpdated += data => UpdateView(); } }
public static void Interference(IImageHandler image1, IImageHandler image2, IImageHandler output) { if (!image1.SizeEquals(image1) || !output.SizeEquals(image1)) { throw new InvalidOperationException("Изображения должны быть одинакового размера."); } Singleton.Get <OpenClApplication>().ExecuteKernel("interference", output.Width, output.Height, image1.ComputeBuffer, image2.ComputeBuffer, output.ComputeBuffer); }
public static void Combine(IImageHandler amplitudeImage, IImageHandler phaseImage, IImageHandler output) { if (!amplitudeImage.SizeEquals(phaseImage) || !amplitudeImage.SizeEquals(output)) { throw new InvalidOperationException("Изображения должны быть одинакового размера."); } Singleton.Get <OpenClApplication>().ExecuteKernel("combineAmplitudeAndPhase", output.Width, output.Height, amplitudeImage.ComputeBuffer, phaseImage.ComputeBuffer, output.ComputeBuffer); }
public static void Divide(IImageHandler image, float num, IImageHandler output) { if (!image.SizeEquals(output)) { throw new InvalidOperationException("Изображения должны быть одинакового размера."); } Singleton.Get <OpenClApplication>().ExecuteKernel("divideByNum", output.Width, output.Height, image.ComputeBuffer, output.ComputeBuffer, num); }
public Image(int width, int height, string path, IExecutor executor, IImageHandler handler) { CheckImageSize(width, height); Width = width; Height = height; Path = path; _executor = executor; ImageHandler = handler; }
/// <summary> /// Попиксельное деление комплексных изображения /// </summary> /// <param name="numerator">Делимое</param> /// <param name="denumerator">Делитель</param> public static void Divide(IImageHandler numerator, IImageHandler denumerator, IImageHandler output) { if (!numerator.SizeEquals(denumerator) || !numerator.SizeEquals(output)) { throw new InvalidOperationException("Изображения должны быть одинакового размера."); } Singleton.Get <OpenClApplication>().ExecuteKernel("divide", output.Width, output.Height, numerator.ComputeBuffer, denumerator.ComputeBuffer, output.ComputeBuffer); }
public staffController(ServicesContext context, IResponce responce, IImageHandler imageHandler, IAutentication auth, IConfiguration configuration) { _context = context; _responce = responce; _imageHandler = imageHandler; _auth = auth; _configuration = configuration; }
public AccountsController(ServicesContext context, IAccount account, IResponce responce, IImageHandler imageHandler, IConfiguration configuration) { _context = context; _configuration = configuration; _account = account; _responce = responce; _imageHandler = imageHandler; }
public static void Transpose(IImageHandler input, IImageHandler output) { if (output.Height != input.Width || output.Width != input.Height) { throw new InvalidOperationException("Не подходящие размеры изображения вывода."); } Singleton.Get <OpenClApplication>().ExecuteKernel("transpose_img", input.Width, input.Height, input, output); }
public ImageController( IImageHandler imageHandler, IOptions <CloudinaryKeys> options, DatabaseContext context) { _imageHandler = imageHandler; _options = options; _context = context; }
public static void Shift(IImageHandler input, IImageHandler output, int dx, int dy, bool cyclic) { if (!input.SizeEquals(output)) { throw new InvalidOperationException("Изображения должны быть одинакового размера."); } Singleton.Get <OpenClApplication>().ExecuteKernel("shift", input.Width, input.Height, input.ComputeBuffer, output.ComputeBuffer, dx, dy, cyclic ? 1 : 0); }