public void VisualObjectBoundsTest()
        {
            var inputFile = InputTestFiles.FirstOrDefault(f => string.Equals(f.Name, TestImage));
            var request   = new GetVisualObjectBoundsRequest(inputFile.Name, folder: TempFolder, storage: this.TestStorage)
            {
                storage       = TestStorage,
                folder        = TempFolder,
                threshold     = 20,
                includeLabel  = true,
                includeScore  = true,
                allowedLabels = "dog",
                color         = "blue"
            };

            using (var command = new VisualObjectDetectionTestCommand(
                       request,
                       ImagingApi,
                       false,
                       true,
                       TempFolder,
                       TestStorage,
                       null))
            {
                ExecuteTestCommand(command, "objectDetection_visualobjectbounds_test", $"Input image: {inputFile.Name};", inputFile.Name,
                                   TempFolder, TestStorage);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Get visualized detected objects and upload it to the cloud storage
        /// </summary>
        public void VisualiizeDetectObjectsAndUploadToStorage()
        {
            Console.WriteLine("Get the original image with visualized detected objects and upload it to the cloud storage");

            UploadSampleImageToCloud();

            string method        = "ssd";
            int    threshold     = 50;
            bool   includeLabel  = true;
            bool   includeScore  = true;
            string allowedLabels = "cat";
            string blockedLabels = "dog";
            string color         = "blue";
            string folder        = CloudPath; // Input file is saved at the Examples folder in the storage
            string storage       = null;      // We are using default Cloud Storage

            var request = new GetVisualObjectBoundsRequest(SampleImageFileName, method, threshold, includeLabel, includeScore, allowedLabels, blockedLabels, color, folder, storage);

            Console.WriteLine($"Call VisualObjectBoundsRequest with params: method:{method}, threshold:{threshold}, include label: {includeLabel}, includeScore: {includeScore}, color: {color}");

            using (Stream updatedImage = this.ImagingApi.GetVisualObjectBounds(request))
            {
                UploadImageToCloud(GetModifiedSampleImageFileName(false, SaveImageFormat), updatedImage);
            }

            Console.WriteLine();
        }
Beispiel #3
0
 public VisualObjectDetectionTestCommand(
     GetVisualObjectBoundsRequest request,
     ImagingApi imagingApi,
     bool saveResultToStorage,
     bool removeResult,
     string folder,
     string storage,
     string resultFileName)
 {
     this.request             = request;
     this.imagingApi          = imagingApi;
     this.saveResultToStorage = saveResultToStorage;
     this.removeResult        = removeResult;
     this.storage             = storage;
     if (saveResultToStorage)
     {
         this.outPath = folder + "/" + resultFileName;
     }
 }