the just_filter=true argument is necessaryotherwise thresholding is performed and you get an estimate of where the edges are the following screenshot shows the result of applying the filter (so that lighter areas are edgieron the left and the result of thresholding on the rightbased on this operatorwe may want to define global feature as the overall edginess of the resultdef edginess_sobel(image)edges mh sobel(imagejust_filter=trueedges edges ravel(return np sqrt(np dot(edgesedges)in the last linewe used trick to compute the root mean square--using the inner product function np dot is equivalent to writing np sum(edges * )but much faster (we just need to make sure we unraveled the array firstnaturallywe could have thought up many different ways to achieve similar results using the thresholding operation and counting the fraction of pixels above threshold would be another obvious example we can add this feature to the previous pipeline very easilyfeatures [for im in imagesimage mh imread(imfeatures append(np concatenatemh features haralick(immean( )build -element list with our feature to match expectations of np concatenate [edginess_sobel(im)])