12-11-2013 12:16 AM
Hi everyone,
I faced a strange problem about performance timing between these two measurements.
Here is my test
-used inbuilt example provided by labview in vision assistant-Bracket example-Uses two pattern matches, one edge detection algorithm and two calipers(one for calculating midpoint and other for finding angle between three points.
-When i ran the script provided by NI for the same in vision assistnat it took average inspection time of 12.45ms(even this also varies from 12-13ms:my guess is this little variation might be due to my cpu/processing load).
-Then i converted the script to vi and i used profile performance in labview and surprisingly it is showing way more than expected like almost ~300ms(In the beginning thought it is beacuse of all rotated search etc..but none of them make sense to me here).
Now my questions are
-Are the algorithms used in both tools are same? (I thought they are same)
-IMAQ read image and vision info is taking more than 100ms in labview, which doesn't count for vision assistant. why?( thought the template image might be loaded to cache am i right?)
-What about IMAQ read file(doesn't count for vision assistant?? In labview it takes around 15ms)
-Same for pattern match in vision assitant it takes around 3ms(this is also not consistant) in labview it takes almost 3times (around 15ms)
-Is this bug or am i missing somethings or this is how it is expected?
Please find attachments below.
-Vision Assistant-v12-Build 20120605072143
-Labview-12.0f3
12-13-2013 10:18 AM
12-17-2013 10:18 PM
12-18-2013 04:01 PM
Several differences between LabVIEW and Vision Assistant:
LabVIEW has to load the images, which takes time. Vision Assistant already has the image loaded into memory.
Running different images will take different amounts of time. It depends on the size of the image as well as the complexity of the image. It depends on which analysis tools you are using as well.
The algorithms are the same. LabVIEW might have a few more options that are hidden in Vision Assistant.
Bruce
12-19-2013 12:49 AM
12-19-2013 11:53 AM
I wouldn't include image load time. In most cases, you are acquiring live images and processing them. You can usually run the acquisition process in parallel to the analysis, so that time doesn't usually count.
Similarly, loading your template and running Setup Match Pattern only gets run once, then you do the analysis on a large number of images. You shouldn't be loading your templates every time you analyze an image - that is bad programming.
I suppose you could be loading images for processing and loading a different template for each image. This would be an unusual application that does not fit the usual assumptions, and the timing would be much longer for this sort of approach.
The time estimation in Vision Assistant is simply to give you an idea of how long the analysis part of your program will take. You will still have to fine tune everything in LabVIEW, but it will give you an idea if you are in the right order of magnitude of speed. For example, if Vision Assistant tells you one of the steps will take 100 msec, you will never get the entire process to run in 10 msec, no matter what you tweak.
There are many things you can do in LabVIEW that are not available in Vision Assistant. You can split the analysis into parallel tasks and increase your overall processing speed, for one. You can't directly compare the speeds of the two methods.
Bruce
12-19-2013 11:21 PM
Hmm Bruce, Thanks again for reply.
-When i first read your reply, i was ok. But after reading it multiple times, i came to know that you didn't check my code and explanation first.
-I have added code and screenshot of Profile in both VA and LabVIEW.
In both Vision Assistant and Labview
-I am loading image only once.
Accounted in Labview but not in VA, because it is already in cache, But time to put the image into cache?
I do understand that, when we are capturing the image live from camera things are completely different.
-Loading template image multiple times??
This is where i was very much confused. Beacuase i didn't even think of it. I am well aware of that task.
-Run Setup Match Pattern once?
Sorry, so far i haven't seen any example which does pattern match for multiple images has Setup Match Pattern everytime. But it is negligible time i wouldn't mind.
-Loading images for processing and loading diffferent template for each image?
You are completely mistaken here and i don't see that how it is related to my specific question.
Briefly explaining you again
-I open an image both in LabVIEW and VA.
-Create two pattern match steps. and Calipers(Negligible)
-The pattern match step in VA shows me longest time of 4.65 ms where as IMAQ Match pattern showed me 15.6 ms.
-I am convinced about IMAQ Read and vision info timing, because it will account only in the initial phase when running for multiple image inspection.
But i am running for only once, then Vision assistant should show that time also isn't it?
-I do understand that, Labview has lot more features on paralell execution and many things than Vision Assistant.
-Yeah that time about 100ms to 10ms i completely agree. I take Vision Assistant profile timing as the ideal values( correct me if i am wrong).
-I like the last line especially, You cannot compare the speeds of the two methods.
Please let me know if i am thinking in complete stupid way or at least some thing in right path.
12-20-2013 10:25 AM
I looked at your screen shots. A couple of things:
IMAQ Read Image and Vision is loading your template, which will only be done once. That time is not included in Vision Assistant's report.
The smallest resolution in LabVIEW's profile is 15.6 msec. Running the test once or twice will not get you a high resolution measurement. If you use run continuously and run your test 1000 times, you will get a better average time. Another option is to read the msec timer before and after the part of your code you are trying to time.
Bruce
01-27-2015 02:38 AM
hi uday,,
have found solution for you quesstion ...
i am also facing same problem ...
please help me if you answer