|
@@ -213,10 +213,6 @@ namespace ZIM
|
|
|
//var spotArea = DbscanToSpotAreas(db, brightPoint);
|
|
//var spotArea = DbscanToSpotAreas(db, brightPoint);
|
|
|
var spotArea = PixelSpotArea.Cluster(spotPoint, brightPoint, screenIdentification.Screen.UVInScreen);
|
|
var spotArea = PixelSpotArea.Cluster(spotPoint, brightPoint, screenIdentification.Screen.UVInScreen);
|
|
|
|
|
|
|
|
- if (ScreenLocate.Main.DebugOnZIMDemo)
|
|
|
|
|
- DebugAreas(spotArea);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
//Debug.Log("db: " + db.Clusters.Count);
|
|
//Debug.Log("db: " + db.Clusters.Count);
|
|
|
//Debug.Log("db noise: " + db.Noise.Count);
|
|
//Debug.Log("db noise: " + db.Noise.Count);
|
|
|
//foreach (var i in spotArea)
|
|
//foreach (var i in spotArea)
|
|
@@ -269,49 +265,7 @@ namespace ZIM
|
|
|
return new List<PixelSpotArea>();
|
|
return new List<PixelSpotArea>();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void DebugAreas(List<PixelSpotArea> areas)
|
|
|
|
|
- {
|
|
|
|
|
- ScreenLocate.Main.Info.transform.GetChild(0).GetComponent<Text>().text = $"areas.Count: {areas.Count}";
|
|
|
|
|
- PixelSpotArea a0 = null; // 表示最大半径的区域
|
|
|
|
|
- PixelSpotArea a1 = null; // 表示第二大半径的区域
|
|
|
|
|
-
|
|
|
|
|
- foreach (var a in areas)
|
|
|
|
|
- {
|
|
|
|
|
- if (a0 == null || a.Radius > a0.Radius)
|
|
|
|
|
- {
|
|
|
|
|
- a1 = a0; // 更新第二大为之前最大
|
|
|
|
|
- a0 = a; // 更新最大为当前的
|
|
|
|
|
- }
|
|
|
|
|
- else if (a1 == null || a.Radius > a1.Radius)
|
|
|
|
|
- {
|
|
|
|
|
- a1 = a; // 更新第二大
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Texture2D texture = new Texture2D(ScreenLocate.Main.CameraSize.x, ScreenLocate.Main.CameraSize.y);
|
|
|
|
|
- Color[] blackPixels = new Color[texture.width * texture.height];
|
|
|
|
|
- for (int i = 0; i < blackPixels.Length; i++)
|
|
|
|
|
- blackPixels[i] = Color.black;
|
|
|
|
|
- texture.SetPixels(blackPixels);
|
|
|
|
|
-
|
|
|
|
|
- if (a0 != null)
|
|
|
|
|
- {
|
|
|
|
|
- foreach (var p in a0.Pixels0)
|
|
|
|
|
- texture.SetPixel((int)p.x, (int)p.y, Color.yellow);
|
|
|
|
|
- foreach (var p in a0.Pixels1)
|
|
|
|
|
- texture.SetPixel((int)p.x, (int)p.y, Color.white);
|
|
|
|
|
- }
|
|
|
|
|
- if (a1 != null)
|
|
|
|
|
- {
|
|
|
|
|
- foreach (var p in a1.Pixels0)
|
|
|
|
|
- texture.SetPixel((int)p.x, (int)p.y, Color.green);
|
|
|
|
|
- foreach (var p in a1.Pixels1)
|
|
|
|
|
- texture.SetPixel((int)p.x, (int)p.y, Color.blue);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- texture.Apply();
|
|
|
|
|
- ScreenLocate.DebugTexture(6, texture);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
private List<PixelSpotArea_DbScan> DbscanToSpotAreas(DbscanResult<Vector2> db, List<Vector2> brightPoint)
|
|
private List<PixelSpotArea_DbScan> DbscanToSpotAreas(DbscanResult<Vector2> db, List<Vector2> brightPoint)
|
|
|
{
|
|
{
|