2017-01-26 13:43:23 -0600 | commented answer | Why is the first openCV API call so slow? Thanks! I was actually thinking something along those lines, but I thought I had disabled opencl - apparently not. However, a small follow up question.I do not need speed for the first call, but I need the code to be fast in general. With a single image opencl makes it slower, with a lot if probably makes it faster. However, my code lives in a dll - will multiple calls to the dll recompile it multiple times, or can it handle that? |
2017-01-26 13:41:23 -0600 | received badge | ● Scholar (source) |
2017-01-26 13:25:54 -0600 | asked a question | Why is the first openCV API call so slow? I am creating a mask from an image with the size: 2000x640, and I'm running this code on a modern powerfull laptop. I have made a function which is suppose to create binary mask from my input image, the code is quite simple and shown below: However, when running the code it seems like doing a simple threshold takes a very long time - almost half a second.
This looked very odd, so I implemented my own thresholding which ran in a few ms. However, not suddenly the I then completely removed the thresholding part of the code and got this performance result
Can someone help me understand what is going on here? Why is the first call to openCV so slow, and can I prevent it somehow? I would really prefer is this code could run in less than 0.1 s, which I think it totally reasonable. |
2017-01-21 10:08:25 -0600 | received badge | ● Enthusiast |