LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ImagetoEDVR slower than Imagetoarray? (Labview vision)

Hi Labview users, 

 

Currently, I am looking for some high speed image processing. I watched that ImagetoEDVR is more suitable than Imagetoarray, especially for memory management and CPU ressource. (i.e. https://zone.ni.com/reference/en-XX/help/370281AG-01/imaqvision/edvr_with_vision/)

Before starting to write a program, I just compare the processing speed to get data using either ImagetoEDVR or Imagetorray.

 

Surprinsingly, for a same image the while loop with ImagetoEDVR took 4ms to display a table and Imagetoarray 0.04ms.

ImagetoEDVR seems to be very slow (about 100 times) by comparison with Imagetoarray. Firstly, I thought that displaying data at every while loop run was time consuming. However, even without displaying any data ImagetoEDVR is slower than imagetoarray.

 

So the question: Did I make a mistake somewhere to explain the low processing speed?   

Thank you in advances for your help

Best regards

 

0 Kudos
Message 1 of 11
(1,721 Views)

Disclaimer: I've no idea if this is what is happening, and no prove of it. It would be a plausible explanation.

 

ImageToArray might not do anything, except returning a pointer. Unless you use the data, it remains a pointer, and it will be fast. No copying of data.

 

The ImageToDVR probably has to copy the data, to get it into the DVR container.

 

The real test will be how it performs when you actually start using it. The ImageToArray pointer will be copied when you use it (although a lot of operations will not, but in stead create sub arrays around the pointer).

 

I'd be biased against DVRs anyway, as they're terrible to debug.

Message 2 of 11
(1,697 Views)

 

 

 

0 Kudos
Message 3 of 11
(1,683 Views)

Here is a simple labview program to illustrate the difference of speed to get the pixel values of an image. 

0 Kudos
Message 4 of 11
(1,680 Views)

I'm curious about your problem. Could you save the file as an older version-- 2017 or older?

0 Kudos
Message 5 of 11
(1,641 Views)

Well, the DVR solution is doing exactly the same as the Image2array solution (show data in an indicator) but has to do more (wrapping the data in a DVR).

 

So as the DVR solution has to do more, why do you expect the DVR solution to be faster?

 

I'd never use a DVR unless I have to. And that's almost never.

 

I'd for sure not use a DRV because they ' should be faster' (because they are more complex?).

 

DVRs only help to be faster if they are used to prevent copies. But if you can prevent copies in another way, that will be (marginally) faster, as it won't have the overhead of the DVR. The code usually is easier to read, maintain and debug without DVRs.

 

As mentioned, initializing the DVR probably forces a copy, that is not needed without the DVR. Without the DVR, the compiler can use dataflow to see there's no need for a copy. Array data is not copied until needed. And even if it's needed, it's data pointer is often wrapped in a subarray structure.

Message 6 of 11
(1,634 Views)

Hi, 

 

Here is the file in the LV version 2013.

 

0 Kudos
Message 7 of 11
(1,627 Views)

Disclaimer (same as 😞 I've no idea if this is what is happening, and no prove of it. It would be a plausible explanation.

 

The speed difference between the VIs itself is not much.

 

The difference comes from an additional copy of the data in the EDVR case. In addition there is the Delete Value Reference, the error case structure, Merge Errors and you do not write the data back to the image.

 

The optimizer might switch to the user interface thread because you display the data inside the case structure.

 

The might be situations where ImageToArray is faster (you created an example for this).

 

I tried to create an example with simple image processing (increment each pixel) which shows similar execution times.

 

 

Message 8 of 11
(1,615 Views)

Hi  

 

 

 

0 Kudos
Message 9 of 11
(1,606 Views)

Hi  Martin_Henz

 

Sorry for my late reply and thank you for your comment. 

I tested your vi and I am aggree that the processing speed of imagetoarray is the same as imagetoEDVR in your vi.

However, I still have a trouble with the in place element structure which looks like to work as a while loop. 

Did you have any idea to stop the 'in place element structures' in order to process only once at each while loop run?

Thank again for your kind help

  

0 Kudos
Message 10 of 11
(1,602 Views)