There are two approaches that I can think of:
1. Find the source of the issue
Why are these frames freezing? Is it the camera board itself, or is it something on the ESP32 itself? Perhaps there is some FreeRTOS task running on the ESP32 (e.g. BlueTooth or WiFi) which occasionally requires CPU and causes disp in performance.
Run idf.py menuconfig to check if:
- your CPU is running at maximum speed
- you have BlueTooth/WifiEnabled
- ...
2. Extrapolate the missing data
With this approach, you'd first detect the frame drops, and measure the amount of frames dropped. It is only an approximation though:
When you then calculate the LED blink count, take the average measured blinks from the last second (or whichever timeframe that is suitable) and fill in the missing blinks with this this data.