Jump to content

Does anyone know anything about 2D interpolation using labview FPGA?


Recommended Posts

I'm not sure I undestand the question. LabVIEW FPGA can handle math caluclation, although decimal numbers are a bit cumbersome, and the straight line formula is pretty straight forward to implement.

Are you sure you need a LabVIEW FPGA for this? Do you have a very specific application?

 

Edited by codcoder
Link to comment

I believe what you described is extrapolation and I think you've under defined your system (or you actually want 1d interpolation). What would points (1,2 and 2,1) correspond to? It's not totally clear how you would want to determine that 0.5,0.5 corresponds to 0.5. A naive approach would be to use the slopes of 1,1 to 1,2 and from 1,1 to 2,1.

Link to comment
16 hours ago, infinitenothing said:

I believe what you described is extrapolation and I think you've under defined your system (or you actually want 1d interpolation). What would points (1,2 and 2,1) correspond to? It's not totally clear how you would want to determine that 0.5,0.5 corresponds to 0.5. A naive approach would be to use the slopes of 1,1 to 1,2 and from 1,1 to 2,1.

I'm sorry, I probably didn't phrase it very well. As you can see in this graph, each value of X and C corresponds to a value of W, that is, a set of (X,C) determines a W. After sampling the data on this graph, the value of (X,C) that I get now may not correspond exactly to the sampled points. At this point, I need to perform a 2D interpolation to get the W value. This is my idea, not sure if I have expressed it clearly, thanks anyway!
 

插值.png

Link to comment
On 4/19/2024 at 3:30 PM, codcoder said:

I'm not sure I undestand the question. LabVIEW FPGA can handle math caluclation, although decimal numbers are a bit cumbersome, and the straight line formula is pretty straight forward to implement.

Are you sure you need a LabVIEW FPGA for this? Do you have a very specific application?

 

I'm sorry, I probably didn't phrase it very well. As you can see in this graph, each value of X and C corresponds to a value of W, that is, a set of (X,C) determines a W. After sampling the data on this graph, the value of (X,C) that I get now may not correspond exactly to the sampled points. At this point, I need to perform a 2D interpolation to get the W value. This is my idea, not sure if I have expressed it clearly, thanks anyway!
 

插值.png

Link to comment

That part that's still confusing is that it looks like you have just one independent variable (time). If that's the case, that's just 1D interpolation. Also, your time vs x and your time vs C look like it has one slope so potentially, that's even more simple in that it's just a simple Y=m*X+b calculation. Also, it's not clear how much of this is calculable offline (no real time required).  Also, your original example used extrapolation and it's not clear if that's a requirement.

Link to comment
8 hours ago, infinitenothing said:

That part that's still confusing is that it looks like you have just one independent variable (time). If that's the case, that's just 1D interpolation. Also, your time vs x and your time vs C look like it has one slope so potentially, that's even more simple in that it's just a simple Y=m*X+b calculation. Also, it's not clear how much of this is calculable offline (no real time required).  Also, your original example used extrapolation and it's not clear if that's a requirement.

These graphs are just an example, and sometimes the slope may not be a constant. I would now like to tell you about my idea or need. This kind of graph above is done by planning in advance, I know the correspondence between each group (X,C) and W. I need to read the value of X and C from two encoders to find the corresponding value of W. But since it is ideal, the values of X and C are divided equally, for example, the value of X is 10 and divided into 10 parts, each with an interval of 1, but the values I read from the encoders may be 1.1 or 2.3, 3.5, etc., and the same goes for the value of C! And the values of X and C can't correspond to each other, so I can't just interpolate X or C in one dimension to get W. So I think I should find the corresponding W value by interpolating in two dimensions, but I don't know how to do it. I've only implemented one-dimensional interpolation via lookup tables so far.

Anyway, thank you very much for your reply and help!🥳

Link to comment

It's the same as 1D interpolation except you repeat it a few times. So, if you have data at 0,0 0,1 1,0 and at 1,1 and you wanted to get (0.7,0.3), you could start with finding the values at 0.7,0 0.7,1 and then interpolate between those two values.

https://en.wikipedia.org/wiki/Bilinear_interpolation

(see repeated linear interpolation)

Link to comment
7 hours ago, infinitenothing said:

It's the same as 1D interpolation except you repeat it a few times. So, if you have data at 0,0 0,1 1,0 and at 1,1 and you wanted to get (0.7,0.3), you could start with finding the values at 0.7,0 0.7,1 and then interpolate between those two values.

https://en.wikipedia.org/wiki/Bilinear_interpolation

(see repeated linear interpolation)

I know about bilinear interpolation. But I don't know how to do it with my lack of data points. The hollow points in the graph are known points and the solid points are the points to be interpolated, (Hollow points don't have some kind of linear relationship) I don't know how to use bilinear interpolation. I am not able to find 4 known points.

23099aff527245f41f862c4ddce6201f.jpg

Link to comment
16 hours ago, ensegre said:

Frankly, It seems more that you don't know what you want, than that you don't know how to do it on a FPGA.

I think I know what I need, but I can't seem to describe it accurately. I'm sorry.😭

Link to comment

Option 1:

  1. Find your 2 nearest W points (minimum Euclidian distance)
  2. Find where on the line between those two W points that's perpendicular to your unknown point
  3. Use 1D interpolation between the two W points to estimate the W point's value.

Option 2: Because W1,W2, and W3 are not colinear, you can define a surface between them. The approach would be somewhat similar to the above:

  1. Find the 3 nearest points and use them to define a surface. 
  2. Find the cross product of the two vectors give you a normal to the surface
  3. Find the cross product of the normal and your unknown point. That should give the point on the surface that corresponds to your unknown point.

Based on what you drew (your points were nearly colinear), I expect the second method to be very sensitive to noise and thus somewhat unstable and inferior to method 1.

Link to comment
10 hours ago, infinitenothing said:

Option 1:

  1. Find your 2 nearest W points (minimum Euclidian distance)
  2. Find where on the line between those two W points that's perpendicular to your unknown point
  3. Use 1D interpolation between the two W points to estimate the W point's value.

Option 2: Because W1,W2, and W3 are not colinear, you can define a surface between them. The approach would be somewhat similar to the above:

  1. Find the 3 nearest points and use them to define a surface. 
  2. Find the cross product of the two vectors give you a normal to the surface
  3. Find the cross product of the normal and your unknown point. That should give the point on the surface that corresponds to your unknown point.

Based on what you drew (your points were nearly colinear), I expect the second method to be very sensitive to noise and thus somewhat unstable and inferior to method 1.

Thank you for your continued help and advice. I'll think about it myself and learn to implement it on  FPGA. Thanks!🙂

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.