python - 滨松相机蟒
问题描述
我尝试用 python 和我的 Hamamatsu 相机交谈。我按照https://pypi.org/project/hamamatsu/#description中的说明安装了该软件包。
这里再次使用代码:
from hamamatsu.dcam import dcam, Stream
logging.basicConfig(level=logging.INFO)
with dcam:
camera = dcam[0]
with camera:
print(camera.info)
print(camera['image_width'].value, camera['image_height'].value)
# Simple acquisition example
nb_frames = 10
camera["exposure_time"] = 0.1
with Stream(camera, nb_frames) as stream:
logging.info("start acquisition")
camera.start()
for i, frame_buffer in enumerate(stream):
frame = copy_frame(frame_buffer)
logging.info(f"acquired frame #%d/%d: %s", i+1, nb_frames, frame)
logging.info("finished acquisition")
执行此操作时,我收到以下错误:
NameError: name 'copy_frame' is not defined
. 我找不到 copy_frame 来自哪个包。任何人都可以帮助我吗?
解决方案
(https://github.com/tiagocoutinho/hamamatsu/blob/master/hamamatsu/dcam.py)。
from hamamatsu.dcam import dcam, Stream, copy_frame
应该做。
您还忘记了示例的第一行
import logging
推荐阅读
- python - 如何仅使用重复键合并字典中的选择值
- laravel-5 - Laravel 记录“在命令行代码中找不到类 'Arr':1”
- windows - 为什么 Android Studio 拒绝在 GitHub 上共享项目?
- javascript - 如何从Javascript为元素中的输入值设置值?
- bash - 使用 bash 的 ssh-remote 插件的代码命令
- python - 使用 POST 请求提交表单后出现错误 404
- c# - 安全问题 AspNetCore Identity
- c# - C# winforms 图形超大
- java - 使用 JUNIT5 运行 Cucumber 功能文件时无法过滤它们
- python - 在正则表达式上转换 TRIM