Determine if vector is inside region?

Started by
8 comments, last by Jesper T 14 years, 7 months ago
I have defined a gaussian kernel in 2D with a radius and max height. I supply a 2D vector to the kernel and based on its location a weight is calculated. Assume that the kernel has radius of 3 units (-3,-1,...,2,3) and a max height of 1 unit. Now I supply the vector [1,0.5] which clearly is inside the kernel. But how do I, based on the kernel radius and max height, determine if a vector is inside the kernel before calling the gaussian function (a lot of vectors are outside the kernel and should therefore not be passed to this function)?
Advertisement
l=sqrt(dot_product(vekt,vekt))// this is the lengthif( l < kernel_radius )    do_gaussian();
Or I misunderstood something?
It has a radius and a height:

http://upload.wikimedia.org/wikipedia/commons/archive/c/ce/20070812010819!Gaussian_2d.png


I always know the coordinates for the center of the Gaussian. But now I have to determine if a point in the same space is outside or inside the gaussian somehow.
It's a 2D vector. If it's within the kernel's support, it's within the kernel's support. If it's not, it's not. How does height come into it?
...and Gaussian kernels have infinite support, which means your question is sort of meaningless.

You could ask if a 2-vector is within a certain number of standard deviations of the mean; that's a question that would make sense...
The theoretical gaussian has infinite support but in the implementation its possible to specify a finite support.
Oh I see what he's meaning. Vector is in x-y, and the Gauss curve is in x-y too.
Do you have to determine it exactly (analytical), or is enough numerically?
If numerical, than convert the curve into a chain of line sections, and check if the vector intersects any of them.
If analytically, well that's a harder task.
You didn't described your problem correctly. The vector always have the origin of (0,0), and the Gauss is "moving" along 'x'?

If so, one idea: transform the 2D space, so the vector will be horizontal (shear, not rotate!), then determine, if the Gauss curve intersects on that section of 'x' or not.

But put some drawings on your problem, because we don't understand it clearly. (For example the vectors 'y' coordinate is always positive or not, etc)

EDIT: OK I read your posts. Why not simply evaluate the Gauss equation at the x coordinate of the point? Or do I miss something?

[Edited by - szecs on September 11, 2009 1:29:20 AM]
The whole point is to minimize the calls to the gaussian since its way to expensive to evaluate for all my points (typically 512*512*64)
Quote:Original post by szecs
l=sqrt(dot_product(vekt,vekt))// this is the lengthif( l < kernel_radius )    do_gaussian();
Or I misunderstood something?

vekt=point-kernel_center
or
l=dot_product(vekt,vekt)// this is the length^2if( l < kernel_radius_2 )    do_gaussian();
If it is color values you are calculating (noise maybe?). Then anything more than 3 to 4 standard deviations away could be considered zero.

You might just put that condition into the gauss function actually (since it needs to calculate the square of the length anyway).

This topic is closed to new replies.

Advertisement