Skip to content

Instantly share code, notes, and snippets.

@markroxor
Last active October 22, 2015 16:13
Show Gist options
  • Save markroxor/ac16347e26d0d58694c0 to your computer and use it in GitHub Desktop.
Save markroxor/ac16347e26d0d58694c0 to your computer and use it in GitHub Desktop.
from detectionFunction import fingerCount
import thread,threading,time,cv2
from multiprocessing.pool import ThreadPool
pool = ThreadPool(processes=1)
cap = cv2.VideoCapture(0)
# cap = 1
async_result = pool.apply_async(fingerCount, (cap,1, )) # tuple of args for foo
# do some other stuff in the main process
return_val = async_result.get() # get the return value from your function.
print return_val
ori = time.time()
clk = time.time()
ptime =clk
while clk-ori<10.0:
# pass
clk = time.time()
if clk-ptime>1:
ptime = clk
async_result = pool.apply_async(fingerCount, (cap,1, ))
print async_result.get()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment