From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D array interpolation for intensity graph


@sheshu9a1 wrote:

Actually the data does change along with the angles.


If the data changes along the angles, we need more than one 1D array to describe it. One 1D array for each direction. We currently don't have that!

 

What you need is a 2D array of suitable size and an intensity graph that is set to have "square pixels" (By setting the axis ranges and graph size such that a square section (e.g. a 20x20 section with a different value) looks like a square and not as rectangle).

 

Then you simply go back a month ago and try to understand my code detailed here. It is trivially simple!

 

To add any other features on top of it (e.g. the angle-dependent blobs shown in your most recent graphs), it is a matter of replacing certain array elements with new data. Their position (i.e. 2D array indices) can be calculated at any time using basic geometry. If you have fewer data than pixels, you can always apply some suitable interpolation.

 

Don't get lost in the trigonometry by overcomplicating things, e.g. just changing the "cos" and not the "sin" to change a virtual angle. That's super convoluted and backwards!

0 Kudos
Message 11 of 12
(408 Views)

@altenbach wrote:
To add any other features on top of it (e.g. the angle-dependent blobs shown in your most recent graphs), it is a matter of replacing certain array elements with new data. Their position (i.e. 2D array indices) can be calculated at any time using basic geometry. If you have fewer data than pixels, you can always apply some suitable interpolation.

This would be a matter of Cartesian to Cylindrical Coordinates - Formulas and Examples - Mechamath, and from polar to your data.

 

Again, that's where complex numbers come in handy, esp. Re/Im To Polar, that does this in 1 function. X and Y, aka Re and Im, do need proper (linear) scaling of course.

 

For each pixel, convert to polar, get closest data arrays from the angle, get closes index from the radius, interpolate to get the pixel value.

 

Indeed, you would need interpolation to fill the empty spaces, but another strategy for the pixels where the data overlaps. You can simply ignore this to get things going, or for ever if this data isn't relevant anyway. Doing this entirely correct will be much more difficult than taking a few shortcuts. 

0 Kudos
Message 12 of 12
(395 Views)