예제 #1
0
 public void Add(YoloItem item)
 {
     if (!Dict.ContainsKey(item.Type))
     {
         Dict.Add(item.Type, new List <YoloItem>());
     }
     Dict[item.Type].Add(item);
 }
예제 #2
0
        public void OnUpdate(Size size, Color color, YoloItem item)
        {
            gameObject.SetActive(true);

            frame.color = color;
            text.color  = Color.white;

            RectInt r = item.Rect;

            frameRect.offsetMin = new Vector2(
                r.x * size.Factor, (size.Image.y - r.height - r.y) * size.Factor);
            frameRect.offsetMax = new Vector2(
                (r.x - (size.Image.x - r.width)) * size.Factor, -r.y * size.Factor);

            text.text = item.Depth.ToString("F0") + "m " + item.Type + " " + Mathf.Round(item.Confidence * 100) + "%";
            textRect.anchoredPosition = new Vector2(
                (r.width * size.Factor) / 2 + textOffset.x + AdditionalTextWidth / 2, textOffset.y);
            textRect.sizeDelta = new Vector2(r.width * size.Factor + AdditionalTextWidth, textHeight);
        }
예제 #3
0
        public void OnUpdate(Size size, Color color, YoloItem item)
        {
            gameObject.SetActive(true);

            frame.color = color;
            text.color  = color.grayscale > 0.5f ? Color.black : Color.white;

            RectInt r = item.Rect;

            frameRect.offsetMin = new Vector2(
                r.x * size.Factor, (size.Image.y - r.height - r.y) * size.Factor);
            frameRect.offsetMax = new Vector2(
                (r.x - (size.Image.x - r.width)) * size.Factor, -r.y * size.Factor);

            text.text = item.Type + " " + Mathf.Round(item.Confidence * 100) + "%";
            textRect.anchoredPosition = new Vector2(
                (r.width * size.Factor) / 2 + textOffset.x, textOffset.y);
            textRect.sizeDelta = new Vector2(r.width * size.Factor, textHeight);
        }