/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object can be used to retrieve data from input parameters and /// to store data in output parameters.</param> protected override void SolveInstance(IGH_DataAccess DA) { Bitmap tempImg = null; string styleName = string.Empty; DA.GetData(0, ref tempImg); DA.GetData(1, ref styleName); Bitmap img = new Bitmap(tempImg); Bitmap result; try { StyleGanInput input = new StyleGanInput(styleName, img); string computed = Transponder.Post(RoutesController.StyleTransferRoute, input); StyleGanOutput output = JsonConvert.DeserializeObject <StyleGanOutput>(computed); result = output.ToBitmap(); } catch { result = default(Bitmap); } DA.SetData(0, result); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object can be used to retrieve data from input parameters and /// to store data in output parameters.</param> protected override void SolveInstance(IGH_DataAccess DA) { Bitmap tempBitmap = null; DA.GetData(0, ref tempBitmap); Bitmap img = new Bitmap(tempBitmap); Bitmap result; try { DepthMapInput input = new DepthMapInput(img); string computed = Transponder.Post(RoutesController.DepthMapRoute, input); DepthMapOutput output = JsonConvert.DeserializeObject <DepthMapOutput>(computed); result = output.ToBitmap(); } catch (Exception exc) { result = default(Bitmap); } DA.SetData(0, result); }