1 | initial version |
OK, I zoomed in on your screen grab enough to read the actual error message...it is saying that when imshow ran, it had an input that was size 0x0.
My best guess is that the camera is slower than your code and sometimes the capture fails, producing an empty image. I would put in a test for empty, just like when you use imread on a file.