In [5]:
# to make matplotlib figures nice
import matplotlib
%matplotlib inline
matplotlib.rcParams['savefig.dpi'] = 2 * matplotlib.rcParams['savefig.dpi']

Import vigra and graph submodule, and import numpy from vigra


In [10]:
import vigra
from vigra import graphs
import numpy
import pylab

Read in an image


In [7]:
# load image and convert to LAB
filepath = '12003.jpg'
img = vigra.impex.readImage(filepath)
imgLab = vigra.colors.transform_RGB2Lab(img)
vigra.imshow(img,show=False)
vigra.show()


Compute gradient magnitude on image which shape*2-1


In [8]:
# compute gradient on interpolated image
sigmaGradMag = 2.0 
imgLabBig = vigra.resize(imgLab, [imgLab.shape[0]*2-1, imgLab.shape[1]*2-1])
gradMag = vigra.filters.gaussianGradientMagnitude(imgLabBig, sigmaGradMag)
vigra.imshow(gradMag,show=False)
vigra.show()