Forums - Scaling method in fcvScaleDownMNu8

5 posts / 0 new
Last post
Scaling method in fcvScaleDownMNu8
DaniilPattersson
Join Date: 17 Jul 12
Location: Russia
Posts: 23
Posted: Sun, 2012-07-22 22:20

Hi guys!

What's a MN method in fcvScaleDownMNu8? Is it applicable for color images?

  • Up0
  • Down0
mingy
Join Date: 20 Jul 12
Posts: 7
Posted: Mon, 2012-07-23 17:27

Hi,

MN is an algorithm we chose to do arbitrary down scaling. M and N are the output width and input width respectively.

Basically this algorithm accumulates the input values while keeps adding the output length until the updated output length is greater or equal to the input length, at which point an output value is generated. The output value is the average of the accumulated input value. Notice that the input value accumulator is reset to 0 each time an output is generated.

We applied the MN algorithm both horizotally and vertically to an input image.

It's applicable for planar input (eg: a luma plane).

fcvScaleDownMNInterleaveu8, however, is applicable for 2-byte interleaved input (eg: a CbCr interleaved plane).

 

  • Up0
  • Down0
DaniilPattersson
Join Date: 17 Jul 12
Location: Russia
Posts: 23
Posted: Tue, 2012-07-24 01:02

Thanks, but it's a little bit complicated. Let's assume, we have a matrix:

 

8 11  1 4

8 6 10 0

5 10  4 7

15 13 2 15

and downscale it to 2*2 matrix. So, what are the first few steps of algorithm? From which element in input matrix we start accumulate to get (0,1) element in output?

  • Up0
  • Down0
mingy
Join Date: 20 Jul 12
Posts: 7
Posted: Tue, 2012-07-24 10:44

M over N algorithm process data in one direction. In a matrix case it needs to be applied twice, one horizontally, one vertically.

In horizontal direction, M = 2, N = 4. Let's process the first line:

First keep adding the output width to itself one at a time, so you have added_output_width = 2 + 2 = 4,
and at the same time accumulate the input values, accumulator = 8 + 11 = 10,
also the step needs to be updated: step = 1+1 = 2,

Now check if the added output width is greater or equal to input width, the anwer is yes at this point(4 >=4), so an output value is generated like this: accumulator / step = 9, and then reset the accumulator = 0, reset step = 0, update added_output_width = added_output_width - input_width = 0.

Next we are at the third value of the first line, so added_output_width = 2, accumulator = 1, step = 1. At this point added_output_width is not greater or equal to 4, so go to the next iteration.

Now process the fourth value of the first line. added_output_width = 2 + 2 = 4, which is equal to the input line width, an output is to be generated; step = 2, accumulator = 1 + 4 = 5, and the output is accumulator / step = 2.

The first line is down scaled from  8  11  1  4  to  9  2.

Do the same on the rest 3 rows, then apply the algorithm vertically, you will get the 2x2 downscaled matrix.

Hope this helps.

  • Up0
  • Down0
DaniilPattersson
Join Date: 17 Jul 12
Location: Russia
Posts: 23
Posted: Tue, 2012-07-24 23:08

Great! Thank you, everything is clear now.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.