mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-18 12:40:14 +08:00
remove local demo from git
This commit is contained in:
@@ -0,0 +1 @@
|
||||
demo/
|
||||
@@ -1,77 +0,0 @@
|
||||
import matplotlib.pyplot as plt
|
||||
from pprint import pprint
|
||||
|
||||
from skimage import data
|
||||
from skimage.morphology.selem import disk
|
||||
import skimage.filter.rank as rank
|
||||
|
||||
def plot_all():
|
||||
a8 = data.camera()
|
||||
a16 = a8.astype('uint16')*16
|
||||
selem = disk(5)
|
||||
|
||||
name_list = sorted([n for n in dir(rank) if n[0] is not '_'])
|
||||
print name_list
|
||||
|
||||
for n in name_list:
|
||||
if n.rfind('bilateral')==0:
|
||||
print n
|
||||
method = eval('rank.%s'%n)
|
||||
if type(method) == type(rank.maximum):
|
||||
print method
|
||||
f8 = method(a8,selem = selem,s0=10,s1=10)
|
||||
f16 = method(a16,selem = selem,s0=10,s1=10)
|
||||
plt.figure()
|
||||
plt.subplot(2,2,1)
|
||||
plt.imshow(a8)
|
||||
plt.colorbar()
|
||||
plt.subplot(2,2,2)
|
||||
plt.imshow(f8)
|
||||
plt.colorbar()
|
||||
plt.subplot(2,2,3)
|
||||
plt.imshow(f16)
|
||||
plt.colorbar()
|
||||
plt.title(method)
|
||||
for n in name_list:
|
||||
if n.rfind('percentile')==0:
|
||||
print n
|
||||
method = eval('rank.%s'%n)
|
||||
if type(method) == type(rank.maximum):
|
||||
print method
|
||||
f8 = method(a8,selem = selem,p0=.1,p1=.9)
|
||||
f16 = method(a16,selem = selem,p0=.1,p1=.9)
|
||||
plt.figure()
|
||||
plt.subplot(2,2,1)
|
||||
plt.imshow(a8)
|
||||
plt.colorbar()
|
||||
plt.subplot(2,2,2)
|
||||
plt.imshow(f8)
|
||||
plt.colorbar()
|
||||
plt.subplot(2,2,3)
|
||||
plt.imshow(f16)
|
||||
plt.colorbar()
|
||||
plt.title(method)
|
||||
for n in name_list:
|
||||
if n.find('percentile')==-1 and n.find('bilateral')==-1:
|
||||
print n
|
||||
method = eval('rank.%s'%n)
|
||||
if type(method) == type(rank.maximum):
|
||||
print method
|
||||
f8 = method(a8,selem = selem)
|
||||
f16 = method(a16,selem = selem)
|
||||
plt.figure()
|
||||
plt.subplot(2,2,1)
|
||||
plt.imshow(a8)
|
||||
plt.colorbar()
|
||||
plt.subplot(2,2,2)
|
||||
plt.imshow(f8)
|
||||
plt.colorbar()
|
||||
plt.subplot(2,2,3)
|
||||
plt.imshow(f16)
|
||||
plt.colorbar()
|
||||
plt.title(method)
|
||||
plt.show()
|
||||
|
||||
if __name__ == '__main__':
|
||||
plot_all()
|
||||
pprint(dir(rank))
|
||||
@@ -1,39 +0,0 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from skimage import data
|
||||
from skimage.morphology.selem import disk
|
||||
import skimage.filter.rank as rank
|
||||
from skimage.filter import threshold_otsu
|
||||
|
||||
if __name__ == '__main__':
|
||||
p8 = data.page()
|
||||
|
||||
radius = 10
|
||||
selem = disk(radius)
|
||||
|
||||
loc_otsu = rank.otsu(p8,selem)
|
||||
t_glob_otsu = threshold_otsu(p8)
|
||||
glob_otsu = p8>=t_glob_otsu
|
||||
|
||||
|
||||
plt.figure()
|
||||
plt.subplot(2,2,1)
|
||||
plt.imshow(p8,cmap=plt.cm.gray)
|
||||
plt.xlabel('original')
|
||||
plt.colorbar()
|
||||
plt.subplot(2,2,2)
|
||||
plt.imshow(loc_otsu,cmap=plt.cm.gray)
|
||||
plt.xlabel('local Otsu ($radius=%d$)'%radius)
|
||||
plt.colorbar()
|
||||
plt.subplot(2,2,3)
|
||||
plt.imshow(p8>=loc_otsu,cmap=plt.cm.gray)
|
||||
plt.xlabel('original>=local Otsu'%t_glob_otsu)
|
||||
plt.subplot(2,2,4)
|
||||
plt.imshow(glob_otsu,cmap=plt.cm.gray)
|
||||
plt.xlabel('global Otsu ($t=%d$)'%t_glob_otsu)
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,28 +0,0 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import gdal
|
||||
|
||||
from skimage.morphology import disk
|
||||
import skimage.filter.rank as rank
|
||||
|
||||
filename = 'iko_pan_Ja1.tif'
|
||||
im16 = gdal.Open(filename).ReadAsArray().astype(np.uint16)
|
||||
|
||||
plt.figure()
|
||||
plt.imshow(im16,cmap=plt.cm.gray)
|
||||
plt.colorbar()
|
||||
|
||||
f0 = rank.median(im16,disk(1))
|
||||
f1 = rank.bilateral_mean(im16,disk(20),s0=200,s1=200)
|
||||
f2 = rank.equalize(f1,disk(10))
|
||||
f3 = rank.bottomhat(f1,disk(1))
|
||||
|
||||
plt.figure()
|
||||
plt.imshow(f2,cmap=plt.cm.gray,interpolation='nearest')
|
||||
plt.colorbar()
|
||||
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from skimage import data
|
||||
from skimage.morphology.selem import disk
|
||||
import skimage.filter.rank as rank
|
||||
|
||||
print dir(rank)
|
||||
|
||||
print rank.mean
|
||||
print rank.percentile_mean
|
||||
print rank.bilateral_mean
|
||||
|
||||
a8 = data.camera()
|
||||
a16 = a8.astype('uint16')*16
|
||||
selem = disk(10)
|
||||
|
||||
f8 = rank.mean(a8,selem)
|
||||
f16 = rank.mean(a16,selem)
|
||||
|
||||
plt.figure()
|
||||
plt.imshow(np.hstack((a8,f8)))
|
||||
plt.colorbar()
|
||||
plt.figure()
|
||||
plt.imshow(np.hstack((a16,f16)))
|
||||
plt.colorbar()
|
||||
|
||||
f8 = rank.percentile_mean(a8,selem,p0=.1,p1=.9)
|
||||
f16 = rank.percentile_mean(a16,selem,p0=.1,p1=.9)
|
||||
|
||||
plt.figure()
|
||||
plt.imshow(np.hstack((a8,f8)))
|
||||
plt.colorbar()
|
||||
plt.figure()
|
||||
plt.imshow(np.hstack((a16,f16)))
|
||||
plt.colorbar()
|
||||
|
||||
plt.show()
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user