06-10-2010 04:40 PM
Hi,
this is not really a problem but i am properly confused by the purpose or the way labview works. as i am doing the 2d interpolation for some image analysis, i converted the loaded image into a 2D array. it took me a while to figure out the index correspondence between pixel coord and the (row, col) in the array. it seems that the pixel value at (x, y) coord is put in the (col, row) of the matrix, so that when the 2D array is displayed in an intensity map, it is rotated 90 degrees wrt to the image.
i can see the point of this "column first" index convention, because the matrix index is (col, row) in the image coord:
(col0, row0) (col1, row0), ...
(col0, row1) (col1, row1), ...
...
nonetheless, common labview vi for array manipulation such as "index array" and "replace array subset" still work in such a way that the first index is row and then the column follows, same as how people locate matrix elements. if not dealing with image, there is no confusion, untill --
as i am doing the 2D interpolation, which does not have to be involved in image processing at all, the (xi, yi) pairs actually mean (col, row), when the help doc says xi is the first "independent variable", even though clearly if i want to read an element, i need to put row as the first index. the help doc describes the(xi, yi) pair as "The VI looks up each value of xi, yi in X, Y...". nowhere in the help doc indicates whether "first independent variable" means row index or column index.
up to this point, i have no idea why labview treats interp2D so differently from ordinary array vis. IMO, the fact that one has to either transpose 2D array or to swap xi/yi index is extremely confusing and inconvenient.
-E