Question: I mage Processing USEING PYTHON: Line Segment Detection Write a complete code to Detect the line segments in an image. Please use a BSIC PYTHON

Image Processing USEING PYTHON: Line Segment Detection

Write a complete code to Detect the line segments in an image.

Please use a BSIC PYTHON CODE for this Problem

PYTHON

import cv2 import numpy as np image = cv2.imread(('C:/Users/faisa/Desktop/Urban Images/urban2.jpg')) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) edges = cv2.Canny(gray, 100, 250) lines = cv2.HoughLinesP(edges, 1, np.pi/180, 25, minLineLength=100, maxLineGap=50) ho = np.zeros(image.shape, np.uint8) for line in lines:  a, b, a1, b1 = line[0] cv2.line(ho, (a, b), (a1, b1), (255, 255, 255), 2) cv2.imshow('Motion Blur', ho) cv2.waitKey(0) 

Improve the result of the code and display the results on the original image.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!