private Result DetectAndPaintImage(ImageInputData imageInputData, string imageFilePath) { //Predict the objects in the image _objectDetectionService.DetectObjectsUsingModel(imageInputData); var img = _objectDetectionService.DrawBoundingBox(imageFilePath); using (MemoryStream m = new MemoryStream()) { img.Image.Save(m, img.Image.RawFormat); byte[] imageBytes = m.ToArray(); var result = new Result { imageStringProcessed = imageBytes, Description = img.Description, ElapsedTime = elapsedMs }; return(result); } }
private Result DetectAndPaintImage(string imageFilePath) { //Predict the objects in the image _objectDetectionService.DetectObjectsUsingModel(imageFilePath); var img = _objectDetectionService.PaintImages(imageFilePath); using (MemoryStream m = new MemoryStream()) { img.Save(m, img.RawFormat); byte[] imageBytes = m.ToArray(); // Convert byte[] to Base64 String base64String = Convert.ToBase64String(imageBytes); var result = new Result { imageString = base64String }; return(result); } }