Spot in image (not homogeneous)

Hello, I’m working with a cam 7h plus. I always see a spot in image, first I was a damaged cam chip, but other cam have the same behavior therefore I expect it is related to the optic or product.

Hi, this is an issue with the lens shading registers on the OV5640 module.

We’ve just been dealing with it because folks haven’t been complaining too much. It was worse, but I managed to reduce its intensity. However, yes, it’s still not gone.

Fix OV5640 Lens Shading · Issue #2183 · openmv/openmv (

I’ll try to work on this and see if I can resolve it. While we’ve known this is an issue for a while… it’s kinda of like the sqeaky wheel gets the oil round here given all that there is to do.

What makes it hard to fix is that there’s no documentation on the registers in the camera that controls this. I just have to peek and poke in the lens shading coefficient registers until the image looks better.

I have order new version (RT1062) will I have the same problem?

It’s a setting in the registers of the OV5640 camera. It affects all units.

You’re the first person to complain about it for a while, though.

I can probably solve the issue in a couple of days by debugging things.

Expect a fix next week.

Note, the issue disappears when you increase the resolution. It’s something to do with the hardware scalar on the system and how the lens shading works.

Is it possible to capture the image, inverse it and substrate it from the image in order to create a homogenous image?

Maybe this can help you by fixing it


It is still visible in QHD resolution

Mmm, I do not see it on my camera. I might need a flat background. With a busy scene it’s not present.

Yeah… the issue is that the documentation for the registers that control this are just this:

OV5640_datasheet.pdf (

See section 5.2 lens correction (LENC)


Hi, sorry for the delay on this:

Please run this script:

# This work is licensed under the MIT license.
# Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
# Hello World Example
# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!

import sensor
import time
import image

sensor.reset()  # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565)  # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA)  # Set frame size to QVGA (320x240)
#sensor.skip_frames(time=2000)  # Wait for settings take effect.
clock = time.clock()  # Create a clock object to track the FPS.


def print_reg(reg):
    print("[0x%02x]=0x%02x" % (reg, sensor.__read_reg(reg)))


#sensor.__write_reg(0x583E, 0)
#sensor.__write_reg(0x583F, 0)
#sensor.__write_reg(0x5840, 0)

sensor.__write_reg(0x5000, 0x27 | 0x80)

sensor.__write_reg(0x5842, 0)
sensor.__write_reg(0x5843, 0x00)
sensor.__write_reg(0x5844, 0)
sensor.__write_reg(0x5845, 0x00)

sensor.__write_reg(0x5846, 0x1)
sensor.__write_reg(0x5847, 0x00)
sensor.__write_reg(0x5848, 0x1)
sensor.__write_reg(0x5849, 0x0)

while True:
    clock.tick()  # Update the FPS clock.
    img = sensor.snapshot()
    #print(clock.fps())  # Note: OpenMV Cam runs about half as fast when connected
    # to the IDE. The FPS should increase once disconnected.

Please let me know if this improves performance to a point where it works for you.

I can commit this officially if it’s good.

Hi, thank you. I have checked the code, I can still see the spot, but not so intensive as before. Have a look

I may not have the scientific tools to fix this. I was checking against a piece of paper with lighting from above. What type of setup are you using?

It’s extremely hard to see it anymore under normal conditions after that register update.

I use a setup with a microscope, but If you just point the camera to a white wall (without backlight). You can see the dot.

I remember seeing in one of the more detailed datasheets, or maybe it was an app-note, registers that controlled the radius of the lens shading correction, and it was related to the frame size.

I’m looking in to getting some scientific tools to help debug this.