Added GIL-release code into python wrappers

Added gabor_threads.py sample
This commit is contained in:
Alexander Mordvintsev
2012-03-07 11:09:27 +00:00
parent e7dda44a07
commit 58174f6ada
3 changed files with 79 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
import numpy as np
import cv2
import os
from contextlib import contextmanager
image_extensions = ['.bmp', '.jpg', '.jpeg', '.png', '.tif', '.tiff', '.pbm', '.pgm', '.ppm']
@@ -116,6 +117,15 @@ def nothing(*arg, **kw):
def clock():
return cv2.getTickCount() / cv2.getTickFrequency()
@contextmanager
def Timer(msg):
print msg, '...',
start = clock()
try:
yield
finally:
print "%.2f ms" % ((clock()-start)*1000)
class RectSelector:
def __init__(self, win, callback):
self.win = win