def on_mouse(event, x, y, flags, param): if not src: return if event==cv.CV_EVENT_LBUTTONDOWN: cv.LogPolar(src, dst, (x, y), 40, cv.CV_INTER_LINEAR + cv.CV_WARP_FILL_OUTLIERS) cv.LogPolar(dst, src2, (x, y), 40, cv.CV_INTER_LINEAR + cv.CV_WARP_FILL_OUTLIERS + cv.CV_WARP_INVERSE_MAP) cv.ShowImage("log-polar", dst) cv.ShowImage("inverse log-polar", src2)
def logpolar(src, center, magnitude_scale = 40): mat1 = cv.fromarray(np.float64(src)) mat2 = cv.CreateMat(src.shape[0], src.shape[1], mat1.type) cv.LogPolar(mat1, mat2, center, magnitude_scale, \ cv.CV_INTER_CUBIC+cv.CV_WARP_FILL_OUTLIERS) return np.asarray(mat2)