可以使用Aravis github项目更改摄像机的设备参数

问题描述 投票:0回答:1

代码如下。

行: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 )
python linux project flir genicam
1个回答
0
投票

弄清楚用户无法修改Camera PixelCoding。使用GEV DEMO应用程序验证

© www.soinside.com 2019 - 2024. All rights reserved.