LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

writing array of x coordinates from image pixels

I need to do distance calculations between different pixels in an image. I'm trying to write a vi the same size as the 2d array of image values to store the x coordinates of every pixel. When I try to run my vi, it gives me an error saying it ran out of virtual memory. Is there something i did wrong in writing the array? I would appreciate any suggestions on ways I could write it more efficiently to not jam the memory. I'm using an image with 48000 pixels, so it is a relatively large array to generate. Can labview just not write an array this big?

I was also curious if anyone knows a standard measurement for the distance between two images as fractions of a milimeter or centimeter

-Daniel
0 Kudos
Message 1 of 3
(3,079 Views)
I don't understand what you are trying to do with this vi.
Anyway there were a number of things that I didn't like. I suspect that some errors were hidden so I cleaned it a bit. Changed the buildind of the ultimate array from 3D to 2D.
May be that fixed your problem ?
Chilly Charly    (aka CC)
Message 2 of 3
(3,073 Views)
I agree with CC that your VI does not make sense at all. Why would you even need an extra array containing all x-values?

Anyway, if I understand you right, you want a new 2D array that has the same size as the picture but each element should contain the column index (x).

You really should maybe do a few tutorials and study some of the example that ship with LabVIEW.

Here are a few pointers to get you started:
  • To get the number of rows and columns, simply index the output array from "array size".
    (It is extremely inefficient and convoluted to take the array and a transposed copy (!), autoindex them into a while loop that is guaranteed to stop after one iteration, then take the 1D array size of each.
    (This is something that Rube Goldberg would probably do :D)

    For example if you want a new 2D array with each element containing the x index (and I really don't see way you would need that), initialize the full size array, the e.g. replace each row with a slice of all x.

    The attached VI (LabVIEW 7.1) shows some of these ideas.

    You cannot measure the distance between two images without much extra information (where are the pictures located? what is their relative angle and distance? etc). Do you possibly want to meaure the distance between two points on an image? You would typically calculate that from the differences in the x and y indices using the Pythagorean theorem. IF you know the calibration (e.g. mm/pixel) you can then express it in millimeters.

    Could you explain in a few more sentences exactly what you are trying to do? Thanks!
  • 0 Kudos
    Message 3 of 3
    (3,066 Views)