Longest Consecutive Subsequence.pdf
547.3 KB
DSA Interview Question π
Longest Consecutive Subsequence question π§ π
Don't forget to React β€οΈ to this msg if you want more content Like this π
Longest Consecutive Subsequence question π§ π
Don't forget to React β€οΈ to this msg if you want more content Like this π
β€12π7
Java Program for Bubble Sort.pdf
395.8 KB
Bubble sort π§ π§
Don't forget to React β€οΈ to this msg if you want more content Like this π
Don't forget to React β€οΈ to this msg if you want more content Like this π
β€15π4
Radix Sort β Data Structures and Algorithms Tutorials.pdf
243.6 KB
Radix sort Data structure π€―π§ π
Don't forget to React β€οΈ to this msg if you want more content Like this π
Don't forget to React β€οΈ to this msg if you want more content Like this π
π11β€6
OTP verification using Python
Introduction:
In this project, we have made an OTP verification System with Help of various libraries. First of all, we made use of Tkinter for creating the GUI for our project. Next to that, to generate the random Numbers as OTP we used a random module. At last, forgetting and checking the OTP we used an API Twilio.
A random number will be sent to the stated mobile number with the help of the API and then our project will check whether the OTP is valid or not, and thus this will build an OTP Verification Project using Python.
Explanation:
The main objectives that need to be fulfilled while making this projects are:
Creating a GUI for this project
Generating a random number as OTP
Sending the OTP to the stated Mobile number
Checking whether the OTP is valid or not
Resending the OTP
We will work on these objectives step by step to complete this project.
First of all, creating a GUI for our project will make use of the βtkinterβ module, from βfuture. movesβ we will import the module. The most major step is to create the instance of the tkinter frame i.e. tk(). This will help to display the window and manage all the components of the tkinter application. In addition to this, with the help of β.title()β & β.geometry()β we will set the title and dimensions for the window. With this, we will also draw the Canvas for OTP Verification with the help of β.canvas()β and by using β.place()β we will provide the dimensions as parameters for placing our canvas.
Source code ππ # Importing the libraries
import twilio.rest
import random
from future.moves import tkinter
from tkinter import messagebox
# Creating Window
root = tkinter.Tk()
root.title("OTP Verification")
root.geometry("600x550")
# Twilio account details
account_sid = ""
auth_token = ""
# resend the OTP
def resendOTP():
n = random.randint(1000, 9999)
client = twilio.rest.Client(account_sid, auth_token)
client.messages.create(to=[""], from_=" ", body=n)
# Checking the OTP
def checkOTP():
global n
try:
user_input = int(user.get(1.0, "end01c"))
if user_input == n:
messagebox.showinfo("showinfo", "Login Success")
n = "done"
elif n == "done":
messagebox.showinfo("showinfo", "Already entered")
else:
messagebox.showinfo("showinfo", "wrong OTP")
except:
messagebox.showinfo("showinfo", "Invalid OTP")
# Drawing the canvas
c = tkinter.Canvas(root, bg="white", width=400, height=300)
c.place(x=100, y=60)
# Label widget
login = tkinter.Label(root, text="OTP Verification", font="bold,20", bg="white")
login.place(x=210, y=90)
# Entry widget
user = tkinter.Text(root, borderwidth=2, wrap="word", width=29, height=2)
user.place(x=190, y=160)
# Sending the otp
n = random.randint(1000, 9999)
client = twilio.rest.Client(account_sid, auth_token)
client.messages.create(to=[""], from_="", body=n)
# Submit button
submit_button = tkinter.Button(root, text="Submit", command=checkOTP(), font=('bold', 15))
submit_button.place(x=258, y=250)
# Resend Button
resend_button = tkinter.Button(root, text="Resend OTP", command=resendOTP(), font=("bold", 15))
resend_button.place(x=240, y=400)
# Event Loop
root.mainloop()
Introduction:
In this project, we have made an OTP verification System with Help of various libraries. First of all, we made use of Tkinter for creating the GUI for our project. Next to that, to generate the random Numbers as OTP we used a random module. At last, forgetting and checking the OTP we used an API Twilio.
A random number will be sent to the stated mobile number with the help of the API and then our project will check whether the OTP is valid or not, and thus this will build an OTP Verification Project using Python.
Explanation:
The main objectives that need to be fulfilled while making this projects are:
Creating a GUI for this project
Generating a random number as OTP
Sending the OTP to the stated Mobile number
Checking whether the OTP is valid or not
Resending the OTP
We will work on these objectives step by step to complete this project.
First of all, creating a GUI for our project will make use of the βtkinterβ module, from βfuture. movesβ we will import the module. The most major step is to create the instance of the tkinter frame i.e. tk(). This will help to display the window and manage all the components of the tkinter application. In addition to this, with the help of β.title()β & β.geometry()β we will set the title and dimensions for the window. With this, we will also draw the Canvas for OTP Verification with the help of β.canvas()β and by using β.place()β we will provide the dimensions as parameters for placing our canvas.
Source code ππ # Importing the libraries
import twilio.rest
import random
from future.moves import tkinter
from tkinter import messagebox
# Creating Window
root = tkinter.Tk()
root.title("OTP Verification")
root.geometry("600x550")
# Twilio account details
account_sid = ""
auth_token = ""
# resend the OTP
def resendOTP():
n = random.randint(1000, 9999)
client = twilio.rest.Client(account_sid, auth_token)
client.messages.create(to=[""], from_=" ", body=n)
# Checking the OTP
def checkOTP():
global n
try:
user_input = int(user.get(1.0, "end01c"))
if user_input == n:
messagebox.showinfo("showinfo", "Login Success")
n = "done"
elif n == "done":
messagebox.showinfo("showinfo", "Already entered")
else:
messagebox.showinfo("showinfo", "wrong OTP")
except:
messagebox.showinfo("showinfo", "Invalid OTP")
# Drawing the canvas
c = tkinter.Canvas(root, bg="white", width=400, height=300)
c.place(x=100, y=60)
# Label widget
login = tkinter.Label(root, text="OTP Verification", font="bold,20", bg="white")
login.place(x=210, y=90)
# Entry widget
user = tkinter.Text(root, borderwidth=2, wrap="word", width=29, height=2)
user.place(x=190, y=160)
# Sending the otp
n = random.randint(1000, 9999)
client = twilio.rest.Client(account_sid, auth_token)
client.messages.create(to=[""], from_="", body=n)
# Submit button
submit_button = tkinter.Button(root, text="Submit", command=checkOTP(), font=('bold', 15))
submit_button.place(x=258, y=250)
# Resend Button
resend_button = tkinter.Button(root, text="Resend OTP", command=resendOTP(), font=("bold", 15))
resend_button.place(x=240, y=400)
# Event Loop
root.mainloop()
π26β€6π1
Java Program for Merge Sort.pdf
157.7 KB
Java program for merge Sort π€―π§ π
Don't forget to React β€οΈ to this msg if you want more content Like this π
Don't forget to React β€οΈ to this msg if you want more content Like this π
β€11π3
π Step-by-Step Guide to Become a Full Stack Web Developer π
1. Learn Front-End Technologies:
- π HTML: Dive into the structure of web pages, creating the foundation of your applications.
- π¨ CSS: Explore styling and layout techniques to make your websites visually appealing.
- π JavaScript: Add interactivity and dynamic content, making your websites come alive.
2. Master Front-End Frameworks:
- π °οΈ Angular, βοΈ React, or πΌ Vue.js: Choose your weapon! Build responsive, user-friendly interfaces using your preferred framework.
3. Get Backend Proficiency:
- π» Choose a server-side language: Embrace Python, Java, Ruby, or others to power the backend magic.
- βοΈ Learn a backend framework: Express, Django, Ruby on Rails - tools to create robust server-side applications.
4. Database Fundamentals:
- π SQL: Master the art of manipulating databases, ensuring seamless data operations.
- π Database design and management: Architect and manage databases for efficient data storage.
5. Dive into Back-End Development:
- π Set up servers and APIs: Construct server architectures and APIs to connect the front-end and back-end.
- π‘ Handle data storage and retrieval: Fetch and store data like a pro!
6. Version Control & Collaboration:
- π Git: Time to track changes like a wizard! Collaborate with others using the magical GitHub.
7. DevOps and Deployment:
- π Deploy applications on servers (Heroku, AWS): Launch your creations into the digital cosmos.
- π Continuous Integration/Deployment (CI/CD): Automate the deployment process like a tech guru.
8. Security Basics:
- π Implement authentication and authorization: Guard your realm with strong authentication and permission systems.
- π‘ Protect against common web vulnerabilities: Shield your applications from the forces of cyber darkness.
9. Learn About Testing:
- π§ͺ Unit, integration, and end-to-end testing: Test your creations with the rigor of a mad scientist.
- π¦ Ensure code quality and functionality: Deliver robust, bug-free experiences.
10. Explore Full Stack Concepts:
- π Understand the flow of data between front-end and back-end: Master the dance of data between realms.
- βοΈ Balance performance and user experience: Weave the threads of speed and delight into your creations.
11. Keep Learning and Building:
- π Stay updated with industry trends: Keep your knowledge sharp with the ever-evolving web landscape.
- π·ββοΈ Work on personal projects to showcase skills: Craft your digital masterpieces and show them to the world.
12. Networking and Soft Skills:
- π€ Connect with other developers: Forge alliances with fellow wizards of the web.
- π£ Effective communication and teamwork: Speak the language of collaboration and understanding.
Remember, the path to becoming a Full Stack Web Developer is an exciting journey filled with challenges and discoveries. Embrace the magic of coding and keep reaching for the stars! ππ
Engage with a reaction for more guides like this!β€οΈπ€©
β The coding_knowledge
1. Learn Front-End Technologies:
- π HTML: Dive into the structure of web pages, creating the foundation of your applications.
- π¨ CSS: Explore styling and layout techniques to make your websites visually appealing.
- π JavaScript: Add interactivity and dynamic content, making your websites come alive.
2. Master Front-End Frameworks:
- π °οΈ Angular, βοΈ React, or πΌ Vue.js: Choose your weapon! Build responsive, user-friendly interfaces using your preferred framework.
3. Get Backend Proficiency:
- π» Choose a server-side language: Embrace Python, Java, Ruby, or others to power the backend magic.
- βοΈ Learn a backend framework: Express, Django, Ruby on Rails - tools to create robust server-side applications.
4. Database Fundamentals:
- π SQL: Master the art of manipulating databases, ensuring seamless data operations.
- π Database design and management: Architect and manage databases for efficient data storage.
5. Dive into Back-End Development:
- π Set up servers and APIs: Construct server architectures and APIs to connect the front-end and back-end.
- π‘ Handle data storage and retrieval: Fetch and store data like a pro!
6. Version Control & Collaboration:
- π Git: Time to track changes like a wizard! Collaborate with others using the magical GitHub.
7. DevOps and Deployment:
- π Deploy applications on servers (Heroku, AWS): Launch your creations into the digital cosmos.
- π Continuous Integration/Deployment (CI/CD): Automate the deployment process like a tech guru.
8. Security Basics:
- π Implement authentication and authorization: Guard your realm with strong authentication and permission systems.
- π‘ Protect against common web vulnerabilities: Shield your applications from the forces of cyber darkness.
9. Learn About Testing:
- π§ͺ Unit, integration, and end-to-end testing: Test your creations with the rigor of a mad scientist.
- π¦ Ensure code quality and functionality: Deliver robust, bug-free experiences.
10. Explore Full Stack Concepts:
- π Understand the flow of data between front-end and back-end: Master the dance of data between realms.
- βοΈ Balance performance and user experience: Weave the threads of speed and delight into your creations.
11. Keep Learning and Building:
- π Stay updated with industry trends: Keep your knowledge sharp with the ever-evolving web landscape.
- π·ββοΈ Work on personal projects to showcase skills: Craft your digital masterpieces and show them to the world.
12. Networking and Soft Skills:
- π€ Connect with other developers: Forge alliances with fellow wizards of the web.
- π£ Effective communication and teamwork: Speak the language of collaboration and understanding.
Remember, the path to becoming a Full Stack Web Developer is an exciting journey filled with challenges and discoveries. Embrace the magic of coding and keep reaching for the stars! ππ
Engage with a reaction for more guides like this!β€οΈπ€©
β The coding_knowledge
π20β€4π₯2
Bubble Sort algorithm using JavaScript.pdf
406.6 KB
Javascript program for bubble sort Sort π€―π§ π
Don't forget to React β€οΈ to this msg if you want more content Like this π
Don't forget to React β€οΈ to this msg if you want more content Like this π
β€19π5
Create GUI for Downloading Youtube Video using Python (1).pdf
441.6 KB
Create GUI For downloading YouTube videos π§ π
Don't forget to React β€οΈ to this msg if you want more content Like this π
Don't forget to React β€οΈ to this msg if you want more content Like this π
β€12π4
Creating a Snake Game using C++ (With Source Code).pdf
504.5 KB
Snake Game Using C++ π§ π
Don't forget to React β€οΈ to this msg if you want more content Like this π
Don't forget to React β€οΈ to this msg if you want more content Like this π
β€22π7π1
100 AI websites to start a $100k/m online business in 2024:
1. Website
- 10Web
- Durable
- Style AI
- Dora AI
- Landingsite
2. Research
- ChatGPT
- Gemini
- Claude
- Bing chat
- Perplexity
- You .com
3. Image
- Dall-E 3
- Leap AI
- Bing AI
- Segmind
- Stockimg
- Midjourney
- Adobe firefly 2
- Stable Diffusion
4. CopyWriting
- Rytr
- Copy AI
- Writesonic
- Adcreative AI
5. Writing
- Jasper
- HIX AI
- Jenny AI
- Textblaze
- Chatsonic
6. Video
- Klap
- Opus
- Reclips
- Eightify
- InVideo
- HeyGen
- Short Deo
- ImgCreator AI
- Morphstudio
7. Meeting
- Tldv
- Otter
- Noty AI
- firefly
- Fellow app
8. SEO
- Seona AI
- TubeBuddy
- Semrush com
- BlogSEOkeywords
9. Chatbot
- Dante Ai
- Trycortex
- Chatsimple
- Droxy
10. Presentation
- Tome app
- Decktopus
- Gamma AI
- Designs AI
11. Automation
- Make
- Zapier
- Xembly
- Bardeen
12. Prompts
- FlowGPT
- Alicent AI
- PromptBox
- Promptbase
- Snack Prompt
13. UI/UX
- Figma
- Uizard
- UiMagic
- Photoshop
14. Design
- Canva
- Flair AI
- designify
- Clipdrop
- Autodraw
- Microsoft designer
15. Logo Generator
- Canva
- stockimg
- Logo AI
- Brandmark
- Logo Pony
- Namecheap
16. Audio
- Murf AI
- Songburst AI
- Adobe Podcast
17. Marketing
- Slack
- Pencil
- Ai-Ads
- AdCopy
18. Startup
- Tome
- Ideas AI
- Namelix
- Validator AI
19. Productivity
- Merlin
- Taskade
- Click Up
- Notion AI
- Smart Bird
20. Social media management
- Typeshare
- Tribescaler
- Blackmagic
- TweetHunter
- Postwise
β Share with others
Do react β€οΈ if you want more resources like this
1. Website
- 10Web
- Durable
- Style AI
- Dora AI
- Landingsite
2. Research
- ChatGPT
- Gemini
- Claude
- Bing chat
- Perplexity
- You .com
3. Image
- Dall-E 3
- Leap AI
- Bing AI
- Segmind
- Stockimg
- Midjourney
- Adobe firefly 2
- Stable Diffusion
4. CopyWriting
- Rytr
- Copy AI
- Writesonic
- Adcreative AI
5. Writing
- Jasper
- HIX AI
- Jenny AI
- Textblaze
- Chatsonic
6. Video
- Klap
- Opus
- Reclips
- Eightify
- InVideo
- HeyGen
- Short Deo
- ImgCreator AI
- Morphstudio
7. Meeting
- Tldv
- Otter
- Noty AI
- firefly
- Fellow app
8. SEO
- Seona AI
- TubeBuddy
- Semrush com
- BlogSEOkeywords
9. Chatbot
- Dante Ai
- Trycortex
- Chatsimple
- Droxy
10. Presentation
- Tome app
- Decktopus
- Gamma AI
- Designs AI
11. Automation
- Make
- Zapier
- Xembly
- Bardeen
12. Prompts
- FlowGPT
- Alicent AI
- PromptBox
- Promptbase
- Snack Prompt
13. UI/UX
- Figma
- Uizard
- UiMagic
- Photoshop
14. Design
- Canva
- Flair AI
- designify
- Clipdrop
- Autodraw
- Microsoft designer
15. Logo Generator
- Canva
- stockimg
- Logo AI
- Brandmark
- Logo Pony
- Namecheap
16. Audio
- Murf AI
- Songburst AI
- Adobe Podcast
17. Marketing
- Slack
- Pencil
- Ai-Ads
- AdCopy
18. Startup
- Tome
- Ideas AI
- Namelix
- Validator AI
19. Productivity
- Merlin
- Taskade
- Click Up
- Notion AI
- Smart Bird
20. Social media management
- Typeshare
- Tribescaler
- Blackmagic
- TweetHunter
- Postwise
β Share with others
Do react β€οΈ if you want more resources like this
β€30π15
Let's see how much javascript you know π, go and comment your answer π§
https://www.instagram.com/p/C6kYHhiyCgF/?igsh=MWRkaXdvZW55ZDRmcQ==
https://www.instagram.com/p/C6kYHhiyCgF/?igsh=MWRkaXdvZW55ZDRmcQ==
π6
Space Shooter Game Using Python.pdf
661.6 KB
Space Shooter Game Using Python π§ π
Don't forget to React β€οΈ to this msg if you want more content Like this π
Don't forget to React β€οΈ to this msg if you want more content Like this π
β€23π7π2
Count number of Faces using Python β OpenCV.pdf
355.8 KB
Count number of Faces using
Python β OpenCV π§ π
Don't forget to React β€οΈ to this msg if you want more content Like this π
Python β OpenCV π§ π
Don't forget to React β€οΈ to this msg if you want more content Like this π
β€21π7
Python Programming Notesπ.pdf
12.4 MB
Python programming Notes π
Don't forget to React β€οΈ to this msg if you want more content Like this π
Don't forget to React β€οΈ to this msg if you want more content Like this π
β€69π23π4π₯1
How to check typing speed using python πππ
import time
string = "Python is an interpreted, high-level programming language"
word_count = len(string.split())
border = '-+-'*10
def createbox():
print(border)
print()
print('Enter the phrase as fast as possible and with accuracy')
print()
while 1:
t0 = time.time()
createbox()
print(string,'\n'
inputText = str(input())
t1 = time.time(
lengthOfInput = len(inputText.split())
accuracy = len(set(inputText.split()) & set(string.split()))
accuracy = (accuracy/word_count)
timeTaken = (t1 - t0)
wordsperminute = (lengthOfInput/timeTaken)*60
#Showing results now
print('Total words \t :' ,lengthOfInput)
print('Time used \t :',round(timeTaken,2),'seconds')
print('Your accuracy \t :',round(accuracy,3)*100,'%')
print('Speed is \t :' , round(wordsperminute,2),'words per minute')
print("Do you want to retry",end='')
if input():
continue
else:
print('Thank you , bye bye .')
time.sleep(1.5)
break
import time
string = "Python is an interpreted, high-level programming language"
word_count = len(string.split())
border = '-+-'*10
def createbox():
print(border)
print()
print('Enter the phrase as fast as possible and with accuracy')
print()
while 1:
t0 = time.time()
createbox()
print(string,'\n'
inputText = str(input())
t1 = time.time(
lengthOfInput = len(inputText.split())
accuracy = len(set(inputText.split()) & set(string.split()))
accuracy = (accuracy/word_count)
timeTaken = (t1 - t0)
wordsperminute = (lengthOfInput/timeTaken)*60
#Showing results now
print('Total words \t :' ,lengthOfInput)
print('Time used \t :',round(timeTaken,2),'seconds')
print('Your accuracy \t :',round(accuracy,3)*100,'%')
print('Speed is \t :' , round(wordsperminute,2),'words per minute')
print("Do you want to retry",end='')
if input():
continue
else:
print('Thank you , bye bye .')
time.sleep(1.5)
break
β€15π9π4
DSA premium notes π.pdf
17 MB
DSA Premium notes ππ
Don't forget to React β€οΈ to this msg if you want more content Like this π
Don't forget to React β€οΈ to this msg if you want more content Like this π
β€71π18
hi everyone, If you want the code of object tracker built from Python's π OpenCv, then react to this message. If 20 responses are received, I will upload it tomorrow β€οΈ
β€30π2
Track objects with Camshift using OpenCV π§ π§
OpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in todayβs systems. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a human. Camshift or we can say Continuously Adaptive Meanshift is an enhanced version of the meanshift algorithm which provides more accuracy and robustness to the model. With the help of Camshift algorithm, the size of the window keeps updating when the tracking window tries to converge. The tracking is done by using the color information of the object. Also, it provides the best fitting tracking window for object tracking. It applies meanshift first and then updates the f the window as:
S= 2 x βm00/256
Source Code π
import numpy as np
import cv2 as cv
# Read the input video
cap = cv.VideoCapture('sample.mp4')
# take first frame of the
# video
ret, frame = cap.read()
# setup initial region of
# tracker
x, y, width, height = 400, 440, 150, 150
track_window = (x, y,
width, height)
# set up the Region of
# Interest for tracking
roi = frame[y:y + height,
x : x + width]
# convert ROI from BGR to
# HSV format
hsv_roi = cv.cvtColor(roi,
cv.COLOR_BGR2HSV)
# perform masking operation
mask = cv.inRange(hsv_roi,
np.array((0., 60., 32.)),
np.array((180., 255., 255)))
roi_hist = cv.calcHist([hsv_roi],
[0], mask,
[180],
[0, 180])
cv.normalize(roi_hist, roi_hist,
0, 255, cv.NORM_MINMAX)
# Setup the termination criteria,
# either 15 iteration or move by
# atleast 2 pt
term_crit = ( cv.TERM_CRITERIA_EPS |
cv.TERM_CRITERIA_COUNT, 15, 2)
while(1):
ret, frame = cap.read()
# Resize the video frames.
frame = cv.resize(frame,
(720, 720),
fx = 0, fy = 0,
interpolation = cv.INTER_CUBIC)
cv.imshow('Original', frame)
# perform thresholding on
# the video frames
ret1, frame1 = cv.threshold(frame,
180, 155,
cv.THRESH_TOZERO_INV)
# convert from BGR to HSV
# format.
hsv = cv.cvtColor(frame1,
cv.COLOR_BGR2HSV)
dst = cv.calcBackProject([hsv],
[0],
roi_hist,
[0, 180], 1)
# apply Camshift to get the
# new location
ret2, track_window = cv.CamShift(dst,
track_window,
term_crit)
# Draw it on image
pts = cv.boxPoints(ret2)
# convert from floating
# to integer
pts = np.int0(pts)
# Draw Tracking window on the
# video frame.
Result = cv.polylines(frame,
[pts],
True,
(0, 255, 255),
2)
cv.imshow('Camshift', Result)
# set ESC key as the
# exit button.
k = cv.waitKey(30) & 0xff
if k == 27:
break
# Release the cap object
cap.release()
# close all opened windows
cv.destroyAllWindows()
OpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in todayβs systems. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a human. Camshift or we can say Continuously Adaptive Meanshift is an enhanced version of the meanshift algorithm which provides more accuracy and robustness to the model. With the help of Camshift algorithm, the size of the window keeps updating when the tracking window tries to converge. The tracking is done by using the color information of the object. Also, it provides the best fitting tracking window for object tracking. It applies meanshift first and then updates the f the window as:
S= 2 x βm00/256
Source Code π
import numpy as np
import cv2 as cv
# Read the input video
cap = cv.VideoCapture('sample.mp4')
# take first frame of the
# video
ret, frame = cap.read()
# setup initial region of
# tracker
x, y, width, height = 400, 440, 150, 150
track_window = (x, y,
width, height)
# set up the Region of
# Interest for tracking
roi = frame[y:y + height,
x : x + width]
# convert ROI from BGR to
# HSV format
hsv_roi = cv.cvtColor(roi,
cv.COLOR_BGR2HSV)
# perform masking operation
mask = cv.inRange(hsv_roi,
np.array((0., 60., 32.)),
np.array((180., 255., 255)))
roi_hist = cv.calcHist([hsv_roi],
[0], mask,
[180],
[0, 180])
cv.normalize(roi_hist, roi_hist,
0, 255, cv.NORM_MINMAX)
# Setup the termination criteria,
# either 15 iteration or move by
# atleast 2 pt
term_crit = ( cv.TERM_CRITERIA_EPS |
cv.TERM_CRITERIA_COUNT, 15, 2)
while(1):
ret, frame = cap.read()
# Resize the video frames.
frame = cv.resize(frame,
(720, 720),
fx = 0, fy = 0,
interpolation = cv.INTER_CUBIC)
cv.imshow('Original', frame)
# perform thresholding on
# the video frames
ret1, frame1 = cv.threshold(frame,
180, 155,
cv.THRESH_TOZERO_INV)
# convert from BGR to HSV
# format.
hsv = cv.cvtColor(frame1,
cv.COLOR_BGR2HSV)
dst = cv.calcBackProject([hsv],
[0],
roi_hist,
[0, 180], 1)
# apply Camshift to get the
# new location
ret2, track_window = cv.CamShift(dst,
track_window,
term_crit)
# Draw it on image
pts = cv.boxPoints(ret2)
# convert from floating
# to integer
pts = np.int0(pts)
# Draw Tracking window on the
# video frame.
Result = cv.polylines(frame,
[pts],
True,
(0, 255, 255),
2)
cv.imshow('Camshift', Result)
# set ESC key as the
# exit button.
k = cv.waitKey(30) & 0xff
if k == 27:
break
# Release the cap object
cap.release()
# close all opened windows
cv.destroyAllWindows()
π13β€8π₯2