LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace Array Subset in FGV slow

Solved!
Go to solution

I started storing images in an FGV.

Unfortunately the replace array subset takes me 9 seconds to replace 20 images in this scenario.

Debugging is already disabled in the FGV. Any recommendations?

 

FGV.png

Replace Array Subset.png

  

0 Kudos
Message 1 of 25
(670 Views)

You could replace the "Replace array subset" with an In Place Element Structure and see if that helps:

 

https://www.ni.com/docs/en-US/bundle/labview/page/in-place-element-structures-increasing-memory-effi...

 

Also, since an array of the size you're using is 864 million elements, I hope very much you're using 64-bit LabVIEW...

0 Kudos
Message 2 of 25
(628 Views)

Quiztus2_0-1711092656899.png

Is this how to do it? LabVIEW displays for me "diagonal" instead of "split lenght". This is a bug?

0 Kudos
Message 3 of 25
(564 Views)
Solution
Accepted by topic author Quiztus2

Hi Quiztus,

 

as your images seem to have all the same size you could handle them within a 1D array. (IMHO LabVIEW handles 1D arrays much better then multi-dimensional arrays.)

 

So reshape your input image arrays to a 1D array and init the shift register to a 1D array of 20×640×480 elements. The array index for ReplaceArraySubset would be "image_index"×640×480…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 25
(561 Views)

The 1D Array is definitely a nice approach using FGV's. In general VI's it would tend to polute the bd imho.

0 Kudos
Message 5 of 25
(551 Views)

In general as long as you working with native LabVIEW arrays, you will always get some penalties in different areas, some of them can be optimized, but you working with images and just as suggestion — why do not use any available image processing library, like NI Vision Development Toolkit, or if you need cost-free alternative — OpenCV. Intel IPP also not so bad and can be integrated with LabVIEW in relative simple way. Memory management will be much more efficient in this case.

0 Kudos
Message 6 of 25
(534 Views)

Hi,

 

another approach:

Place your images (aka 2D arrays) into DVRs. Your FGV could hold an array of DVRs in the sift register (basically just an array of 20 pointers) instead of 20×640×480×2 Bytes.

 

You just need to make sure to cleanup all DVRs to avoid memory leaks…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 25
(524 Views)

I experience a huge performance boost with this version of the fgv.
I am 90% sure this comes from switching from 3D to 1D. 

fgv fast.png

I don't know DVR, but sound interesting.

0 Kudos
Message 8 of 25
(518 Views)

I'd test with storing the Picture refs instead of the image data. That way it's a simple 1D array of 20 elements.

Yamaeda_0-1711118994890.png

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 25
(458 Views)

interesting suggestion, but I have U16 data and I display the data mostly using Intensity Graph because of the colorbar.

0 Kudos
Message 10 of 25
(442 Views)