当前位置: 首页>>代码示例>>Python>>正文


Python cv2.NORM_L1属性代码示例

本文整理汇总了Python中cv2.NORM_L1属性的典型用法代码示例。如果您正苦于以下问题:Python cv2.NORM_L1属性的具体用法?Python cv2.NORM_L1怎么用?Python cv2.NORM_L1使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在cv2的用法示例。


在下文中一共展示了cv2.NORM_L1属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init_detector

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import NORM_L1 [as 别名]
def init_detector(self):
        """Init keypoint detector object."""
        # BRIEF is a feature descriptor, recommand CenSurE as a fast detector:
        if check_cv_version_is_new():
            # OpenCV3/4, star/brief is in contrib module, you need to compile it seperately.
            try:
                self.star_detector = cv2.xfeatures2d.StarDetector_create()
                self.brief_extractor = cv2.xfeatures2d.BriefDescriptorExtractor_create()
            except:
                import traceback
                traceback.print_exc()
                print("to use %s, you should build contrib with opencv3.0" % self.METHOD_NAME)
                raise NoModuleError("There is no %s module in your OpenCV environment !" % self.METHOD_NAME)
        else:
            # OpenCV2.x
            self.star_detector = cv2.FeatureDetector_create("STAR")
            self.brief_extractor = cv2.DescriptorExtractor_create("BRIEF")

        # create BFMatcher object:
        self.matcher = cv2.BFMatcher(cv2.NORM_L1)  # cv2.NORM_L1 cv2.NORM_L2 cv2.NORM_HAMMING(not useable) 
开发者ID:AirtestProject,项目名称:Airtest,代码行数:22,代码来源:keypoint_matching_contrib.py

示例2: is_picture

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import NORM_L1 [as 别名]
def is_picture(self):
        sampling_interval = int(math.floor(self.scene_length / 5))
        sampling_frames = list(range(self.start_frame_no + sampling_interval,
                                     self.end_frame_no - sampling_interval + 1, sampling_interval))
        frames = []
        for frame_no in sampling_frames:
            self.video.set(cv2.CAP_PROP_POS_FRAMES, frame_no)
            ret, frame = self.video.read()
            frames.append(frame)

        diff = 0
        n_diff = 0
        for frame, next_frame in zip(frames, frames[1:]):
            diff += cv2.norm(frame, next_frame, cv2.NORM_L1)  # abs diff
            n_diff += 1
        diff /= n_diff
        self.debugging_info[4] = round(diff, 0)

        return diff < 3000000 
开发者ID:youngwoo-yoon,项目名称:youtube-gesture-dataset,代码行数:21,代码来源:clip_filter.py

示例3: get_frame

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import NORM_L1 [as 别名]
def get_frame(self,frame_data):

		# print(frame_data.size)
		frame = np.rec.array(None, dtype=[('value', np.float16),('valid', np.bool_)], shape=(self.height, self.width))
		frame.valid.fill(False)
		frame.value.fill(0.)
		# print(frame.size)

		for datum in np.nditer(frame_data, flags=['zerosize_ok']):
			# print(datum['y'])
			ts_val = datum['ts']
			f_data = frame[datum['y'], datum['x']]
			f_data.value += 1

		img = frame.value/20*255
		img = img.astype('uint8')
		# img = np.piecewise(img, [img <= 0, (img > 0) & (img < 255), img >= 255], [0, lambda x: x, 255])
		# cv2.normalize(img,img,0,255,cv2.NORM_L1)
		cv2.normalize(img,img,0,255,cv2.NORM_MINMAX)
		img = cv2.flip(img, 1)
		img = np.rot90(img)
		# cv2.imshow('img_f', img)
		# cv2.waitKey(0)
		return img 
开发者ID:prgumd,项目名称:EVDodgeNet,代码行数:26,代码来源:event.py

示例4: init_detector

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import NORM_L1 [as 别名]
def init_detector(self):
        """Init keypoint detector object."""
        self.detector = cv2.KAZE_create()
        # create BFMatcher object:
        self.matcher = cv2.BFMatcher(cv2.NORM_L1)  # cv2.NORM_L1 cv2.NORM_L2 cv2.NORM_HAMMING(not useable) 
开发者ID:AirtestProject,项目名称:Airtest,代码行数:7,代码来源:keypoint_base.py

示例5: init_detector

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import NORM_L1 [as 别名]
def init_detector(self):
        """Init keypoint detector object."""
        self.detector = cv2.BRISK_create()
        # create BFMatcher object:
        self.matcher = cv2.BFMatcher(cv2.NORM_HAMMING)  # cv2.NORM_L1 cv2.NORM_L2 cv2.NORM_HAMMING(not useable) 
开发者ID:AirtestProject,项目名称:Airtest,代码行数:7,代码来源:keypoint_matching.py

示例6: get_projection_mat

# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import NORM_L1 [as 别名]
def get_projection_mat(self, dx, dy, dz, theta):

		print("inside get_projection", dx,dy,dz,theta)
		frame = np.rec.array(None, dtype=[('value', np.uint16)], shape=(self.height, self.width))
		frame.value.fill(0)

		dx = dx*1e-3
		dy = dy*1e-3
		dz = dz*1e-3
		#Project matrix 
		start = time.time()
		k = np.matrix([[dx, dy]])
		con_k = np.repeat(k.T, self.old_xy.size/2, axis=1)
		c, s = np.cos(theta), np.sin(theta)
		R = np.matrix([[c,-s], [s,c]])
		new = self.old_xy - np.multiply((self.ts),( con_k + (dz*np.dot(R, self.old_xy))))
		end = time.time()
		print("Projection time", end-start)

		#Converstion of 2D to 1D array
		i = np.array(new[0,:] + self.width * new[1,:])
		i.astype(int)
		u_ele, c_ele = np.unique(i.T,return_counts=True)
		u_c = np.asarray((u_ele, c_ele))
		print(u_c.shape, self.width, self.height)
		
		start = time.time()
		
		# inputs = range(new.size/2)

		# for i in inputs:
		# 	if((new[0,i] >= self.width) or (new[0,i]<0) or (new[1,i] >= self.height) or (new[1,i] < 0)):
		# 		continue
		# 	xy = frame[int(new[1,i]), int(new[0,i])]
		# 	xy.value += 1

		inputs = range(u_c.size/2)
		for i in inputs:
			x = int(u_c[0,i]%self.width)
			y = int(u_c[0,i]/self.width)

			if((x >= self.width) or (x<0) or (y >= self.height) or (y < 0)):
				continue
			xy = frame[y,x]
			xy.value = u_c[1,i]

		end = time.time()
		print("For loop time", end-start)
		img = frame.value * 10
		print(img.max())
		# cv2.normalize(img,img,0,255,cv2.NORM_MINMAX)
		img = img.astype('uint8')
		# cv2.normalize(img,img,0,255,cv2.NORM_L1)
		# cv2.imshow('img_p', img)
		# cv2.waitKey(0)
		return img 
开发者ID:prgumd,项目名称:EVDodgeNet,代码行数:58,代码来源:event.py


注:本文中的cv2.NORM_L1属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。