Light influencing the camera

This image occurs when I first turn on the LEDs and then turn on the camera.

And this other image occurs when I first start the camera and then turn on the LEDs.

Is there any way to solve this ? either in the code ? keeping in mind that during the process it keeps turning on and off.

Yes, you should fix this by turning off auto gain and auto white balance right after startup.

sensor — camera sensor — MicroPython 1.23 documentation

sensor — camera sensor — MicroPython 1.23 documentation

You may also wish to play with the auto exposure.

sensor — camera sensor — MicroPython 1.23 documentation