In [1]:
# log spatial filter
from matplotlib import pyplot as plt
from matplotlib import image
import numpy as np
%matplotlib inline
img = image.imread('MP.tif')[...,0]
plt.imshow(img, cmap='gray')


Out[1]:
<matplotlib.image.AxesImage at 0x7f6fa20c6950>

In [2]:
# 46 * ln(256) ~ 255
log_img = (46*np.log(img+1)).astype(np.uint8)
plt.figure(figsize=(12,12))
plt.imshow(log_img, cmap='gray')


-c:2: RuntimeWarning: divide by zero encountered in log
Out[2]:
<matplotlib.image.AxesImage at 0x7f6fa07b2e50>

In [3]:
histogram = np.histogram(img.flatten(), bins=range(256))
plt.xlim((0,255))
plt.plot(histogram[0])


Out[3]:
[<matplotlib.lines.Line2D at 0x7f6fa0766250>]

This seems quite odd.


In [4]:
histogram = np.histogram(log_img.flatten(), bins=range(256))
plt.xlim((0,255))
plt.plot(histogram[0])


Out[4]:
[<matplotlib.lines.Line2D at 0x7f6fa06933d0>]

In [5]:
# histogram of other pictures taken with SP8
img2 = image.imread('MP1.tif')
img3 = image.imread('MP2.tif')
hist2 = np.histogram(img2, bins=range(256))
hist3 = np.histogram(img3, bins=range(256))
plt.xlim((0,255))
plt.plot(hist2[0])
plt.figure()
plt.xlim((0,255))
plt.plot(hist3[0])


Out[5]:
[<matplotlib.lines.Line2D at 0x7f6f9f910950>]

Why does some few intensities get such a high count?