Skip to main content

Posts

Showing posts with the label github

Python | Background Subtraction using OpenCV

 Background subtraction is any technique that allows an image's foreground to be extracted for further processing Many applications do not need to know everything about the evolution of movement in a video sequence, but only require the information of changes in the scene, because an image's regions of interest are objects(humans, cars, text, etc) in its foreground. After the stage of image processing(which may include image  denoising , post-processing like morphology, etc.) object localization is required which may make use of this technique So let's create this most valuable project with python so easily. Modules: OpenCV Numpy Code: import numpy as np import cv2 cap = cv2 . VideoCapture ( 'walking.avi' ) # Initlaize background subtractor foreground_background = cv2 . createBackgroundSubtractorMOG2 () while True :         ret , frame = cap .read()     # Apply background subtractor to get our foreground mask     foreground_mask = foreground_background .app

How To Draw BMW Logo - In Python

 I know I don't need to introduce BMW as it is a very popular luxury car. Today we gonna draw the BMW logo in python. I know that you can draw it using a pencil and other tools like AutoCAD etc. But we are programmers we talk with computers so let's tell our computer to draw this logo for use with the help of python. Module The only module we will use is that turtle Code: import turtle as t t.begin_fill() t.fillcolor( '#008ac9' ) for i in range ( 50 ):     t.forward( 4 )     t.left( 2 ) t.right(- 80 ) t.forward( 116 ) t.right(- 90 ) t.forward( 132 ) t.end_fill() t.penup() t.pendown() t.right( 90 ) for i in range ( 50 ):     t.forward( 4 )     t.left(- 2 ) t.right( 80 ) t.forward( 116 ) t.forward(- 116 ) t.right( 90 ) t.begin_fill() t.fillcolor( '#008ac9' ) for j in range ( 45 ):     t.forward(- 4 )     t.left(- 2 ) t.right(- 90 ) t.forward( 116 ) t.end_fill() t.right( 180 ) t.forward( 116 ) t.right( 90 ) for i in range ( 47 ):     t.forward( 4 )     t.

How to draw github logo using python | draw github logo in python

  Module: In this post, we keep it very simple and easy so we will use only one module that is the turtle Code: from turtle import * speed ( 0 ) fillcolor ( '#211F1F' ) begin_fill () circle ( 100 ) end_fill () penup () goto ( 25 , 150 ) left ( 170 ) pendown () pencolor ( 'white' ) fillcolor ( 'white' ) begin_fill () # head upper part for i in range ( 95 ):     forward ( 0.5 )     left ( 0.2 ) # head left part for i in range ( 30 ):     forward ( 1 )     left ( 1 ) for i in range ( 24 ):     forward ( 0.5 )     left ( 1 ) for i in range ( 17 ):     forward ( 1 )     left ( 1 ) for i in range ( 17 ):     forward ( 1.7 )     left ( 0.6 ) for i in range ( 25 ):     left ( 1 )     forward ( 0.5 ) for i in range ( 24 ):     left ( 1 )     forward ( 0.5 ) for i in range ( 30 ):     left ( 1 )     forward ( 1 ) # left side of the body right ( 125 ) for i in range ( 70 ):     forward ( 0.2 )     left ( 0.55 ) for i in range ( 58 ):     fo