LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Flatten image to string execution time

Solved!
Go to solution

I am doing some benchmarking trying to find a more efficient way to convert a IMAQ reference to JPEG in memory and have noticed that how I wire the IMAQ reference makes a significant difference in the execution time.

 

With it connected as shown below it takes about 35ms to execute the flatten image to string function.

 

If I connect it via the annotated route (Through the first frame of the case structure) it takes about 5ms to run 

 

Worle_0-1735816656619.png

There is an underlying question of is there a more efficient way of flattening an image to a JPEG binary in memory? I also need to do the reverse (Convert a JPEG to an IMAQ reference without writing it to disk), at the moment I am using something I found on the forums (I can't find the post now) which implements some Win32 API calls to do the decoding.

 

In summary:

  • Why does that the minor wiring change shown above make a 7x difference in execution speed
  • Are there any more CPU efficient method of performing this encoding
0 Kudos
Message 1 of 3
(174 Views)
Solution
Accepted by topic author Worle

Hi Worle,

 


@Worle wrote:
Why does that the minor wiring change shown above make a 7x difference in execution speed

Because you change the measured code sequence NOTICEABLE!

 

  1. When you wire the IMAQ reference to the first frame then you measure only the time needed for the FlattenToString function.
  2. When you wire the IMAQ reference to the 2nd frame then the first frame is already executed in parallel to the IMAQRead function! So you measure the time needed for the IMAQRead and the FlattenToString function…

All this is clearly defined by THINK DATAFLOW!

 

Conclusion: the FlattenToString will need about 5ms, the IMAQRead will need about 30ms (~60 30Hz frame rate)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(165 Views)

Of course....

 

I am going to blame that on a slow ramp up after christmas...

0 Kudos
Message 3 of 3
(161 Views)