mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 07:13:02 +04:00
603bc58d3b
Remove performance bottleneck caused by redundant type conversions in the initGMMs() function's tight nested loops that iterate over all image pixels. Changes: - Changed storage vectors from Vec3f to Vec3b to store pixel data directly without intermediate conversion - Modified kmeans preparation to convert Vec3b data to CV_32FC1 only when creating the Mat for clustering (using convertTo instead of per-pixel cast) - Explicitly convert Vec3b to Vec3d only when calling addSample() method Performance Impact: Previously: Vec3b -> Vec3f (in loop) -> Vec3d (implicit in addSample) Now: Vec3b (in loop) -> Vec3d (explicit, only in addSample call) This eliminates one unnecessary type conversion per pixel in the tight loop, reducing computational overhead especially for large images. Fixes #27968