@@ -58,8 +58,8 @@ def _process_frame(self, frame):
5858
5959 # draw some helpers for correctly placing hand
6060 height , width = frame .shape [:2 ]
61- cv2 .circle (img_draw , (width / 2 , height / 2 ), 3 , [255 , 102 , 0 ], 2 )
62- cv2 .rectangle (img_draw , (width / 3 , height / 3 ), (width * 2 / 3 , height * 2 / 3 ),
61+ cv2 .circle (img_draw , (width / 2 , height / 2 ), 3 , [255 , 102 , 0 ], 2 )
62+ cv2 .rectangle (img_draw , (width / 3 , height / 3 ), (width * 2 / 3 , height * 2 / 3 ),
6363 [255 , 102 , 0 ], 2 )
6464
6565 # print number of fingers on image
@@ -75,8 +75,12 @@ def main():
7575 if not (capture .isOpened ()):
7676 capture .open (device )
7777
78- capture .set (cv2 .cv .CV_CAP_PROP_FRAME_WIDTH , 640 )
79- capture .set (cv2 .cv .CV_CAP_PROP_FRAME_HEIGHT , 480 )
78+ if hasattr (cv2 , 'cv' ):
79+ capture .set (cv2 .cv .CV_CAP_PROP_FRAME_WIDTH , 640 )
80+ capture .set (cv2 .cv .CV_CAP_PROP_FRAME_HEIGHT , 480 )
81+ else :
82+ capture .set (cv2 .CAP_PROP_FRAME_WIDTH , 640 )
83+ capture .set (cv2 .CV_CAP_PROP_FRAME_HEIGHT , 480 )
8084
8185 # start graphical user interface
8286 app = wx .App ()
0 commit comments