import cv2 import ipcv import numpy import matplotlib.pyplot import matplotlib.cm import mpl_toolkits.mplot3d import os.path home = os.path.expanduser('~') filename = home + os.path.sep + 'src/python/examples/data/lenna.tif' im = cv2.imread(filename) frequencyFilter = ipcv.filter_bandpass(im, 32, 15, order=2, filterShape=ipcv.IPCV_BUTTERWORTH) frequencyFilter = ipcv.filter_bandpass(im, 32, 15, filterShape=ipcv.IPCV_GAUSSIAN) frequencyFilter = ipcv.filter_bandpass(im, 32, 15, filterShape=ipcv.IPCV_IDEAL) # Create a 3D plot and image visualization of the frequency domain filter rows = im.shape[0] columns = im.shape[1] u = numpy.arange(-columns/2, columns/2, 1)
if __name__ == '__main__': import cv2 import ipcv import numpy import matplotlib.pyplot import matplotlib.cm import mpl_toolkits.mplot3d import os.path home = os.path.expanduser('~') filename = home + os.path.sep + 'src/python/examples/data/lenna.tif' im = cv2.imread(filename) frequencyFilter = ipcv.filter_bandpass(im, 32, 15, filterShape=ipcv.IPCV_IDEAL) #frequencyFilter = ipcv.filter_bandpass(im, #32, #15, #order=1, #filterShape=ipcv.IPCV_BUTTERWORTH) #frequencyFilter = ipcv.filter_bandpass(im, #32, #15, #filterShape=ipcv.IPCV_GAUSSIAN) # Create a 3D plot and image visualization of the frequency domain filter rows = im.shape[0] columns = im.shape[1] u = numpy.arange(-columns / 2, columns / 2, 1)
if __name__ == '__main__': import cv2 import ipcv import numpy import matplotlib.pyplot import matplotlib.cm import mpl_toolkits.mplot3d filename = '/cis/faculty/cnspci/public_html/courses/common/images/lenna_color.tif' im = cv2.imread(filename) frequencyFilter = ipcv.filter_bandpass(im, 16, 2, filterShape=ipcv.IPCV_IDEAL) frequencyFilter = ipcv.filter_bandpass(im, 32, 1, order=2, filterShape=ipcv.IPCV_BUTTERWORTH) #frequencyFilter = ipcv.filter_bandpass(im, # 32, # 15, # filterShape=ipcv.IPCV_GAUSSIAN) # Create a 3D plot and image visualization of the frequency domain filter rows = im.shape[0] columns = im.shape[1] u = numpy.arange(-columns / 2, columns / 2, 1)
import cv2 import ipcv import numpy import os.path import time home = os.path.expanduser('~') filename = home + os.path.sep + 'src/python/examples/data/giza.jpg' filename = home + os.path.sep + 'src/python/examples/data/checkerboard.tif' filename = home + os.path.sep + 'src/python/examples/data/lenna.tif' im = cv2.imread(filename) frequencyFilter = ipcv.filter_bandpass(im, 32, 10, filterShape=ipcv.IPCV_GAUSSIAN) startTime = time.clock() offset = 0 filteredImage = ipcv.frequency_filter(im, frequencyFilter, delta=offset) filteredImage = numpy.abs(filteredImage) filteredImage = filteredImage.astype(dtype=numpy.uint8) elapsedTime = time.clock() - startTime print('Elapsed time (frequency_filter)= {0} [s]'.format(elapsedTime)) cv2.namedWindow(filename, cv2.WINDOW_AUTOSIZE) cv2.imshow(filename, im) cv2.imshow(filename, ipcv.histogram_enhancement(im)) filterName = 'Filtered (' + filename + ')'
if __name__ == '__main__': import cv2 import ipcv import numpy import matplotlib.pyplot import matplotlib.cm import mpl_toolkits.mplot3d filename = '/cis/faculty/cnspci/public_html/courses/common/images/lenna_color.tif' im = cv2.imread(filename) frequencyFilter = ipcv.filter_bandpass(im, 16, 2, filterShape=ipcv.IPCV_IDEAL) frequencyFilter = ipcv.filter_bandpass(im, 32, 1, order=2, filterShape=ipcv.IPCV_BUTTERWORTH) #frequencyFilter = ipcv.filter_bandpass(im, # 32, # 15, # filterShape=ipcv.IPCV_GAUSSIAN) # Create a 3D plot and image visualization of the frequency domain filter rows = im.shape[0] columns = im.shape[1] u = numpy.arange(-columns/2, columns/2, 1)
import matplotlib.pyplot import matplotlib.cm import mpl_toolkits.mplot3d import os.path home = os.path.expanduser('~') filename = home + os.path.sep + 'src/python/examples/data/lenna.tif' im = cv2.imread(filename) # frequencyFilter = ipcv.filter_bandpass(im, # 32, # 15, # filterShape=ipcv.IPCV_IDEAL) frequencyFilter = ipcv.filter_bandpass(im, 100, 15, 1, filterShape=ipcv.IPCV_BUTTERWORTH) # frequencyFilter = ipcv.filter_bandpass(im, # 32, # 15, # filterShape=ipcv.IPCV_GAUSSIAN) # Create a 3D plot and image visualization of the frequency domain filter rows = im.shape[0] columns = im.shape[1] u = numpy.arange(-columns / 2, columns / 2, 1) v = numpy.arange(-rows / 2, rows / 2, 1) u, v = numpy.meshgrid(u, v) figure = matplotlib.pyplot.figure('Frequency Domain Filter', (14, 6))