LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Multithreading of data processing bases on imaqdx in labwindows cvi

Hi,

 

Currently, I am using imadxGetImageData to get 4 frame(2048*512) data at one time, then do the FFT and other transformations for the each 2048 pixels. It is very slow in one thread and the frame rate is only like 0.5 fps or so. 

 

I am considering using multithreading to accelerate it by building 5 threads. One thread is for get image data of 4 frame at one time(only take about 20ms). After receiving the 4 frame data, I want to use 4 threads to process each frame.  After the processing and displaying, then again to get the 4 frame raw data, so does with this loop.

 

I read the some post and official documentations, trying to understand the official examples of multithreading, but it is kind of complicated and difficult.  I kind of know maybe I need to use thread safe queue and thread lock to do it, but the whole documentation is a little long.

 

So I am wondering if anyone can help to understand it? Thank you for your help.

 

 

 

 

 

 

 

 

0 Kudos
Message 1 of 4
(1,674 Views)

You will get better reach by posting under LabWindows group instead of LabVIEW

 

https://forums.ni.com/t5/LabWindows-CVI/bd-p/180

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 4
(1,665 Views)

Hello, unfortunately multithreading is not an easy-as-pie paradigm: we can give you some basic hint, but a good amount of study and some trial and error will be needed before you can consider yourself familiar with it.

 

The situation you are describing seems to be well serviced by a producer-consumer architecture, with the image acquisition being the producer part and image processing the consumer one. You can read some fundamentals on this paradigm here and here. None of these links are directly aimed to CVI, but you can take the concepts exposed in each of them getting rid of the details specific to LabVIEW and other stuff. Specific information on multithreading in CVI can be found in Creating Applications >> Creating Multithreaded Applications chapter in the help

 

So you''ll have:

  • A producer process that handles image acquisition
  • A number of consumer processes that handle data
  • Communication between the two layers by means of queues (Thread Safe Queues)
  • Interprocess sincronization realized with locks or tread safe variables (CVI does not have native semaphores)


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 4
(1,598 Views)

Hi Roberto,

 

Thank you for taking time to reply. Your information is very useful and I will go through the posts you shared. Thank you again for your help.

0 Kudos
Message 4 of 4
(1,581 Views)