elerac/EasyPySpin

VideoCapture.get(cv2.CAP_PROR_FPS) return None

Umblife opened this issue · 1 comments

Hello, thanks for your great job.

When I used the get() method of the VideoCapture class with a FLIR camera, I got unexpected value.

>> vc = EasyPySpin.VideoCapture(0)
>> vc.set(cv2.CAP_PROP_FPS, 20)
True

# 20 is expected. But actually None is back
>> vc.get(cv2.CAP_PROR_FPS)
None

I found this,

if propId == cv2.CAP_PROP_FPS:
# If this does not equal the AcquisitionFrameRate
# it is because the ExposureTime is greater than the frame time.
return self.get_pyspin_value("ResultingFrameRate")

so debugged "AcquisitionFrameRate" and "ExposureTime", but the exposure time is less than the frame time.

# debug
>> self.get_pyspin_value("AcquisitionFrameRate")
19.999350421098324  # 20fps -> frame time: 0.05sec
>> self.get_pyspin_value("ExposureTime")
15002.0 # micro sec -> 0.015 sec

I checked self.cam of VideoCapture class, but self.cam doesn't have an attribute "ResultingFrameRate". In fact, this get_pyspin_value() method called here also returns None by the following processing.

# Check 'CameraPtr' object has attribute 'node_name'
if not hasattr(self.cam, node_name):
warn(f"'{type(self.cam).__name__}' object has no attribute '{node_name}'")
return None

However, self.cam has "AcquisitionResultingFrameRate". Is this considered the same as the "ResultingFrameRate" in the original code ?

# debug
>> self.get_pyspin_value("AcquisitionFrameRate")
19.999350421098324
>> self.get_pyspin_value("AcquisitionResultingFrameRate")
19.999350401098972  # Approximately the same value as "AcquisitionFrameRate" is returned

Thanks for your helping

Hi @Umblife !

Thanks for your great report!

As you say, "ResultingFrameRate" returns None, and "AcquisitionResultingFrameRate" is correct.

I have completed the fix. Please check it.