Skip to main content
AAnci.1
Visitor II
March 22, 2020
Question

Downsampling image on f746

  • March 22, 2020
  • 1 reply
  • 806 views

Hi,

I'm working on a project involving using NN with cube ai to track objects from images coming from a camera sensor.

I would like to find a way to downsample an image in the fastest / less cpu intensive way possible (the video feed is approximately 8fps and i'd like to leave the cpu unused most of the time to have more computing power for the ai library).

Downsampling from dcmi directly is not an option (need to show the full resolution, full framerate image on an lcd).

How could i go about it? I looked ad the dma2d documentation and didn't find anything regarding downsampling, what is the usual way to solve this problem?

This topic has been closed for replies.

1 reply

berendi
Principal
March 22, 2020

Just an idea, not sure if it works.

Blend even numbered horizontal lines with odd numbered ones to halve the vertical resolution, repeat if necessary.

  • Foreground base address FGMAR = start of the framebuffer
  • Foreground offset FGOR = length of a scanline, to skip every other line
  • Background base address BGMAR = FGMAR + FGOR
  • Background offset = foreground offset
  • Alpha channel value replace, low alpha values for both layers in FGPFCCR/BGPFCCR should effectively average the two halves
  • Repeat if necessary for 4x or 8x reduction.

Then do the same with vertical lines.

  • FGMAR = start of the framebuffer
  • BGMAR = FGMAR + 1, just one pixel to the right
  • FGOR = BGOR = 1, to skip every other pixel
  • Pixel per lines (in NLR) = 1
  • Number of lines should be the halved number of pixels, but the register field is only 16 bits, so more than one pass might be necessary to process the whole framebuffer.

After each pass, prepare the next one in the transfer complete interrupt.