简体   繁体   中英

Can change camera's Device Parameters using Aravis github project

Code is provided below.

The line: device.set_string_feature_value('PixelCoding', 'Raw') is not working. It defaults pixelCoding to the default (Mono)

I tired putting the lines: device.set_integer_feature_value('TLParamsLocked', 0) device.set_integer_feature_value('TLParamsLocked', 1) to see if this was not letting the parameters update, but that didnt work.

Let me know if you need more elaboration on anything.

link to project: 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 )

Figured out that the Camera PixelCoding is not able to be modified by the user. Verified using GEV DEMO application

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM