Posts

Showing posts with the label PyCharm

How to Detect Shapes in Images in Python using OpenCV

Image
  How to Detect Shapes in Images in Python using OpenCV import numpy as np import matplotlib.pyplot as plt import cv2 import sys # read the image from arguments image = cv2.imread( r'G:\PARAS\anuradha.png' ) # convert to grayscale grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # perform edge detection edges = cv2.Canny(grayscale, 30 , 100 ) # detect lines in the image using hough lines technique lines = cv2.HoughLinesP(edges, 1 , np.pi/ 180 , 60 , np.array([]), 50 , 5 ) # iterate over the output lines and draw them for line in lines: for x1, y1, x2, y2 in line: cv2.line(image, (x1, y1), (x2, y2), color =( 20 , 220 , 20 ), thickness = 3 ) # show the image plt.imshow(image) plt.show()

Introduction to Image Processing in Python with OpenCV

Image
  Edge Detection using Canny Edge Detector Introduction In this tutorial, we are going to learn how we can perform image processing using the Python language. We are not going to restrict ourselves to a single library or framework; however, there is one that we will be using the most frequently, the  Open CV  library. So, let's begin! What is Image Processing? It is important to know what exactly image processing is and what is its role in the bigger picture before diving into its how's. Image Processing is most commonly termed as 'Digital Image Processing' and the domain in which it is frequently used is 'Computer Vision'. Don't be confused - we are going to talk about both of these terms and how they connect. Both Image Processing algorithms and Computer Vision (CV) algorithms take an image as input; however, in image processing, the output is also an  image , whereas in computer vision the output can be some  features/information about  the image. Why do

Python to automate What's App messages

Image
 Python to automate What's App messages  Send WhatsApp Messages  : We can automate WhatsApp to send messages by running a python script.  Now let's setup  pywhatkit  module and write the code to send WhatsApp message automatically. Install pywhatkit module: To install the pywhatkit module, we can use the pip command: pip install pywhatkit This command will download the  pywhatkit  module. It will take some time as it will download some related modules too. LIKE BELOW SCRIPT WILL RUN AUTOMATICALLY:::: (venv) C:\Users\RCF\PycharmProjects\pywhatkitWhatsAppAutomate>pip install pywhatkit Collecting pywhatkit   Downloading pywhatkit-3.9-py3-none-any.whl (9.1 kB) Collecting beautifulsoup4   Downloading beautifulsoup4-4.9.3-py3-none-any.whl (115 kB)      |████████████████████████████████| 115 kB 6.8 MB/s Collecting wikipedia   Downloading wikipedia-1.4.0.tar.gz (27 kB) Collecting pyautogui   Downloading PyAutoGUI-0.9.52.tar.gz (55 kB)      |████████████████████████████████| 55 kB 90

How to call stylesheet path Inside Python Index.html

Image
 How to call stylesheet path Inside Python Index.html  <!-- Styles --> < link href ="https://fonts.googleapis.com/css?family=Raleway:400,400i,600,700,700i &amp; subset=latin-ext" rel ="stylesheet" > < link rel ="stylesheet" href ="{{ url_for('static', filename='css/bootstrap.css') }}" > < link rel ="stylesheet" href ="{{ url_for('static', filename='css/fontawesome-all.css') }}" > < link rel ="stylesheet" href ="{{ url_for('static', filename='css/swiper.css') }}" > < link rel ="stylesheet" href ="{{ url_for('static', filename='css/magnific-popup.css') }}" > < link rel ="stylesheet" href =" {{ url_for('static', filename='css/styles.css') }} " > <!-- Favicon --> < link rel ="icon" href ="{{ url_for('static',

Redirecting to another page with button click in Python-flask

Image
  Redirecting to another page with  click in Python-flask Suppose we have to attach any html page Link in any webpage in python  < a class ="dropdown-item" href = "{{ url_for('terms') }}" >< span class ="item-text" > Terms Conditions </ span ></ a > < div class ="dropdown-items-divide-hr" ></ div > < a class ="dropdown-item" href = "{{ url_for('privacy') }}" >< span class ="item-text" > Privacy Policy </ span ></ a > THEN GO TO UR MAIN.PY PAGE : @app.route ( '/terms' )===> it is the name of file which we have mentioned inside href of above def terms():====> keep it same as name above return render_template( 'terms-conditions.html' )====then this page will open when click avove link::: Terms Conditions - Evolo - StartUp HTML Landing Page Template @app.route ( '/privacy' ) ===> it is the nam

web application using Flask and deploy it to the cloud

Image
  web application using Flask and deploy it to the cloud How Does a Flask App Work? The code lets us run a basic web application that we can serve, as if it were a website. from flask import Flask app = Flask ( __name__ ) @app . route ( "/" ) def home ( ) : return "Hello, World!" if __name__ == "__main__" : app . run ( debug = True ) This piece of code is stored in our main.py. Line 1:  Here we are importing the Flask module and creating a Flask web server from the Flask module. Line 3: __name__ means this current file . In this case, it will be main.py. This current file will represent my web application. We are creating an instance of the Flask class and calling it app. Here we are creating a new web application. Line 5:  It represents the default page. For example, if I go to a website such as “google.com/” with nothing after the slash. Then this will be the default page of Google. This is what the @app.route(“/”) will represe