Giter Site home page Giter Site logo

edge-linking-using-hough-transform's Introduction

Edge-Linking-using-Hough-Transform

Aim:

To write a Python program to detect the lines using Hough Transform.

Software Required:

Anaconda - Python 3.7

Algorithm:

Step1:

Import all the necessary Python libraries which are required for the program.

Step2:

Load a image using imread() from cv2 module.

Step3:

Convert the image to grayscale.

Step4:

Using Canny operator from cv2,detect the edges of the image

Step5:

Using the HoughLinesP(),detect line co-ordinates for every points in the images.Using For loop,draw the lines on the found co-ordinates.Display the image.

Program:

import cv2
import matplotlib.pyplot as plt

image=cv2.imread('edge.png',1)
#image=cv2.resize(image,(1200,800))

cv2.imshow(' ',image)
import numpy as np
edges1 = cv2.Canny(image,100,150)

lines=cv2.HoughLinesP(edges1,1,np.pi/180, threshold=100, minLineLength=20,maxLineGap=50)


for line in lines:
    x1, y1, x2, y2 = line [0]
    cv2.line(image,(x1, y1),(x2, y2),(203, 48, 255),1)


cv2.imshow('gray',image)
cv2.waitKey(0)
cv2.destroyAllWindows()

Output

Result:

Thus the program is written with python and OpenCV to detect lines using Hough transform.

edge-linking-using-hough-transform's People

Contributors

etjabajasphin avatar nithish-selvam-expleo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.