修正色调排序
This commit is contained in:
@@ -13,6 +13,12 @@ type RGB struct {
|
||||
R, G, B int
|
||||
}
|
||||
|
||||
// 根据每个聚类中心包含的颜色数量进行排序
|
||||
type cluster struct {
|
||||
center RGB
|
||||
count int
|
||||
}
|
||||
|
||||
// 计算两个 RGB 颜色的欧氏距离
|
||||
func distance(c1, c2 RGB) float64 {
|
||||
return math.Sqrt(float64((c1.R-c2.R)*(c1.R-c2.R) + (c1.G-c2.G)*(c1.G-c2.G) + (c1.B-c2.B)*(c1.B-c2.B)))
|
||||
|
Reference in New Issue
Block a user