Skip to main content

Posts

Opencv Create a Box in Python

 Opencv Create a Rectangle import cv2 image = cv2.imread( "readimg.jpg" ) start = ( 10 , 10 ) end = ( 330 , 330 ) color = ( 179 , 255 , 15 ) thickness = 3 image = cv2.rectangle(image , start , end , color , thickness)
Recent posts

OpenCV Get Frame Width and Height in Python

 Opencv Get Frame Width and Height import cv2 capture = cv2.VideoCapture( 'readvideo.mp4' ) if capture.isOpened(): w = capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH) h = capture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT) w = capture.get( 3 ) h = capture.get( 4 ) f = capture.get(cv2.cv.CV_CAP_PROP_FPS)

OpenCV Read Video From Camera

 Opencv Python Read Video From Camera import cv2 captureImage = cv2.VideoCapture( 0 ) while ( True ): ret , frame = captureImage.read() gray = cv2.cvtColor(frame , cv2.COLOR_BGR2GRAY) cv2.imshow( 'image' , gray) if cv2.waitKey( 1 ) & 0xFF == ord ( 'q' ): break captureImage.release() cv2.destroyAllWindows()

OpenCV Python Webcam Control

 OpenCV Python Webcam Control import cv2 cap = cv2.VideoCapture( 0 ) if not cap.isOpened(): raise IOError ( "webcam not available" ) while True : ret , f = cap.read() f = cv2.resize(f , None, fx = 0.5 , fy = 0.5 , interpolation =cv2.INTER_AREA) cv2.imshow( 'I' , f) c = cv2.waitKey( 1 ) if c == 27 : break cap.release() cv2.destroyAllWindows()