(读者下面大块代码可以忽略,有用的在最下面)最近在做basler工业相机的api调用,用python实现,其中有一个实时显示图像的api,其调用如下:
from pypylon import pylon
from pypylon import genicam
import time
try:
imageWindow = pylon.PylonImageWindow()
imageWindow.Create(1)
# Create an instant camera object with the camera device found first.
camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
# Print the model name of the camera.
print("Using device ", camera.GetDeviceInfo().GetModelName())
# Start the grabbing of c_countOfImagesToGrab images.
# The camera device is parameterized with a default configuration which
# sets up free-running continuous acquisition.
camera.StartGrabbingMax(10000, pylon.GrabStrategy_LatestImageOnly)
while camera.IsGrabbing():
# Wait for an image and then retrieve it. A timeout of 5000 ms is used.
grabResult = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
# Image grabbed successfully?

最低0.47元/天 解锁文章
2165

被折叠的 条评论
为什么被折叠?



