S
Steven D'Aprano
It seems the code he is referring to is doing k-means clustering on each
frame. The clustering is done by from SciPy's cluster module, which is
doing 'vector quantitization'. The algorithm is written in plain C. It
is not Python that is slow. It is the amount of processing done on each
frame. As the bottleneck is already in C, it cannot be done any faster
without radically changing the algorithm and/or the hardware.
Thank you for taking the effort to actually investigate the OP's *actual*
problem.
Such a pity that the chances are he's probably gone away in disgust at
the pedantry and insults in this thread. He'll probably become another
one of those people convinced that Python is "slow" because it's
interpreted when in fact this is an example of C being slow in spite of
being compiled.