Posts

how to Create a Black Image in OpenCV

Image
#hellow everyone today i am going to show you #how to create a black image in opencv #first import opencv and numpy import cv2 import numpy as np #creating black image #width of the image width = 700 #height of the image height = 600 Black_image = np.zeros( (width , height) , dtype =np.uint8) #displaying image untill press ESC button while True : cv2.imshow( 'window' , Black_image) if cv2.waitKey( 1 ) == 27 : break cv2.destroyAllWindows()

How to capture, write and display a video in opencv.

import cv2 import numpy as np capture = cv2.VideoCapture( 0 ) frame_width = int (capture.get( 3 )) frame_height = int (capture.get( 4 )) out = cv2.VideoWriter( 'output_1.avi' , cv2.VideoWriter_fourcc( 'M' , 'J' , 'P' , 'G' ) , 15 , (frame_width , frame_height)) while True : ret , frame = capture.read() out.write(frame) cv2.imshow( 'window' , frame) if cv2.waitKey( 1 ) == 27 : break capture.release() cv2.destroyAllWindows()

Capturing image and Viewing it using OpenCV

import cv2 capture = cv2.VideoCapture( 0 ) capture.set( 3 , 640 ) #width capture.set( 4 , 480 ) #height if capture.isOpened(): ret , frame = capture.read() cv2.imwrite( 'osman.jpg' , frame) load_image = cv2.imread( 'osman.jpg' ) while True : cv2.imshow( 'window' , load_image) if cv2.waitKey( 1 ) == 27 : break capture.release() cv2.destroyAllWindows()

Learn opencv in Bangla_1(What is opencv and how to install opencv)

Image

Capturing Video via webcam

import cv2 capture = cv2.VideoCapture('road_car_view.mp4') while True:     ret,frame = capture.read()         color_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)         cv2.imshow('window',color_frame)         if cv2.waitKey(1) & 0xFF == ord('q'):         break capture.release() cv2.destroyAllWindows()

Deutscher Artikel

Image

python in Bangla Function and Boolean

Image