1 | initial version |
When you post code, try to cut the irrelevant parts for the problem, no one is gonna go through this code..
That said, the problem is what OpenCV is trying to tell you. Img comes has size = (0,0) when you try to display it. Why is this? I will not go through your code to figure it out, but I will tell you the debugging techniques necessary to figure it out yourself.
Eliminate all code related with your algorithm, and leave just the VideoCapture and display of image directly from webcam. Does this problem occurs again? Then there is a problem either with your webcam or with the way it is connected (For some reason I think this will be the case).
Is the image displaying correctly? Then the problem lies somewhere ahead. Add the next step of your algorithm and verify if it is causing it to break Img. Repeat this until you find the source of the problem. Most of the times this will be enough for you to understand where you made a mistake. If you find what is causing the problem but can't understand why, we are here to help.
Good luck!
2 | No.2 Revision |
When you post code, try to cut the irrelevant parts for the problem, no one is gonna go through this code..
That said, the problem is what OpenCV is trying to tell you. Img comes has with size = (0,0) when you try to display it. it, and obviously OpenCV can't display an image with 0 pixels. Why is this? I will not go through your code to figure it out, but I will tell you the debugging techniques necessary to figure it out yourself.
Eliminate all code related with your algorithm, and leave just the VideoCapture and display of image directly from webcam. Does this problem occurs again? Then there is a problem either with your webcam or with the way it is connected (For some reason I think this will be the case).
Is the image displaying correctly? Then the problem lies somewhere ahead. Add the next step of your algorithm and verify if it is causing it to break Img. Repeat this until you find the source of the problem. Most of the times this will be enough for you to understand where you made a mistake. If you find what is causing the problem but can't understand why, we are here to help.
Good luck!
3 | No.3 Revision |
When you post code, try to cut the irrelevant parts for the problem, no one is gonna go through this code..
That said, the problem is what OpenCV is trying to tell you. Img comes with size = (0,0) when you try to display it, and obviously OpenCV can't display an image with 0 pixels. Why is this? I will not go through your code to figure it out, but I will tell you the debugging techniques necessary for you to figure it out yourself.
Eliminate all code related with your algorithm, and leave just the VideoCapture and display of image directly from webcam. Does this problem occurs again? Then there is a problem either with your webcam or with the way it is connected (For some reason I think this will be the case).
Is the image displaying correctly? Then the problem lies somewhere ahead. Add the next step of your algorithm and verify if it is causing it to break Img. Repeat this until you find the source of the problem. Most of the times this will be enough for you to understand where you made a mistake. If you find what is causing the problem but can't understand why, we are here to help.
Good luck!
4 | No.4 Revision |
When you post code, try to cut the irrelevant parts for the problem, no one is gonna go through this code..
That said, the problem is what OpenCV is trying to tell you. Img comes with size = (0,0) when you try to display it, and obviously OpenCV can't display an image with 0 pixels. Why is this? I will not go through your code to figure it out, but I will tell you the debugging techniques necessary for you to figure it out yourself.
Eliminate all code related with your algorithm, and leave just the VideoCapture and display of image directly from webcam. Does this problem occurs occur again? Then there is a problem either with your webcam or with the way it is connected to you computer (For some reason I think this will be the case).
Is the image displaying correctly? Then the problem lies somewhere ahead. Add the next step of your algorithm and verify if it is causing it to break Img. Repeat this until you find the source of the problem. Most of the times this will be enough for you to understand where you made a mistake. If you find what is causing the problem but can't understand why, we are here to help.
Good luck!