00001
00002
00003
00004
00005
00006 import time
00007
00008 from fulguro import *
00009
00010
00011
00012 def benchmark(nbiter,function,*args):
00013 t=time.time()
00014 for i in range(nbiter):
00015 function(*args)
00016 t2=time.time()
00017 return ((t2-t)*1000)/nbiter
00018
00019
00020
00021
00022
00023 imin = flgr2d_load_pgm("../../images/gray/cameraman.pgm")
00024 imout1 = FLGR_Data2D(imin)
00025 imout2 = FLGR_Data2D(imin)
00026 nhb = FLGR_Data2D(3,3,1,imin.type,FLGR_RECT,FLGR_8_CONNEX)
00027
00028
00029 speed = benchmark(10000,flgr2d_thread_function_data2d_data2d_nhb,CB_FLGR2D_MEDIAN,imout1,imin,nhb,2)
00030 print "Automatic Multithread median time :",speed,"ms"
00031
00032
00033 speed = benchmark(10000,flgr2d_median,imout2,imin,nhb)
00034 print "No thread Median time :",speed,"ms"
00035
00036
00037 flgr_display(imout1, imout2, imin, "out_multithread", "out_nothread", "in")
00038