Fixed something
This commit is contained in:
1 parent
abf854e021
commit
aeed10daca
4 files changed
+1
-8
No files matched your search
@@ -1,12 +1,9 @@
|
|||||||
# 使用sklearn.cluster库中的MeanShift类,对生成的二维模拟数据进行聚类。
|
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
|
||||||
from sklearn.cluster import MeanShift, estimate_bandwidth
|
from sklearn.cluster import MeanShift, estimate_bandwidth
|
||||||
from sklearn.datasets import make_blobs
|
from sklearn.datasets import make_blobs
|
||||||
|
|
||||||
centers = [[1, 1], [-1, -1], [1, -1]]
|
centers = [[1, 1], [-1, -1], [1, -1]]
|
||||||
X, _ = make_blobs(n_samples=300, centers=centers, cluster_std=0.4)
|
X, _ = make_blobs(n_samples=300, centers=centers, cluster_std=0.4) # type: ignore
|
||||||
|
|
||||||
bandwidth = estimate_bandwidth(X, quantile=0.2, n_samples=300)
|
bandwidth = estimate_bandwidth(X, quantile=0.2, n_samples=300)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
# 用OpenCV库中的均值漂移函数cv2.pyrMeanShiftFiltering()来实现图像分割,需要先将图像从BGR转换到YUV颜色空间,分割后将分割结果从YUV转换回BGR颜色空间显示。
|
|
||||||
|
|
||||||
import cv2 as cv
|
import cv2 as cv
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
# 根据MeanShift算法的原理,手动实现Meanshift算法。
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|||||||
File renamed without changes.
Reference in new issue
Block a user