
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
explain this code for me please
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
def lanesDetection(img):
height = img.shape[0]
width = img.shape[1]
region_of_interest_vertices = [
(200, height), (width/2, height/1.37), (width-300, height)
]
gray_img = cv.cvtColor(img, cv.COLOR_RGB2GRAY)
edge = cv.Canny(gray_img, 50, 100, apertureSize=3)
cropped_image = region_of_interest(
edge, np.array([region_of_interest_vertices], np.int32))
lines = cv.HoughLinesP(cropped_image, rho=2, theta=np.pi/180,
threshold=50, lines=np.array([]), minLineLength=10, maxLineGap=30)
image_with_lines = draw_lines(img, lines)
return image_with_lines
def region_of_interest(img, vertices):
mask = np.zeros_like(img)
match_mask_color = (255)
cv.fillPoly(mask, vertices, match_mask_color)
masked_image = cv.bitwise_and(img, mask)
return masked_image
def draw_lines(img, lines):
img = np.copy(img)
blank_image = np.zeros((img.shape[0], img.shape[1], 3), np.uint8)
for line in lines:
for x1, y1, x2, y2 in line:
cv.line(blank_image, (x1, y1), (x2, y2), (0, 255, 0), 2)
img = cv.addWeighted(img, 0.8, blank_image, 1, 0.0)
return img
def videoLanes():
cap = cv.VideoCapture('./img/Lane.mp4')
while(cap.isOpened()):
ret, frame = cap.read()
frame = lanesDetection(frame)
cv.imshow('Lanes Detection', frame)
if cv.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv.destroyAllWindows()
if __name__ == "__main__":
videoLanes()
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Autoencoder and VAE a) Explain how autoencoder works and mention some of its applications b) Explain the following code 1 input layers. Input (shape=(28, 28, 1)) 2 3 x = layers.Conv2D(32, (3, 3), activation='relu", padding="same") (input) 4 x = layers.MaxPooling20((2, 2), padding="same") (x) 5 x = layers.Conv2D(32, (3, 3), activation="relu", padding="same") (x) x = layers.MaxPooling20((2, 2), padding="same") (x) 7 8 x = layers.Conv2DTranspose (32, (3, 3), strides=2, activation='relu", padding="same") (x) 9 x = layers.Conv2DTranspose (32, (3, 3), strides=2, activation='relu', padding="same") (x) 10 I x = layers.Conv2D(1, (3, 3), activation="sigmoid", padding="same") (x) 11 12 autoencoder Model (input, x) 13 autoencodex.compile(optimizer="adan", loss="binary_crossentropy") 14 autoencoder.summary()arrow_forwardimport javax.swing.*; import java.util.ArrayList; import java.util.Collections; import java.util.Random; import java.awt.*; import java.awt.event.*; public class memory extends JFrame implements ActionListener { private JButton[] cards; private ImageIcon[] icons; private int[] iconIDs; private JButton firstButton; private ImageIcon firstIcon; private int numMatches; public memory() { setTitle("Memory Matching Game"); setSize(800, 600); setLayout(new BorderLayout()); JPanel boardPanel = new JPanel(new GridLayout(4, 4)); add(boardPanel, BorderLayout.CENTER); icons = new ImageIcon[8]; for (int i = 1; i <= 8; i++) { icons[i-1] = new ImageIcon("image" + i + ".png"); } iconIDs = new int[16]; for (int i = 0; i < 8; i++) { iconIDs[2*i] = i; iconIDs[2*i+1] = i; } Random rand = new Random(); for (int i = 0; i < 16;…arrow_forward2. Problem 2: In this problem you will test our "in class" version of Gaussian elimination against the version in numpy. Use both codes to solve some randomly chosen linear systems of size N 10, 20, 40, 80, 160, 320, 640, 1280, 2560, and 5120. Depending on your computer, the last two may or may not work. If they don't, just say so in your report. If you computer can do N- 10240 then try this as well. Note that in cach case N 10 * 2k for k = 1,..., 10. That is, each time we are doubling the size of the matrix. abone Plot the results as two curves. Our code in red and numPy in bluc. (Or whatever colors you prefer). Can you guess the function which governs the runtime? Based on this guess, how long would it take to do N 40960 using numPy? N=81920?arrow_forward
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education