I use a Teledyne Dalsa line scan camera. Sometimes when I increase the line rate of my Teledyne Dalsa line scan camera to 13000 or higher and trigger it with an Arduino at 3V3, the images are not consistently captured from the buffer for every trigger, unlike when the line rate is 10000 or lower. The trigger seems to be perfectly working in Sapera Software for increased line rate.
Attaching the code:
import platform
import os
import sys
import time
from harvesters.core import Harvester
import cv2
import numpy as np
h = Harvester()
gentl_file = r"C:\Program Files\MATRIX VISION\mvIMPACT Acquire\bin\x64\mvGenTLProducer.cti"
h.add_file(gentl_file)
h.update()
ia = h.create(0)
ia.remote_device.node_map.Width.value = 2048
ia.remote_device.node_map.Height.value = 2000
ia.remote_device.node_map.PixelFormat.value = 'RGB8'
ia.remote_device.node_map.AcquisitionLineRate.set_value(15000)
ia.remote_device.node_map.ExposureTime.set_value(47)
ia.remote_device.node_map.Gain.set_value(6)
ia.remote_device.node_map.TriggerSelector.value = "FrameBurstStart"
ia.remote_device.node_map.TriggerMode.value = "On"
ia.remote_device.node_map.triggerFrameCount.set_value(1) # new
ia.remote_device.node_map.TriggerSource.value = "Line2"
ia.remote_device.node_map.TriggerActivation.value = "RisingEdge"
ia.remote_device.node_map.TriggerDelay.set_value(0.0) # new
ia.remote_device.node_map.triggerDelaySource.value = "lineTriggerSignal" # new
ia.remote_device.node_map.LineSelector.value = "Line2"
ia.remote_device.node_map.LineFormat.value = "SingleEnded"
ia.remote_device.node_map.lineDetectionLevel.value = "Threshold_for_3V3"
ia.remote_device.node_map.LineInverter.value = False
ia.remote_device.node_map.lineDebouncingPeriod.value = 0
ia.remote_device.node_map.lineElectricalTermination.value = "Disabled"
ia.start()
start = time.time()
ia.start()
def image_capture():
global ia
print('Image capture started')
lst_app = []
with ia.fetch() as buffer:
component = buffer.payload.components[0]
_2d_new = component.data.reshape(component.height,component.width,int(component.num_components_per_pixel))
_2d_new = cv2.cvtColor(_2d_new , cv2.COLOR_RGB2BGR)
lst_app.append(_2d_new)
if len(lst_app) == 1:
print('Buffer is full')
arr = np.vstack(lst_app)
lst_app = []
return np.array(arr)
count = 0
while True:
image = image_capture()
print('captured', count)
count += 1
Thanks in Advance
Even after including all the parameters from the Sapera software, the image still doesn't get returned for certain triggers.