Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8082

Camera board • Re: HQ Camera XVS trigger with Raspberry PI 5

$
0
0
Thanks for sharing the document about software sync, since I need to sync some still photo at maximum resolution I think that the video frame sync is not the best solution for my project, but correct me if I'm wrong.

About the wired sync, step forward! I did some more test based on your response and I was able to capture the images in sink-sink cameras "just" doing a loop of the trigger. Here the code updated:

Code:

from picamera2 import Picamera2import osimport timeimport threadingimport RPi.GPIO as GPIOGPIO_TRIGGER_PIN = 17GPIO.setmode(GPIO.BCM)GPIO.setup(GPIO_TRIGGER_PIN, GPIO.OUT)GPIO.output(GPIO_TRIGGER_PIN, GPIO.LOW)def run_sink1():    sink1 = Picamera2(1)    config = sink1.create_still_configuration(        buffer_count=1,        display=None,        queue=False    )    sink1.configure(config)    sink1.start(show_preview=False)    #camera waiting xvs    time.sleep(1)     sink1.capture_file("sink1.jpg")    print("Sink1 camera capture complete.")    sink1.close()def run_sink0():    print("Configuring sink0 camera (Cam0)...")    sink0 = Picamera2(0)    config = sink0.create_still_configuration(        buffer_count=1,        display=None,        queue=False    )    sink0.configure(config)    sink0.start(show_preview=False)    print("Sink0 camera started and waiting for hardware trigger (XVS)...")    #camera waiting xvs    time.sleep(1)     sink0.capture_file("sink0.jpg")    print("Sink0 camera capture complete.")    sink0.close()def trigger():    while True:        print("GPIO17 out...")        GPIO.output(GPIO_TRIGGER_PIN, GPIO.HIGH)        time.sleep(0.001)         GPIO.output(GPIO_TRIGGER_PIN, GPIO.LOW)        print("GPIO pulse sent.")        time.sleep(0.1)    def main():    sink0_thread = threading.Thread(target=run_sink0)    sink1_thread = threading.Thread(target=run_sink1)    trigger_thread = threading.Thread(target=trigger)        sink0_thread.start()    sink1_thread.start()    trigger_thread.start()        sink0_thread.join()    sink1_thread.join()    trigger_thread.join()        GPIO.cleanup()if __name__ == "__main__":    main()
But the images captured are often only a little line on the top of the frame, sometimes one good and the other a line, sometimes one with a brightness step and the other a line. Never two full images. I tried to play with times like you said (and also with exposure, gain etc) but with no positive results.
Because I'm not running a video framerate to match, but I'm waiting in a still configuration, which could be the solution? Thanks

Statistics: Posted by fede7890 — Wed May 07, 2025 9:57 pm



Viewing all articles
Browse latest Browse all 8082

Trending Articles