LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

several pixel value in one iteration

Hi,

 

I am still very new to labview and I have a timing problem with a while loop.

 

I am attaching the VI so that it is easier to understand.

 

Basically, I read X and Y voltages (with a PCI card) that correspond to a position in an image (that I load). I then convert those positions into a pixel positions and extract the pixel values in the image .

I then use those pixel values to write on an analogue output.

 

My Problem is the following:

The "Get Pixel Value .vi"  only works Pixel by Pixel meaning that I can only write 1 value every while loop iteration. This is to slow considering that I need to write at least one sample every one/two microseconds and that the while loop is slower than that (at least I think?...)

 

How can I transform this vi so that the while loop converts at least 100 position into 100 pixel values so that I can write at least 100 values in one while loop iteration?

 

Thank you very much for your help,

Best ,

Renaud

0 Kudos
Message 1 of 6
(3,270 Views)

Can you use "IMAQ ImageToArray" to get the 2D array of data and then index the array in a for loop? You can put in the two arrays of row/column locations and index those on the terminal.

IndexImage.png

Message 2 of 6
(3,234 Views)

You will not be able to achieve microsecond loop times on a standard PC.  If you converted the image to an array (as suggested above) you could perform your calculations and lookups on an FPGA system.

Message 3 of 6
(3,228 Views)

Thanks a lot for those quick replies !

 

Image to array is a good solution but I found a work around with a while loop.

 

I understand that I won't have microsecond loops without a FPGA but I should be able to read/write around 1000 samples every loop iteration, correct? Otherwise what is the purpose of a DAQ bord type PXI or PCI to have a sampling frequency of 1 to 2 or even 5 MHz??

 

In the attached code however I can't seem to read more then 10 sample every 1 milisecond meaning a sampling rate of 1 sample every 100 microsecond... How can I improve the code? 

 

Many thanks,

Best,

Renaud

 

0 Kudos
Message 4 of 6
(3,191 Views)

You probably don't want to have the "wait until next millisecond multiple" function inside your while loop.  You should allow the data acquisition vi's to dictate the loop timing.  You can set the buffer size with the DAQMX timing vi, then read a fixed number of samples during each itteration of the loop.

 

There will be some delay between when your samples are acquired, and when your outputs are generated.  Is this acceptable?

 

.  The "Build XY Graph" express vi might also slow down your loop.  You could remove that and see whether your speed improves.

Message 5 of 6
(3,145 Views)

Thanks for this reply,

 

Delay between acquired samples and generated output are unacceptables in this case...

 

I do possess and FPGA "NI PXIe-7962R" with the adapter module "NI5751".  This adapter module has only analogue inputs and no analogue outputs...

 

However, can I combine an analogue input with an FPGA and an analogue output from a PXI card? Would this solution be faster?

 

Thanks,

Best,

Renaud 

0 Kudos
Message 6 of 6
(3,116 Views)