Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to accelerate a Image Processing using MultiThreading?

Hello,
 
I have a AMD 4600+ Dual Core, (The final PC will use 2 Xeon CPU 3.6GHZ with Hyperthreading each, the question is same for my PC and for final PC).
Labview 8.0.1 IMAQ 3.7, Vision 8.2
 
 I have an image processing VI that: Accept RAW image (1000x200),==>Bayer Decoding==> Extract HSL Planes==> some Morphology and Particle on H Plane to differentiate the object ==>Masking with all HSL planes.
All this sequence is done in serial (There is no way to parallel this) and it take 40ms.
 
In addition I have other VIs that works on the result images (they do simple analysis) from the above process, they take advantage of dual processor (they can run in parallel) with total time of 10ms.
 
From all material that i read on the subject I understand that Multithreading is built-in in Labview.
But in noticed that my Labview consume only 62% CPU resource, and thats because that the main VI Consume 40ms and is only able to run in serial steps.
I also noticed that the main consuming function is the Extract HSL planes. and its maube because it need to convert the RGB to HSL..
 
My question is:
Is there anyway to use my DualCore capabilites to short the main VI running duration from 40ms to 20ms or so..? (For example by auto spliting the image to 2, and to do a parallel proecssing on each half).
 
 
Tnx,
Mendi
0 Kudos
Message 1 of 3
(3,584 Views)


HaD a écrit:
 
My question is:
Is there anyway to use my DualCore capabilites to short the main VI running duration from 40ms to 20ms or so..? (For example by auto spliting the image to 2, and to do a parallel proecssing on each half).
 

Hi,

It's worth a try, but I think you would loose time more than anything by spliting your images in 2 (or more parts) ; I might be wrong on that point, this is just a feeling based on my short experience.

In my opinion there are other things you can do to shorten the processing time :
  1. set "high priority" for labview using kernel32.dll (vi attached and this link is interesting)
  2. set your processing VIs as "time critical" in "VI properties > execution"
  3. are you running an exe or VIs ? An exe usually runs about 10% faster (depending on what's in the code, of course)
Hope this helps 😉


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 3
(3,563 Views)

Hi Mendi

Well, I have to completely disagree with TiTou on this post. If you are running just one time-consuming process, the raising of the priorities does nothing. Also, the main time-consuming image processing parts, such as RGB to HSL conversion, will run exactly as fast from an exe as from LV. The only way how to achieve speedup on two cores is to parallelize something. Provided that you know that the most time is consumed by RGB to HSL conversion, I would split the input image in two before the conversion, than do the coversion in two parallel LV dataflow paths, and combine the two halves in the end. The intrinsic "multithreadness" of LV means that the parallel dataflow paths will really be executed in parallel threads. The individual image processing VIs are not internally parallelized, as far as I know.

Just one more idea. The best way how to speed up the slow RGB to HSL conversion is to avoid it Smiley Happy. Try to think if you can maybe find the particles directly in the RGB planes, or in some simple mathematical combination of them. It would probably be much faster than converting to HSL.

Vladimir


View my profile on LinkedIn
0 Kudos
Message 3 of 3
(3,526 Views)