无法从skybiometry获取数据

时间:2015-11-02 12:40:48

标签: javascript

我尝试在回调函数中从SkyBiometry获取照片的tid,如下所示,但它无法正常工作。

function callback(data) {
      drawFaces($("#conent_demo_image"), data.photos[0], true);
      var tid = data.photos[0].tags[0].tid;

      $("#tid").text(tid);
    }

html:

<div id="tid">
  tid:   
</div>

1 个答案:

答案 0 :(得分:2)

根据SkyBiometry Demo的来源,它应该是这样的:

{
  "RawData": "...",
  "Status": 0,
  "photos": [{
    "url": "https://skybiometry.com/Content/Samples/one_i.jpg",
    "pid": "F@0ae0deaf6994b85e751943ae2166ec27_24412177fed2f",
    "width": 480,
    "height": 480,
    "tags": [{
      "tid": "TEMP_F@0ae0deaf6994b85e751943ae012b00ab_24412177fed2f_62.29_35.62_0_1",
      "recognizable": true,
      "uids": [],
      "label": null,
      "confirmed": false,
      "manual": false,
      "width": 20.83,
      "height": 20.83,
      "center": {"x": 62.29, "y": 35.62},
      "eye_left": {"x": 68.54, "y": 30.42, "confidence": 57, "id": 449},
      "eye_right": {"x": 56.67, "y": 30.42, "confidence": 55, "id": 450},
      "mouth_center": {"x": 62.5, "y": 42.92, "confidence": 54, "id": 615},
      "nose": {"x": 63.33, "y": 37.71, "confidence": 51, "id": 403},
      "yaw": -6.0,
      "roll": -1.0,
      "pitch": 0.0,
      "attributes": {
        "face": {"value": true, "confidence": 70},
        "gender": {"Value": 1, "value": "female", "confidence": 75},
        "glasses": {"value": false, "confidence": 81},
        "dark_glasses": {"value": false, "confidence": 58},
        "smiling": {"value": true, "confidence": 100},
        "age_est": {"value": 16, "confidence": 50},
        "mood": {"Value": 2, "value": "happy", "confidence": 76},
        "lips": {"Value": 1, "value": "parted", "confidence": 100},
        "eyes": {"Value": 0, "value": "open", "confidence": 87},
        "neutral_mood": {"value": false, "confidence": 0},
        "anger": {"value": false, "confidence": 45},
        "disgust": {"value": false, "confidence": 1},
        "fear": {"value": false, "confidence": 0},
        "happiness": {"value": true, "confidence": 76},
        "sadness": {"value": false, "confidence": 2},
        "surprise": {"value": false, "confidence": 6}
      },
      "points": null,
      "similarities": null
    }]
  }],
  "status": "success",
  "usage": {
    "ResetTime": "2015-11-07T20:02:54Z",
    "used": 21633,
    "reset_time_text": "Sat, 7 November 2015 20:02:54 +0000",
    "remaining": 78367,
    "namespace_used": 0,
    "limit": 100000,
    "namespace_remaining": 0,
    "reset_time": 1446926574,
    "namespace_limit": 0
  },
  "operation_id": "c869d8e95f364f979dd62277810b299c"
}