1#!/usr/bin/env python 2import cv2 3 4if __name__ == '__main__': 5 import sys 6 try: 7 fn = sys.argv[1] 8 except: 9 fn = '../data/fruits.jpg' 10 11 img = cv2.imread(fn) 12 if img is None: 13 print 'Failed to load image file:', fn 14 sys.exit(1) 15 16 img2 = cv2.logPolar(img, (img.shape[0]/2, img.shape[1]/2), 40, cv2.WARP_FILL_OUTLIERS) 17 img3 = cv2.linearPolar(img, (img.shape[0]/2, img.shape[1]/2), 40, cv2.WARP_FILL_OUTLIERS) 18 19 cv2.imshow('before', img) 20 cv2.imshow('logpolar', img2) 21 cv2.imshow('linearpolar', img3) 22 23 cv2.waitKey(0) 24