This is the frame subtraction function, which is also explained in Appendices B and C.
The difference between them is that Appendix B requires the host to process the subtraction, while Appendix C performs it on the sensor side. Both appendices also include sample code for your reference.
I have attached the sample code to enable the subtraction for you. For more details, please check the sample code in the appendices.
def enable_normal_internal_BG(self, exposure_mode):
"""
internal back ground subtraction with single context
"""
if self.m_bRunning:
iRet = self.m_dtccm.GrabHold(self.m_iDevID)
if iRet is None:
print("GrabHold in internal subtraction failed!")
if exposure_mode == 1:
self.set_exposure_mode(EXPOSURE_MODE_CTX0, 0x00)
else:
self.set_exposure_mode(EXPOSURE_MODE_CTX0, 0x02)
self.I2CWrite(VT_MODE_CTX0, 1) # VT_MODE = 1 : Subtraction on CTX0 , 0 : Normal Mode
self.I2CWrite_16(VT_SUB_WAIT_EXPOSURE_LINES, 0) # wait exposure lines between 2 sub-frames
self.I2CWrite_16(VT_SUB_WAIT_PIXELS, 0) # wait pixels between 2 sub-frames
self.I2CWrite_16(DARKCAL_PEDESTAL_CTX0, 0)
self.I2CWrite(GPIO_1_CTRL_CTX0, 2) # GPIO_1 = 2 (Strobe MODE)
if self.m_bRunning:
iRet = self.m_dtccm.GrabRestartWithSkip(0, 0, self.m_iDevID)
if iRet is None:
print("Restart frame in internal subtraction failed!")
time.sleep(0.5)