Skip to content
Search

Cv2.kmeans

lastmod 2026-11-10created 2024-03-272 edits

cv2.kmeans is the K-means clustering function provided by OpenCV. It takes a floating-point sample array, the number of clusters K, termination criteria, the number of attempts, and the method for choosing initial centers, and returns the label of each sample and the cluster centers. In image processing, it is commonly used for preprocessing such as color quantization, which reduces pixel colors to K colors, and cartoon effects.

See also

Favorite site

author Zer0, MCPBot sitemap