Changing threshold in a loop
Hello! I've already added two trackbars responsible for changing the lowest and highest possible threshold level in Canny's detecting edges algorithm. What's more, I'd like it to be able to read another pictures in the loop and adjust threshold levels for them aswell.
Here is the code (w/o edgedetecting function, it's simply grayscale->blur->Canny->blur->draw edges->fit the smallest rectangle):
Unfortunately, I've come across two hindrances:
- (lines 57 - 72) Is the while-loop the only way to pass changing values of
data.minTbV/data.maxTbV
into the trackbar? - I do change pictures by pressing ESC (line 59), but it does not really work properly due to the time that is set inside of
waitKey()
. Is there any better way? Or how could I use right arrow for going forward and left for getting back?
Thanks in advance!