I'm using the Microsoft.Azure.CognitiveServices.Vision.ComputerVision API to detect glasses in pictures.
If glasses are detected I get pixel coordinates and a confidence value which I noticed is always above 0.5.
So I’m trying to get a return value even if the confidence is below that (so even if the API isn't confident enough that there are glasses in the picture).
The method to analyze the picture looks like this:
public static async Task AnalyzeImageUrl(ComputerVisionClient client, string imageUrl)
{
// Creating a list that defines the features to be extracted from the image.
var features = new List<VisualFeatureTypes?>
{
VisualFeatureTypes.Objects
};
Console.WriteLine("Analyzing objects in image...");
Console.WriteLine();
// Analyze the URL image
var results = await client.AnalyzeImageAsync(imageUrl, features);
Console.WriteLine("Objects:");
foreach (var obj in results.Objects)
{
Console.WriteLine(@$"{obj.ObjectProperty} with confidence {obj.Confidence} at
location {obj.Rectangle.X}, {obj.Rectangle.X + obj.Rectangle.W}, {obj.Rectangle.Y}, {obj.Rectangle.Y + obj.Rectangle.H}");
}
}