【问题标题】:Get hex codes for colors using Azure Cognitive Services Vision API使用 Azure 认知服务视觉 API 获取颜色的十六进制代码
【发布时间】:2019-10-22 10:58:11
【问题描述】:

有没有办法从 Azure 计算机视觉 API 获取主要背景和前景色的十六进制代码?默认响应中的颜色信息如下所示:

"color": {
  "dominantColorForeground": "Black",
  "dominantColorBackground": "Black",
  "dominantColors": [
    "Black",
    "Grey"
  ],
  "accentColor": "7B5E50",
  "isBWImg": false
}

有一个强调色的十六进制代码,但有谁知道是否有办法获得其他颜色的十六进制代码(特别是主要的前景色和背景色)?我在documentation 中找不到任何东西,但我想我可能错过了一些东西。

【问题讨论】:

    标签: microsoft-cognitive azure-cognitive-services


    【解决方案1】:

    API 没有直接提供等效项。

    您可以简单地通过代码来完成,例如在本主题中提到的C#How to convert color name to the corresponding hexadecimal representation?

    int ColorValue = Color.FromName("blue").ToArgb();
    string ColorHex = string.Format("{0:x6}", ColorValue);
    

    【讨论】:

      猜你喜欢
      • 2011-10-25
      • 2020-06-14
      • 2012-11-04
      • 2011-09-20
      • 2012-07-05
      相关资源
      最近更新 更多