refactored webcam capture

- only init webcam if condition satisfied;
- changed the camera capture to allow window resizing