Search code examples
pythonimagematlabimage-processingkernel-density

Implement the MATLAB 'fitdist' in Python


I am working on a image processing tool, and I am having some trouble finding a good substitute for matlab's fitdist to a Python soltuion.

The matlab code works something like this:

pdR = fitdist(Red,'Kernel','Support','positive');

Any of you have found a good implementation for this in Python?


Solution

  • Generally SciPy is useful in your case:

    import scipy.stats as st
    # KDE
    st.gaussian_kde(data)
    # Fit to specified distribution (Normal distribution in this example)
    st.norm.fit(data)
    

    Full reference is here: https://docs.scipy.org/doc/scipy/reference/stats.html