Open mamtesh-grydsense opened 1 year ago
Thank you for sharing your experiment and code snippet. I tried your code and reproduced the results. However, I added code to measure the frame rate and found that the frame rate fluctuates in the range of 1 to 2 frames per second. We think this is normal.Since the depth data is calculated by collecting four consecutive frames of RAW data by the camera, sometimes frames may be dropped due to discontinuous images, resulting in frame rate fluctuations. You can also add the following code to the loop of the capture function to see the frame rate fluctuate every second.
def display_fps():
display_fps.frame_count += 1
current = time.time()
if current - display_fps.start >= 1:
print("fps: {}".format(display_fps.frame_count))
display_fps.frame_count = 0
display_fps.start = current
display_fps.start = time.time()
display_fps.frame_count = 0
def capture():
...
while True :
...
if durtn>=120: # time in second
print("frm cnt: {}".format(frm_cnt))
break
display_fps()
...
Below is the result of my test
pi@raspberrypi:~/Arducam_tof_camera/example/python $ python diff.py
fps: 22
fps: 30
fps: 30
fps: 30
fps: 29
fps: 30
fps: 30
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 30
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 30
fps: 31
fps: 31
fps: 30
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 30
fps: 31
fps: 31
fps: 29
fps: 30
fps: 29
fps: 29
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 29
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 29
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 30
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 30
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 31
fps: 30
frm cnt: 3569
done
Hello, how do you go about detecting discontinuous sequences of raw frames?
My company is using V4L2 to directly read the raw frames, but the sequence number returned by the kernel does not seem to always line up. Sometimes the first frame is a different phase then it should be.
We take the modulo of the sequence number to determine which of the 4 frames it is.
Is there an algorithm we could use to determine if the 4 raw frames are in the proper order?
We use the timestamp obtained by the frame to determine whether it is a continuous frame. The Tof camera will output 4 frames in a row (in a short period of time), and the next 4 frames will be very long (8.3ms if it is 120fps)
That seems to have fixed the issue. Thank you!
I have done a simple experiment to ensure that there is no frame missing from the capture of the Arducam Tof camera. But there are frames missing for DEPTH data. I have just dumped and plotted the time difference between frames and seen the many picks in the interval plot. Please have a look at to plot and kindly give a workaround to fix this frame-missing issue.
Attaching the code snippet as well to reproduce it.
`import cv2 import time import numpy as np import ArducamDepthCamera as ac
def capture(): cam = ac.ArducamCamera() if cam.init(ac.TOFConnect.CSI,0) != 0 : print("initialization failed") if cam.start(ac.TOFOutput.DEPTH) != 0 : print("Failed to start camera")
if name=='main': capture()`