# Determine if vector is inside region?

This topic is 3300 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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)?

##### Share on other sites
l=sqrt(dot_product(vekt,vekt))// this is the lengthif( l < kernel_radius )    do_gaussian();
Or I misunderstood something?

##### Share on other sites
It has a radius and a height:

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.

##### Share on other sites
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?

##### Share on other sites
...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...

##### Share on other sites
The theoretical gaussian has infinite support but in the implementation its possible to specify a finite support.

##### Share on other sites
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]

##### Share on other sites
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)

##### Share on other sites
Quote:
 Original post by szecsl=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();

##### Share on other sites
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).

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5
JoeJ
13

• 14
• 10
• 25
• 9
• 57
• ### Forum Statistics

• Total Topics
632641
• Total Posts
3007619
• ### Who's Online (See full list)

There are no registered users currently online

×