-1

I have a picture below. For some reason, C# code below for Google Cloud Vision API Works on sample picture in Object Localizer Resource: https://cloud.google.com/vision/docs/object-localizer

However, it does not work for my picture below. How can this be fixed?

I want it to detect two rectangles at least.

    static void Main(string[] args)
    {
        System.Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", @"C:\Users\john.smith\Desktop\ConsoleApp1\ProjectTest.json");

        var client = ImageAnnotatorClient.Create();
        var image = Image.FromFile(@"C:\Users\john.smith\Desktop\testpicture.jpg");
        var response = client.DetectLocalizedObjects(image);

        Console.WriteLine($"Number of objects found {response.Count}");
        foreach (var localizedObject in response)
        {
            Console.Write($"\n{localizedObject.Name}");
            Console.WriteLine($" (confidence: {localizedObject.Score})");
            Console.WriteLine("Normalized bounding polygon vertices: ");

            foreach (var vertex
                    in localizedObject.BoundingPoly.NormalizedVertices)
            {
                Console.WriteLine($" - ({vertex.X}, {vertex.Y})");
            }
        }
        Console.ReadKey();
    }

Results: (only detects 1 outer whiteboard, no inner rectangles or polygon)

Whiteboard (confidence: 0.5879682)
Normalized bounding polygon vertices:
 - (0, 0.0076482575)
 - (0.9673452, 0.0076482575)
 - (0.9673452, 0.9902978)
 - (0, 0.9902978)

enter image description here

Related question: Does Amazon Rekognition Detect Shapes like Squares, Triangles, Circles?

1 Answers1

1

I believe that Vision API currently has no feature to detect geometric shapes.
It does label geometric shapes on better quality images though, it's just that it doesn't give the position.
So I have created a Feature Request to ask for this to be implemented, if possible.

Also, you could try training a custom model on AutoML Vision.

Ksign
  • 779
  • 5
  • 11