def run(self): dbbgm_batch.init_process("bbgmMeasureWvLookupProcess"); dbbgm_batch.set_input_from_db(0,self.wavelet); dbbgm_batch.set_input_from_db(1,self.test_image); dbbgm_batch.set_input_string(2,self.attribute); dbbgm_batch.set_input_float(3,self.tolerance); dbbgm_batch.set_input_string(4,self.interp_functor); dbbgm_batch.set_input_string(5,self.data_path); print dbbgm_batch.run_process(); out_image=dbvalue(0,"") (out_image.id,out_image.type)=dbbgm_batch.commit_output(0) saveImg(out_image,self.output_path+frameSuffixWrite(self.index,300)+".tiff")
def measureWvLookup(wavelet,test_image,attribute,tolerance,interp_functor,data_path): image=dbvalue(0,""); dbbgm_batch.init_process("bbgmMeasureWvLookupProcess"); dbbgm_batch.set_input_from_db(0,wavelet); dbbgm_batch.set_input_from_db(1,test_image); dbbgm_batch.set_input_string(2,attribute); dbbgm_batch.set_input_float(3,tolerance); dbbgm_batch.set_input_string(4,interp_functor); dbbgm_batch.set_input_string(5,data_path); print dbbgm_batch.run_process(); (image.id,image.type)=dbbgm_batch.commit_output(0); return image
def run(self): while not self.kill_received: try: index = self.input_queue.get_nowait() except Queue.Empty: break # store the result [test_image,ni,nj]=openImage(self.input_path+frameSuffix(index,5)+".tiff"); dbbgm_batch.init_process("bbgmMeasureWvLookupProcess"); dbbgm_batch.set_input_from_db(0,self.wavelet); dbbgm_batch.set_input_from_db(1,test_image); dbbgm_batch.set_input_string(2,self.attribute); dbbgm_batch.set_input_float(3,self.tolerance); dbbgm_batch.set_input_string(4,self.interp_functor); dbbgm_batch.set_input_string(5,self.data_path); print dbbgm_batch.run_process(); out_image=dbvalue(0,"") (out_image.id,out_image.type)=dbbgm_batch.commit_output(0) saveImg(out_image,self.output_path+frameSuffix(index,3)+".tiff")
def run(self): while not self.kill_received: # get a task try: job = self.work_queue.get_nowait() except Queue.Empty: break # store the result [test_image,ni,nj]=openImage(job.test_image_path); dbbgm_batch.init_process("bbgmMeasureWvLookupProcess"); dbbgm_batch.set_input_from_db(0,job.wavelet); dbbgm_batch.set_input_from_db(1,test_image); dbbgm_batch.set_input_string(2,job.attribute); dbbgm_batch.set_input_float(3,job.tolerance); dbbgm_batch.set_input_string(4,job.interp_functor); dbbgm_batch.set_input_string(5,job.data_path); print dbbgm_batch.run_process(); out_image=dbvalue(0,"") (out_image.id,out_image.type)=dbbgm_batch.commit_output(0); saveImg(out_image,job.output_path)
def updateImageStream(path,w_size,init_var,minimum_stdev,start_frame,end_frame): dbbgm_batch.init_process("vidlOpenIstreamProcess") print dbbgm_batch.set_input_string(0, path+"*.tiff"); print dbbgm_batch.run_process(); stream = dbvalue(0,""); model = dbvalue(0,""); (stream.id, stream.type) = dbbgm_batch.commit_output(0); dbbgm_batch.init_process("bbgmUpdateDistImageStreamProcess") print dbbgm_batch.set_input_from_db(1, stream); # input stream print dbbgm_batch.set_input_int(2, 3); # number of mixture components print dbbgm_batch.set_input_int(3, w_size); # window size print dbbgm_batch.set_input_float(4, init_var); # initial variance print dbbgm_batch.set_input_float(5, 3.0); # g_thresh print dbbgm_batch.set_input_float(6, minimum_stdev);# minimum standard deviation print dbbgm_batch.set_input_int(7, start_frame);# start frame print dbbgm_batch.set_input_int(8, end_frame);# end frame -1 == do all print dbbgm_batch.process_init(); print dbbgm_batch.run_process(); (model.id, model.type) = dbbgm_batch.commit_output(0); print dbbgm_batch.remove_data(stream.id); return model