I'm trying to enhance the contrast of image using following code
<p>Here i'm trying to:
     - Apply Adaptive filtering to image .
     - Enhance the contrast of image .
 my code is as follow : </p>

<pre><code>#!/usr/bin/python
import cv2
import numpy as np
import PIL
from PIL import ImageFilter

from matplotlib import pyplot as plt
img = cv2.imread('Crop.jpg',0)
cv2.imshow('original',img)
img = cv2.medianBlur(img,5)     

th3 = cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,\
     cv2.THRESH_BINARY,11,2)
cv2.imshow('image',th3)
th3 = th3.filter(ImageFilter.SMOOTH)
cv2.imshow('image',th3)
cv2.waitKey(0)
cv2.destroyAllWindows()
</code></pre>

<p>I am getting following Error :</p>

<blockquote>
  <p>Traceback (most recent call last):</p>
  
  <p>File "./adaptive.py", line 22, in </p>
  
  <p>th3 = th3.filter(ImageFilter.SMOOTH)</p>
  
  <p>AttributeError: 'numpy.ndarray' object has no attribute 'filter</p>
</blockquote>

<p>You may confuse with <a href="http://docs.opencv.org/2.4/modules/imgproc/doc/filtering.html?highlight=.smooth#cv.Smooth" rel="nofollow">cv.Smooth</a></p>

python image numpy