Skip to main content

How to make calculator in python kivy

  How make calculator in python We make a calculator in python using kivy module . Kivy module helps us to make android apps . First wait , If you run a kivy program in your terminal then you see a error like this To solve this problem you have to go kivy docs and follow the instruction of kivy docs.  First we have to make a virtual environment and then in the virtual environment you have to install kivy . After that you have to write  kivy_venv\Scripts\activate in your terminal and then run the file . If this method not work then write the comment below. LETS START CODING First we import kivy .For this we hve to write  from  kivy.app  import  App from  kivy.uix.label  import  Label from  kivy.uix.button  import  Button from  kivy.core.window  import  Window from  kivy.uix.gridlayout  import  GridLayout from  kivy.uix.widget  import  Widget from  kivy.lang  import ...

How to make face recognizer in python

Face Recognizer in python
We make a face recognition program in python with the help of opencv . 
Opencv module is used in face detection and face recognition . 


Lets Strat Coding

First , we have to import opencv . For this we have to write import cv2

After this we have to write cap = cv2.VideoCapture(0)

Now, we have to go the folder where the opencv is installed and open the folder data . After this copy the all xml haarcascade file and paste it in our working folder where we making face detection program
 .

After this we have to load facedectector and eyedetector . For this we have to write facedetector=cv2.CascadeClassifier('Cascades/haarcascade_frontalface_default.xml')
eyedetector=cv2.CascadeClassifier('Cascades/haarcascade_eye.xml')

After this we make while loop . In this while loop we draw a rectangle around the face and eye in each frame and the show the frame . For this we have to write 

while (True):
    ret,frame=cap.read()
    frame = cv2.cvtColor(frame,0)
    gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
    detections = facedetector.detectMultiScale(gray , 1.3 , 5)
    if(len(detections)>0):
        (x,y,w,h) = detections[0]
        frame=cv2.rectangle(frame,(x,y),(x+w,y+h),(0,255,0),2)
        roi_gray=gray[y:y+h,x:x+w]
        roi_color=frame[y:y+h,x:x+w]
        eyes=eyedetector.detectMultiScale(roi_gray)
        for (ex,ey,ew,eh) in eyes:
            cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)
        


    cv2.imshow('frame' , frame)
    if cv2.waitKey(1) & 0xff == ord('q'):
        break



HERE ARE THE CODE