CarND Project - Advanced Lane Finding

(Udacity Learning Note: CarND-Term1 Project 4)

Camera Calibration & Distortion Correction

Two Types of Distortion

  • Radial Distortion
  • Tangential Distortion

Using OpenCV

Example

  • Finding chessboard corners (for an 8x6 board):
ret, corners = cv2.findChessboardCorners(gray, (8,6), None)
  • Drawing detected corners on an image:
img = cv2.drawChessboardCorners(img, (8,6), corners, ret)
  • Camera calibration, given object points, image points, and the shape of the grayscale image:
ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, gray.shape[:-1], None, None)
  • Undistorting a test image:
dst = cv2.undistort(img, mtx, dist, None, mtx)

Perspective Transform

Commonly Used View

  • Front-facing View (Normal View)
  • Top-down View (Bird-eye View)

Why?

  • Because ultimately we want to measure the curvature of the lines, and to do that, we need to transform to a top-down view.

Apply Perpective Transform using OpenCV

  • Compute the perspective transform, M, given source and destination points:
  M = cv2.getPerspectiveTransform(src, dst)
  • Compute the inverse perspective transform:
  Minv = cv2.getPerspectiveTransform(dst, src)
  • Warp an image using the perspective transform, M: (warp v. 扭曲)
  warped = cv2.warpPerspective(img, M, img_size, flags=cv2.INTER_LINEAR)

Gradient Threshold

Sobel Operator

  • The Sobel operator is at the heart of the Canny edge detection algorithm.

Example use of Sober operator

  • Calculate the derivative in the x direction (the 1, 0 at the end denotes x direction):

    sobelx = cv2.Sobel(gray, cv2.CV_64F, 1, 0)

  •  Calculate the derivative in the y direction (the 0, 1 at the end denotes y direction):

    sobely = cv2.Sobel(gray, cv2.CV_64F, 0, 1)

  •  Calculate the absolute value of the x derivative:

    abs_sobelx = np.absolute(sobelx)

  •  Convert the absolute value image to 8-bit:

    scaled_sobel = np.uint8(255*abs_sobelx/np.max(abs_sobelx))

Direction of Gradient

  • The direction of the gradient is simply the inverse tangent (arctangent) of the y gradient divided by the x gradient: 
    • arctan(sobely​​/sobelx​​).

Color Space

  • RGB
  • HSV
  • HLS

Reference

  1. Wikipedia: HSL and HSV

 

转载于:https://www.cnblogs.com/casperwin/p/7421107.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值