Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
300 views
in Technique[技术] by (71.8m points)

c# - Google Cloud Vision API Not Detecting Objects Shapes

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:Usersjohn.smithDesktopConsoleApp1ProjectTest.json");

        var client = ImageAnnotatorClient.Create();
        var image = Image.FromFile(@"C:Usersjohn.smithDesktopestpicture.jpg");
        var response = client.DetectLocalizedObjects(image);

        Console.WriteLine($"Number of objects found {response.Count}");
        foreach (var localizedObject in response)
        {
            Console.Write($"
{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?

question from:https://stackoverflow.com/questions/65866127/google-cloud-vision-api-not-detecting-objects-shapes

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...