大家好,这是使用basler设置basler相机参数的正确方法吗?
在调用camera.stratGrabbing()函数后,是否还有其他方式访问摄像机?
我犯了错误,就像:
return _genicam.IInteger_SetValue(self, Value, Verify) _genicam.AccessException: Node is not writable. : AccessException thrown in node 'Height' while calling 'Height.SetValue()' (file 'integert.h', line 77)
import cv2
from pypylon import pylon
camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
converter = pylon.ImageFormatConverter()
camera.Open()
camera.CenterX=False
camera.CenterY=False
# demonstrate some feature access
new_width = camera.Width.GetValue() - camera.Width.GetInc()
if new_width >= camera.Width.GetMin():
camera.Width.SetValue(new_width)
numberOfImagesToGrab = 100
camera.StartGrabbing()
camera.Open()
print("Max gain",camera.Gain.Max)
print("Min gain",camera.Gain.Min)
print("Max ExposureTime",camera.ExposureTime.Max)
print("Min ExposureTime",camera.ExposureTime.Min)
i=0
j=0
while camera.IsGrabbing():
grabResult = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
if grabResult.GrabSucceeded():
i+=1
j+=1
if i==700:
print(i)
#camera.Open()
camera.Height.SetValue( 200)
camera.Width.SetValue( 300)
camera.Gain=5
camera.ExposureTime=8000
i=0
if j==500:
#camera.Open()
print(j)
camera.Height.SetValue(1088)
camera.Width.SetValue( 2048)
camera.Gain=20
camera.ExposureTime=8000
j=0
# Access the image data.
print("AMAR :",camera.IsOpen())
image = converter.Convert(grabResult)
img = image.GetArray()
cv2.imshow("image",img)
cv2.waitKey(1)
grabResult.Release()
camera.Close()发布于 2022-06-30 08:56:12
# cam stop
cam.AcquisitionStop.Execute()
# grab unlock
cam.TLParamsLocked = False
cam.OffsetX = 0
cam.OffsetY = 0
cam.Width = cam.Width.Max // 4
cam.Height = cam.Height.Max // 4
# grab lock
cam.TLParamsLocked = True
# cam start
cam.AcquisitionStart.Execute()有了锁,它可能会帮你
发布于 2022-07-14 15:06:34
当摄像机处于抓取状态(在camera.StartGrabbing()之后)时,不能更改摄像机的宽度/高度参数。只有关于AOI设置的RW参数是OffsetX/OffsetY和其他依赖于模型的参数(CenterX、/CenterY / MirrorX / MirrorY),因为它们不需要在摄像机内重新分配内存缓冲区。
在抓取循环之前和camera.Open()之后放置任何宽度/高度变化。
从您的代码中,我假设您希望在相机抓取时进行某种动态参数更改。请考虑巴斯勒王牌相机的序贯功能。简而言之,摄像头可以自动地、逐帧地更改一些参数,而无需任何用户命令。但是,在你的宽度/高度的情况下,它还是帮不了你的。
进一步解读如下:
https://stackoverflow.com/questions/72795884
复制相似问题