Open alapsansky opened 1 year ago
Hello, I have some further questions: How many cameras do you use and what Posilica models are they? Is it possible, that you are accessing the same camera several times? The code does the settings, before you start streaming, so the error doesn't make a lot of sense to me. Unless the camera is still streaming from a different run of the program.
I see one issue that should have also triggered an error:
self.cam.RecorderPreEventCount.set(2000)
The camera should not be able to store 2000 frames or are you using a really small ROI? The feature StreamHoldCapacity should tell you how many frames the camera can store.
Hi Teresa,
Thank you for your response! I currently have a single GE680 camera connected, but I am hoping that I can write the code such that I can add a second or third camera when the time comes.
I have tried lowering the number of frames from 2000 to 200. The code now runs without error, but no file is saved.
Any ideas?
Correction - the same error occurs with a lower number of frames. I simply did not connect to the camera in that first case. However, I noticed that I need to move the lines below to outside of the while True
statement.
threading.Thread(target=self.write_video_file, daemon=True).start()
self.cam.start_streaming(handler=self)
This fixes the error (that the camera is already streaming). However, I am unable to stop streaming and save the video file. The KeyboardInterrupt
inside the record
function does not catch. My lack of experience with python is showing. Any help is appreciated.
I think I am quite far from achieving my goal with my above code, which is to stream at 200 fps using a circular buffer and save the previous n seconds worth of frames as a video when I hit a key on the keyboard. If anyone can suggest any solution, even for a single camera, it would be greatly appreciated.
Apart from the Python code, I think one issue is also the use of the recorder mode in the Prosilica, which can be a bit finnicky and needs to be handled differently than regular streaming. You would need to work with a hardware trigger through GPIO. If the python implementation is an issue, please try the settings of the camera in our Vimba Viewer first. Have a look at this section of the Feature Referece regarding the Recorder settings:
The camera continuously records images into the camera on-board FIFO image buffer, but does not send them to the host until an AcquisitionRecord trigger signal is received. Further AcquisitionRecord trigger events are ignored until acquisition is stopped and restarted. Combined with RecorderPreEventCount, this feature is useful for returning any number of frames before a trigger event. If an AcquisitionRecord trigger is received, the currently imaging image or acquiring image completes as normal, and then at least one more image is taken. The FIFO volatile image memory is a circular buffer, that starts rewriting images once it is full. Its size is determined by AcquisitionFrameCount.
Documentation for Prosilica GE cameras GigE Features Reference PDF
I need help setting up a GigE camera to function with a circular recording buffer. I am trying to record a brief event (hummingbird coming to a feeder). It is tough to trigger the camera before this happens.
What I would like to do is stream at 200 fps using a circular buffer and save the previous 10 seconds worth of frames as a video when I hit a key on the keyboard.
I have tried setting
self.cam.AcquisitionMode.set("Recorder") self.cam.RecorderPreEventCount.set(2000)
but I keep getting an error (that the camera is already streaming). I know that I am doing something wrong, but I cannot seem to find an example for how this might be done.
Here is my current code. You will notice that it is based on a response to a previous issue.