首页 > 解决方案 > 滨松相机蟒

问题描述

我尝试用 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 来自哪个包。任何人都可以帮助我吗?

标签: pythonimagecompiler-errorscamerapackage

解决方案


https://github.com/tiagocoutinho/hamamatsu/blob/master/hamamatsu/dcam.py)。

from hamamatsu.dcam import dcam, Stream, copy_frame

应该做。

您还忘记了示例的第一行

import logging

推荐阅读