File: shock_filter.py

package info (click to toggle)
libvigraimpex 1.11.1%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 50,356 kB
  • sloc: cpp: 57,785; python: 8,603; ansic: 1,798; makefile: 97; javascript: 65; sh: 50
file content (21 lines) | stat: -rw-r--r-- 606 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import vigra
from vigra import graphs

filepath = '12003.jpg'
img = vigra.impex.readImage(filepath).astype('float32')[:,:,0]

res = vigra.filters.shockFilter(img,sigma=1.5, rho=10.0, updwindFactorH=1.0, iterations=5)
res = res.squeeze()

import numpy as np
import pylab
import matplotlib.cm as cm

f = pylab.figure()
for n, arr in enumerate([img,res]):
    arr= arr.squeeze().T
    #f.add_subplot(2, 1, n)  # this line outputs images on top of each other
    f.add_subplot(1, 2, n+1)  # this line outputs images side-by-side
    pylab.imshow(arr,cmap=cm.Greys_r)
pylab.title('( III x) image')
pylab.show()