Re: linear to 2D mapping



micromysore said:
> hi,
> Are there similar ways to mapping a 1D filter co-efficients to 2D
> filter as in DSP filter design ..
>
> a 1D vector to a 2D matrix, which contains same values but is
> circularly symmetrical .. I will try to explain further with an
> example.
>
> for ex ..
>
> t = [1 2 3 2 1] ---- a 1D vector
>
> output sud be
>
> o = x 1 1 1 x
> 1 2 2 2 1
> 1 2 3 2 1 ----- a 2D matrix output, "x" dont care values
> 1 2 2 2 x
> x 1 1 1 x
>
> Basically given a vector, how to create a matrix out of that vector
> which has circular symmetry ?? I am not after the 2D-frequency
> transform or spatial - log-polar kind of conversion .. Simple mappings
> point wise from a given [N x 1] or [1 x N] vector to [N x N] matrix
>
> For example .. taking a 1D guassian fn, I sud be able to create a 2D
> guassian matrix by the method
>
> Any pointers, directions, references wud be of great help ..
>
> -mic
>
>

You're not, by any chance, looking to smooth images, or something? It would be
coonvenient if you were familiar with graphics algorithms, because here's the
way this problem looks to me. You have an array of elements, starting from
index 0, each of which you wish to turn into a circle with radius equal to its
index. Think of each of the values in your array as a color, and the array as a
spectrum, which you wish to turn into a rainbow. So, for successive elements,
you draw a circle in your matrix using a circle-drawing algorithm, at a radius
equal to the index of the element. Voila! You have your radial mapping!

Except there is a problem. Depending on your circle-drawing algorith, you are
going to have holes and/or overlaps between successive circles. So, you also
need a second "count" matrix to keep track of how many "dots" have been
"drawn" there, and a sum of values in the first matrix, rather than a single
value. So, initialize both matrices to zeroes. Append half as many more
elements to the array as it already has (+1/2 is easier than +.4142136), and
initialize them to zeroes, so that points outside the circle are covered when
the matrix is drawn. Draw concentric circles with successive radii for all
eleemnts int he array. Now, each time you draw a point in a circle, you add the
value, rather than just assign it, and you increment the corresponding element
in the count matrix. Just make sure not to draw your circle outside of the
dimensions of your array.

When you're done, you go through your count matrix. If the count for an element
is zero you set the corresponding element in the first matrix to the average of
its neighbors. If the count is more than one, you divide the corresponding
element in the first matrix by the count. Essentially, you are dividing
everything in the first matrix by its corresponding count, but dividing by 1 is
useless, and dividing by zero is not allowed (or useful here), so we needed
another way to turn zero into something other than zero to fill holes. In any
case, at this point you have a smoothed radial version of whatever function
your array represents.

If you are doing some kind of visual processing, you might want to consider
applying your linear filter vertically, then horizontally. Just a thought. Hope
this helps.

I'm not here much these days. Just kind of dropped by. If you have any
questions, you might want to email me. Have a nice day!

--
Smiles,

Tony
.



Relevant Pages

  • Re: sumif column contains text
    ... The MMULT function is limited to 5461 rows. ... This will return a horizontal array of either TRUE or FALSE ... circle, red circle, yellow circle, blue square, red square and so on.) ...
    (microsoft.public.excel.misc)
  • Re: sumif column contains text
    ... Sorry for the slight mix up about what I ... This will return a horizontal array of either TRUE or FALSE ... circle, red circle, yellow circle, blue square, red square and so on.) ...
    (microsoft.public.excel.misc)
  • Re: sharing information in a class
    ... But there are situations when the first form is better, ... >> does not pick a Circle from an array and display that. ... int count_cylinder = 0; ...
    (comp.lang.cpp)
  • Re: conformal map regular polygone into unit circle.
    ... > maps the unit circle into a REGULAR polygon ... > way too complex to be integrated (I'm trying to find the mapping for a ... > circle in the S-C transform because out of the symmetry of the problem, ... they should also be on a regular polygon. ...
    (sci.math.research)
  • Re: operator overloading .. more
    ... > circle is a degenerate ellipse, ... But multiplying two square matrices results in another ... So sometimes a valid design desission is to say that an array Is-A ...
    (alt.comp.lang.learn.c-cpp)