cancel
Showing results for 
Search instead for 
Did you mean: 

Downsampling image on f746

AAnci.1
Associate II

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?

1 REPLY 1
berendi
Principal

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.