gpt4 book ai didi

python - 可以使用 Aravis github 项目更改相机的设备参数

转载 作者:太空宇宙 更新时间:2023-11-04 11:53:49 24 4
gpt4 key购买 nike

代码如下。

行:device.set_string_feature_value('PixelCoding', 'Raw')不管用。它默认 pixelCoding 为默认 (Mono)

我厌烦了这些台词:device.set_integer_feature_value('TLParamsLocked', 0)device.set_integer_feature_value('TLParamsLocked', 1)看看这是否不让参数更新,但那没有用。

如果您需要更多详细说明,请告诉我。

项目链接:https://github.com/AravisProject/aravis

import sys
import gi
import numpy

gi.require_version('Aravis', '0.6')
from gi.repository import Aravis

Aravis.enable_interface("Fake")

try:
if len(sys.argv) > 1:
camera = Aravis.Camera.new(sys.argv[1])
else:
camera = Aravis.Camera.new(None)
except:
print("No camera found")
exit()

camera.set_region(0,0,512,640)
camera.set_frame_rate(30.0)

device = camera.get_device()
device.set_integer_feature_value('TLParamsLocked', 0)


device.set_string_feature_value('SensorGainMode', 'HighGainMode')
device.set_string_feature_value('TemperatureLinearMode', 'On')
device.set_string_feature_value('TemperatureLinearResolution', 'High')
device.set_string_feature_value('PixelFormat', 'MONO16')
print device.get_boolean_feature_value('TLParamsLocked')
device.set_string_feature_value('PixelCoding', 'Raw')

print("pixel coding")
print device.get_string_feature_value('PixelCoding')
print device.get_string_feature_value('PixelFormat')

payload = camera.get_payload()

[x,y,width,height] = camera.get_region()

print("Camera vendor : %s" %(camera.get_vendor_name()))
print("Camera model : %s" %(camera.get_model_name()))
print("Camera id : %s" %(camera.get_device_id()))
print("ROI : %dx%d at %d,%d" %(width, height, x, y))
print("Payload : %d" %(payload))
print("Pixel format : %s" %(camera.get_pixel_format_as_string()))

stream = camera.create_stream(None, None)


for i in range(0,10):
stream.push_buffer(Aravis.Buffer.new_allocate(payload))

print("Start acquisition")

camera.start_acquisition()

print("Acquisition")

for i in range(0,20):
buffer = stream.pop_buffer()
data = buffer.get_data()

img_data = numpy.ndarray(buffer=data, dtype=numpy.uint16, shape=(camera.get_region()[3], camera.get_region()[2], 1))
#print img_data[0]
#numpy.savetxt("foo.csv", img_data, delimiter=",")
if buffer:
stream.push_buffer(buffer)

print("Stop acquisition")

camera.stop_acquisition()
device.set_integer_feature_value('TLParamsLocked', 1 )

最佳答案

发现用户无法修改 Camera PixelCoding。使用 GEV DEMO 应用验证

关于python - 可以使用 Aravis github 项目更改相机的设备参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55128810/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com