本文整理汇总了Python中Orange.data.StringVariable.attributes['type']方法的典型用法代码示例。如果您正苦于以下问题:Python StringVariable.attributes['type']方法的具体用法?Python StringVariable.attributes['type']怎么用?Python StringVariable.attributes['type']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orange.data.StringVariable
的用法示例。
在下文中一共展示了StringVariable.attributes['type']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: capture_image
# 需要导入模块: from Orange.data import StringVariable [as 别名]
# 或者: from Orange.data.StringVariable import attributes['type'] [as 别名]
def capture_image(self):
cap = self.cap
for i in range(3): # Need some warmup time; use the last frame
success, frame = cap.read()
if success:
self.Error.no_webcam.clear()
else:
self.Error.no_webcam()
return
def normalize(name):
return ''.join(ch for ch in unicodedata.normalize('NFD', name.replace(' ', '_'))
if unicodedata.category(ch) in 'LuLlPcPd')
timestamp = datetime.now().strftime('%Y%m%d%H%M%S.%f')
image_title, self.image_title = self.image_title or self.DEFAULT_TITLE, ''
normed_name = normalize(image_title)
for image, suffix, output in (
(frame, '', self.Output.SNAPSHOT),
(self.clip_aspect_frame(frame), '_aspect', self.Output.SNAPSHOT_ASPECT)):
path = os.path.join(
self.IMAGE_DIR, '{normed_name}_{timestamp}{suffix}.png'.format(**locals()))
cv2.imwrite(path,
# imwrite expects original bgr image, so this is reversed
self.bgr2rgb(image) if self.avatar_filter else image)
image_var = StringVariable('image')
image_var.attributes['type'] = 'image'
table = Table.from_numpy(Domain([], metas=[StringVariable('name'), image_var]),
np.empty((1, 0)), metas=np.array([[image_title, path]]))
self.send(output, table)
self.snapshot_flash = 80