Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The morph function causes many rectangles in the image #1407

Closed
kidswong999 opened this issue Jul 25, 2021 · 4 comments · Fixed by #1498
Closed

The morph function causes many rectangles in the image #1407

kidswong999 opened this issue Jul 25, 2021 · 4 comments · Fixed by #1498
Labels

Comments

@kidswong999
Copy link
Contributor

The morph function causes many rectangles in the image. It may be an algorithm error, or it may be a transmission error.
Seems to be related to resolution

error

code:

import sensor, image, time
kernel_size = 1
kernel = [-1, -1, -1,\
          -1, +8, -1,\
          -1, -1, -1]
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQQVGA)
sensor.skip_frames(10)
clock = time.clock()
while(True):
    clock.tick()
    img = sensor.snapshot()
    img.morph(kernel_size, kernel)
    print(clock.fps())
  • IDE version: 2.6.9
  • Firmware version: 4.0.2
  • Board: OPENMV-H7 Plus, OV5640 sensor
  • OS: Windows
@kwagyeman
Copy link
Member

Will check on it. Thanks for finding the issue.

@kwagyeman
Copy link
Member

Hi, this is related to the full MDMA offload. In order to get that working I have MDMA reading from the same line buffer written by DMA2 over and over again. Assuming MDMA is able to flush it's internal fifo to SDRAM fast enough you don't see these graphical issues. However, if there's a backup then MDMA doesn't read the line in time before the next line starts over writing it.

In less than full MDMA offload there's two line buffers which prevents the issue from happening. But, the processor now has to be interrupted per line. MDMA still offloads the processor form having to do the copy operation however.

I made the full offload easy to turn off via:

OMV_ENABLE_SENSOR_MDMA_TOTAL_OFFLOAD

So, I'll set that to zero. Unfortunately, the only fix without doing this is to slow down the camera pixclk, use a larger resolution, or increase the horizontal blanking. The combo of what works changes all over the place.

@kwagyeman
Copy link
Member

Why a single buffer for DMA2? Because MDMA can't be used in a more complex mode without a linked list struct per line to tell it what to do :/.

Anyway, the only fix for this is to tune each camera settings to not have issues.

@kwagyeman
Copy link
Member

Fixed: #1498

iabdalkader added a commit that referenced this issue Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants