Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

pretty simple:

move the waitKey() call inside the loop. (if you do not want to "wait forever", you also want to add a timestep in milliseconds, like waitKey(500); // half a second

(imshow() just copies a pointer to the image, the actual drawing/blitting (whatever you might call it) is triggered from waitKey(). think of it like this: any gui prog needs a message loop, and waitKey() is implementing exactly tnhat,(

((it's doing far more than waiting for a keypress, which pretty regularily confuses noobs))

pretty simple:

move the waitKey() call inside the loop. (if you do not want to "wait forever", you also want to add a timestep in milliseconds, like waitKey(500); // half a second

(imshow() just copies a pointer to the image, the actual drawing/blitting (whatever you might call it) is triggered from waitKey(). think of it like this: any gui prog needs a message loop, and waitKey() is implementing exactly tnhat,(that)

((it's doing far more than waiting for a keypress, which pretty regularily confuses noobs))