def test_ocl_interpolate_flow_hires(self): img_1 = os.path.join(settings['tmp_dir'], '~test_ocl_interpolate_flow_hires_1.jpg') img_2 = os.path.join(settings['tmp_dir'], '~test_ocl_interpolate_flow_hires_2.jpg') mk_sample_image(img_1, 4096, 2160, 3) mk_sample_image(img_2, 4096, 2160, 3) fr_1 = cv2.imread(img_1) fr_2 = cv2.imread(img_2) fr_1_gr = cv2.cvtColor(fr_1, cv2.COLOR_BGR2GRAY) fr_2_gr = cv2.cvtColor(fr_2, cv2.COLOR_BGR2GRAY) fu,fv = ocl_farneback_optical_flow( fr_1_gr,fr_2_gr,0.5,3,15,3,7,1.5,False,0) bu,bv = ocl_farneback_optical_flow( fr_2_gr,fr_1_gr,0.5,3,15,3,7,1.5,False,0) fr_1_32 = np.float32(fr_1)*1/255.0 fr_2_32 = np.float32(fr_2)*1/255.0 self.assertIsNotNone( ocl_interpolate_flow(fr_1_32,fr_2_32,fu,fv,bu,bv,1)[0])
def test_ocl_interpolate_flow_hires(self): img_1 = os.path.join(settings['tempdir'], '~test_ocl_interpolate_flow_hires_1.jpg') img_2 = os.path.join(settings['tempdir'], '~test_ocl_interpolate_flow_hires_2.jpg') mk_sample_image(img_1, 4096, 2160, 3) mk_sample_image(img_2, 4096, 2160, 3) fr_1 = cv2.imread(img_1) fr_2 = cv2.imread(img_2) fr_1_gr = cv2.cvtColor(fr_1, cv2.COLOR_BGR2GRAY) fr_2_gr = cv2.cvtColor(fr_2, cv2.COLOR_BGR2GRAY) fu, fv = ocl_farneback_optical_flow(fr_1_gr, fr_2_gr, 0.5, 3, 15, 3, 7, 1.5, False, 0) bu, bv = ocl_farneback_optical_flow(fr_2_gr, fr_1_gr, 0.5, 3, 15, 3, 7, 1.5, False, 0) fr_1_32 = np.float32(fr_1) * 1 / 255.0 fr_2_32 = np.float32(fr_2) * 1 / 255.0 self.assertIsNotNone( ocl_interpolate_flow(fr_1_32, fr_2_32, fu, fv, bu, bv, 1)[0])
def setUp(self): img_1 = os.path.join(settings['tmp_dir'], '~test_interpolate_flow_test_case_1.jpg') img_2 = os.path.join(settings['tmp_dir'], '~test_interpolate_flow_test_case_2.jpg') mk_sample_image(img_1, 320, 240, 3) mk_sample_image(img_2, 320, 240, 3) fr_1 = cv2.imread(img_1) fr_2 = cv2.imread(img_2) fr_1_gr = cv2.cvtColor(fr_1, cv2.COLOR_BGR2GRAY) fr_2_gr = cv2.cvtColor(fr_2, cv2.COLOR_BGR2GRAY) self.fu, self.fv = \ ocl_farneback_optical_flow(fr_1_gr,fr_2_gr,0.5,3,15,3,7,1.5,False,0) self.bu, self.bv = \ ocl_farneback_optical_flow(fr_1_gr,fr_2_gr,0.5,3,15,3,7,1.5,False,0) self.fr_1_32 = np.float32(fr_1)*1/255.0 self.fr_2_32 = np.float32(fr_2)*1/255.0 self.ocl_inter_method = lambda t: \ ocl_interpolate_flow( self.fr_1_32,self.fr_2_32,self.fu,self.fv,self.bu,self.bv,t)
def setUp(self): img_1 = os.path.join(settings['tempdir'], '~test_interpolate_flow_test_case_1.jpg') img_2 = os.path.join(settings['tempdir'], '~test_interpolate_flow_test_case_2.jpg') mk_sample_image(img_1, 320, 240, 3) mk_sample_image(img_2, 320, 240, 3) fr_1 = cv2.imread(img_1) fr_2 = cv2.imread(img_2) fr_1_gr = cv2.cvtColor(fr_1, cv2.COLOR_BGR2GRAY) fr_2_gr = cv2.cvtColor(fr_2, cv2.COLOR_BGR2GRAY) self.fu, self.fv = \ ocl_farneback_optical_flow(fr_1_gr,fr_2_gr,0.5,3,15,3,7,1.5,False,0) self.bu, self.bv = \ ocl_farneback_optical_flow(fr_1_gr,fr_2_gr,0.5,3,15,3,7,1.5,False,0) self.fr_1_32 = np.float32(fr_1) * 1 / 255.0 self.fr_2_32 = np.float32(fr_2) * 1 / 255.0 self.ocl_inter_method = lambda t: \ ocl_interpolate_flow( self.fr_1_32,self.fr_2_32,self.fu,self.fv,self.bu,self.bv,t)