Skip to content

Implicitly detecting sync pulses #95

Answered by ThomasAkam
jonpedros asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @jonpedros,

It is not a problem to have sync pulse that last longer than a single frame as you can extract the frame numbers corresponding to the start of the pulses. Indeed it is good practice to ensure that each sync pulse lasts for longer than a single frame to guarentee that no sync pulses are missed.

In Python, if you have a numpy array called frame_pin_state containing the state of the sync pulse signal on each frame (either as a binary True/False or integer 1/0), you can get the frame numbers corresponding start of the pulses with:

frame_pin_state = np.array([0,0,1,1,0,0,1,0,0,0,1,1,1,0,0])    # Example data
pulse_start_frames = np.where(np.diff(frame_pin_state.astype(int)) == 1)[0

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jonpedros
Comment options

Answer selected by jonpedros
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants