Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started