fix bug with annotation result gradient stops

add tensorrt engine
This commit is contained in:
Alex Bezdieniezhnykh
2025-04-02 00:29:21 +03:00
parent e0c88bd8fb
commit b21f8e320f
36 changed files with 544 additions and 206 deletions
+5 -18
View File
@@ -4,25 +4,12 @@ namespace Azaion.Common.Extensions;
public static class ColorExtensions
{
public static Color ToColor(this int id)
private const int MIN_ALPHA = 20;
private const int MAX_ALPHA = 100;
public static Color ToConfidenceColor(this Color color, double confidence )
{
var index = id % ColorValues.Length;
var hex = index == -1
? "#40DDDDDD"
: $"#40{ColorValues[index]}";
var color =(Color)ColorConverter.ConvertFromString(hex);
color.A = (byte)(MIN_ALPHA + (int)Math.Round(confidence * (MAX_ALPHA - MIN_ALPHA)));
return color;
}
private static readonly string[] ColorValues =
[
"FF0000", "00FF00", "0000FF", "FFFF00", "FF00FF", "00FFFF", "000000",
"800000", "008000", "000080", "808000", "800080", "008080", "808080",
"C00000", "00C000", "0000C0", "C0C000", "C000C0", "00C0C0", "C0C0C0",
"400000", "004000", "000040", "404000", "400040", "004040", "404040",
"200000", "002000", "000020", "202000", "200020", "002020", "202020",
"600000", "006000", "000060", "606000", "600060", "006060", "606060",
"A00000", "00A000", "0000A0", "A0A000", "A000A0", "00A0A0", "A0A0A0",
"E00000", "00E000", "0000E0", "E0E000", "E000E0", "00E0E0", "E0E0E0"
];
}