esp32-cam-micropython-2022
esp32-cam-micropython-2022 copied to clipboard
camera.capture() , does not capture newest frame. It captures one previous frame.
When I capture image using camera.capture() and saved it, the previous frame is captured instead of fresh, latest frame.
I noticed the same thing. You can modify site.py and add an extra camera.capture() before the "real" one to clear the buffer.
For example:
@route('/foto')
def foto(cs,v): # still photo
try:
buf=camera.capture()
#ln=len(buf)
cs.setblocking(True)
cs.write(b'%s\r\n\r\n' % hdr['pic'])
cs.write(camera.capture())
cs.write(b'\r\n') # send and flush the send buffer
#nc=cs.write(b'%s\r\n\r\n' % (hdr['pix']%ln)+buf)
except Exception as e:
print(f"EX:{e}")
clean_up(cs)