• DepthAI-v3
  • GetWidth() returns a huge number; getTimestamp() is not host timestamp

Hi, I have an ImgFrame obj, but getWidth() and getHeight() on that object return big numbers, 349192 349200, but my resolution is 1080P. I would expect 1920 and 1080.

Another question, getTimestamp() on ImgFrame returns a value like this: 4:53:44.967177.
Question is how to convert it to host time? Please share some pointers.

Mine is POE and my DepthAI is the newest version.

Thanks for helps.

JK

Hi,
getTimestamp() gives time from device start, not host system time. It’s from the device’s own clock. If you need host time, you have to track when you got the first frame and go from there — but usually you can just use device time as-is.

About the width/height — those values don’t look right for 1080P. Can you share a quick code snippet showing how you get the ImgFrame and call getWidth() / getHeight()?

Thanks!

@lovro Here is the code regarding the getWidth and getHeight returning big values
fps = 10
cam_rgb = pipeline.createColorCamera()
cam_rgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)
cam_rgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
cam_rgb.setFps(fps)
cam_rgb.setInterleaved(False)
jpeg_encoder = pipeline.createVideoEncoder()
jpeg_encoder.setDefaultProfilePreset(10, dai.VideoEncoderProperties.Profile.MJPEG)
...

q1 = device.getOutputQueue(name="stream_1", maxSize=1, blocking=False)

while True:
frame = q1.tryGet()
if frame != None:
w = frame.getWidth()
h = frame.getHeight()
print(w, h)
-- ouput
214092 214096

Hi!
From what you posted, it looks like you might be reading the output from the MJPEG encoder. If that's the case, the object you're getting isn't an ImgFrame, but a bitstream packet, and calling getWidth() / getHeight() on that can return random values — which could explain the numbers you're seeing.
I can’t say for sure without seeing how the camera is linked to the output queue, but if you're connecting the encoder's bitstream to the XLink output, that's likely the issue. To get valid width/height values, make sure you're reading from the camera’s video or preview output directly — those produce proper ImgFrame objects.
Maybe try if the these examples work fine.

5 days later

Thanks for the answer that clarifies my confusion.