本文整理匯總了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