Great!

Now that I look at this, I realise that the comparison is not fair to mahotas because it includes a thresholding step. The correct comparison would run mahotas.sobel(f, just_filter=True) which runs in almost the exact same time as skimage because it is almost the exact same code ;-)

mahotas.center_of_mass also handles labeled images; btw.

Best,
Luis

On Tuesday, September 4, 2012 4:22:54 PM UTC+1, Johannes Schönberger wrote:
After another round of performance improvements for the sobel filter, I get:

erode       &     9.03 &    13.67 &    13.31 & \\
dilate      &    12.45 &     9.40 &     6.60 & \\
open        &    21.99 &    22.70 &    13.25 & \\
center mass &     6.63 &       NA &       NA & \\
sobel       &    74.66 &       NA &    43.72 & \\

Note, that there also exists a possibility to calculate the center of mass using the `regionprops` function and the properties "Centroid" and "WeightedCentroid". But due to the label overhead this is probably a lot slower than your implementation.


Am Donnerstag, 30. August 2012 18:52:59 UTC+2 schrieb Luis Pedro Coelho:
Hello,

In the context of my previous email to pythonvision

https://groups.google.com/d/topic/pythonvision/SSCF4LUlRKQ/discussion

I made a timing comparison between mahotas & scikits-image.

operation   | mahotas  | pymorph  | skimage
------------+----------+----------+---------
erode       |    10.80 |    14.33 |    80.17
dilate      |    11.44 |     8.93 |    41.59
open        |    22.45 |    23.20 |    80.18
center mass |     7.05 |       NA |       NA
sobel       |    75.03 |       NA |   105.72
cwatershed  |   201.03 | 56586.50 |   290.41
daubechies  |    19.05 |       NA |       NA
haralick    |   306.48 |       NA |  7391.37

(Best viewed with fixed-width fonts)

The unit of measurement is the time it takes to run ``numpy.max(image)``
Mahotas is always faster than skimage (although pymorph is better for certain
morphological basic operations). I used GCLM in skimage to stand for Haralick,
which is a rough approximation.

I attach the script that generates these (against github skimage). If you
think that I have used skimage incorrectly, please let me know.

Best,
--
Luis Pedro Coelho | Institute for Molecular Medicine | http://luispedro.org