Jump to content
  • Advertisement
Sign in to follow this  
mlt

Determine if vector is inside region?

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
l=sqrt(dot_product(vekt,vekt))// this is the length
if( l < kernel_radius )
do_gaussian();
Or I misunderstood something?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
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 this post


Link to post
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 this post


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

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by szecs
l=sqrt(dot_product(vekt,vekt))// this is the length
if( l < kernel_radius )
do_gaussian();
Or I misunderstood something?

vekt=point-kernel_center
or
l=dot_product(vekt,vekt)// this is the length^2
if( l < kernel_radius_2 )
do_gaussian();

Share this post


Link to post
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).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!