add open source traffic sign, vehicle and shape-color detector
parent
95046e2198
commit
dd8000a498
Binary file not shown.
Binary file not shown.
@ -0,0 +1,6 @@
|
|||||||
|
go_straight
|
||||||
|
no_turn
|
||||||
|
turn_around
|
||||||
|
turn_left
|
||||||
|
turn_right
|
||||||
|
no_straight
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,6 @@
|
|||||||
|
bike
|
||||||
|
motor
|
||||||
|
car
|
||||||
|
truck
|
||||||
|
van
|
||||||
|
bus
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023. UnknownNetworkService Group
|
||||||
|
* This file is created by UnknownObject at 2023 - 6 - 7
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.uns.maincar.data_type;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.uns.maincar.constants.GlobalColor;
|
||||||
|
import com.uns.maincar.constants.GlobalShape;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
public class ShapeColorResult
|
||||||
|
{
|
||||||
|
private final HashMap<GlobalColor, HashMap<GlobalShape, Integer>> storage;
|
||||||
|
|
||||||
|
public ShapeColorResult()
|
||||||
|
{
|
||||||
|
storage = new HashMap<>();
|
||||||
|
storage.put(GlobalColor.RED, new HashMap<>());
|
||||||
|
storage.put(GlobalColor.GREEN, new HashMap<>());
|
||||||
|
storage.put(GlobalColor.BLUE, new HashMap<>());
|
||||||
|
storage.put(GlobalColor.YELLOW, new HashMap<>());
|
||||||
|
storage.put(GlobalColor.PURPLE, new HashMap<>());
|
||||||
|
storage.put(GlobalColor.CYAN, new HashMap<>());
|
||||||
|
storage.forEach((k, v) ->
|
||||||
|
{
|
||||||
|
v.put(GlobalShape.STAR, 0);
|
||||||
|
v.put(GlobalShape.CIRCLE, 0);
|
||||||
|
v.put(GlobalShape.SQUARE, 0);
|
||||||
|
v.put(GlobalShape.TRIANGLE, 0);
|
||||||
|
v.put(GlobalShape.RECTANGLE, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetValue(GlobalColor color, GlobalShape shape, int value)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (storage.containsKey(color) && Objects.requireNonNull(storage.get(color)).containsKey(shape))
|
||||||
|
Objects.requireNonNull(storage.get(color)).replace(shape, value);
|
||||||
|
}
|
||||||
|
catch (Exception ignored)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetValue(GlobalColor color, GlobalShape shape)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (storage.containsKey(color) && Objects.requireNonNull(storage.get(color)).containsKey(shape))
|
||||||
|
return Objects.requireNonNull(Objects.requireNonNull(storage.get(color)).get(shape));
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int AllItemCount()
|
||||||
|
{
|
||||||
|
AtomicInteger sum = new AtomicInteger();
|
||||||
|
storage.forEach((k, v) -> v.forEach((s_k, s_v) -> sum.addAndGet(s_v)));
|
||||||
|
return sum.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
storage.clear();
|
||||||
|
storage.put(GlobalColor.RED, new HashMap<>());
|
||||||
|
storage.put(GlobalColor.GREEN, new HashMap<>());
|
||||||
|
storage.put(GlobalColor.BLUE, new HashMap<>());
|
||||||
|
storage.put(GlobalColor.YELLOW, new HashMap<>());
|
||||||
|
storage.put(GlobalColor.PURPLE, new HashMap<>());
|
||||||
|
storage.put(GlobalColor.CYAN, new HashMap<>());
|
||||||
|
storage.forEach((k, v) ->
|
||||||
|
{
|
||||||
|
v.put(GlobalShape.STAR, 0);
|
||||||
|
v.put(GlobalShape.CIRCLE, 0);
|
||||||
|
v.put(GlobalShape.SQUARE, 0);
|
||||||
|
v.put(GlobalShape.TRIANGLE, 0);
|
||||||
|
v.put(GlobalShape.RECTANGLE, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("--------------------ShapeColorResult START--------------------\n");
|
||||||
|
sb.append("Total Item Count: ").append(AllItemCount()).append("\n");
|
||||||
|
storage.forEach((k, v) -> v.forEach((s_k, s_v) -> sb.append("storage[").append(k).append("][").append(s_k).append("] = ").append(s_v).append("\n")));
|
||||||
|
sb.append("---------------------ShapeColorResult END---------------------\n");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) https://github.com/gh-xiao/EmbeddedCar
|
||||||
|
* This file is pull from GitHub open source project
|
||||||
|
* Integrated by UnknownObject at 2023 - 6 - 7
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.uns.maincar.open_source.utils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 形状统计
|
||||||
|
*/
|
||||||
|
public class ShapeStatistics
|
||||||
|
{
|
||||||
|
|
||||||
|
//统计形状数量
|
||||||
|
private HashMap<String, Integer> shapeStatistics = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定形状的数量
|
||||||
|
*
|
||||||
|
* @param shapeName 三角形/矩形/菱形/五角星/圆形/总计
|
||||||
|
* @return 数量
|
||||||
|
*/
|
||||||
|
public Integer getCounts(String shapeName)
|
||||||
|
{
|
||||||
|
return shapeStatistics.get(shapeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置形状的数量
|
||||||
|
*
|
||||||
|
* @param shapeStatistics 包含该形状数量的HashMap对象
|
||||||
|
*/
|
||||||
|
public void setShapeStatistics(HashMap<String, Integer> shapeStatistics)
|
||||||
|
{
|
||||||
|
this.shapeStatistics = shapeStatistics;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
git push
|
||||||
|
pause
|
@ -1,2 +1,4 @@
|
|||||||
# C/C++ build system timings
|
# C/C++ build system timings
|
||||||
|
|
||||||
|
# C/C++ build system timings
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue