Linnnn
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • Create new note
      • Create a note from template
        • Sharing URL Link copied
        • /edit
        • View mode
          • Edit mode
          • View mode
          • Book mode
          • Slide mode
          Edit mode View mode Book mode Slide mode
        • Customize slides
        • Note Permission
        • Read
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Write
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invite by email
        Invitee

        This note has no invitees

      • Publish Note

        Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

        Your note will be visible on your profile and discoverable by anyone.
        Your note is now live.
        This note is visible on your profile and discoverable online.
        Everyone on the web can find and read all notes of this public team.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        See published notes
        Unpublish note
        Please check the box to agree to the Community Guidelines.
        View profile
      • Commenting
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Suggest edit
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
      • Emoji Reply
      • Enable
      • Versions and GitHub Sync
      • Note settings
      • Note Insights New
      • Engagement control
      • Make a copy
      • Transfer ownership
      • Delete this note
      • Save as template
      • Insert from template
      • Import from
        • Dropbox
        • Google Drive
        • Gist
        • Clipboard
      • Export to
        • Dropbox
        • Google Drive
        • Gist
      • Download
        • Markdown
        • HTML
        • Raw HTML
    Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy Transfer ownership Delete this note
    Import from
    Dropbox Google Drive Gist Clipboard
    Export to
    Dropbox Google Drive Gist
    Download
    Markdown HTML Raw HTML
    Back
    Sharing URL Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Customize slides
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Car Lane Detection === 現今無人駕駛技術已經越來越成熟及普及,從現在路上最常跑的電動車 Tesla 就含有很多自動駕駛的技術在裡面,上次看到這影片時[Tesla Navigating](https://www.youtube.com/watch?v=rKG3eDppzm4&t=94s&ab_channel=AIDRIVR)、[Tesla autopilot recognition of roadside structures](https://www.youtube.com/watch?v=7ztK5AhShqU&ab_channel=greentheonly)、[CA through the eyes of FSD BETA](https://www.youtube.com/watch?v=REcBsg93YIM&ab_channel=AIDRIVR),整個特斯拉能看到的場景很豐富,當然也對於最基礎的車道偵測也是必備功能。Tesla 是藉由很多 sensor 去提供資訊再去做運算與判斷不同場景,那本次想從基礎車道偵測去下手,藉由影像處理的方法去辨識車道線,再去判斷車子左右偏移狀況。 [加強版車道偵測在這~~](https://hackmd.io/@yoch/Sy8H_v4vO) ## 基礎車道辨識 ### 基本架構 整體架構如下,首先是由 camera 影像進來,那要對單張單張影像進行處理與判別。 ```flow st=>start: Image e=>end: Draw Line op=>operation: To Gary & Reduce Noice op2=>operation: Edge Detect op3=>operation: Interes Region op4=>operation: Hough Line Detection st->op->op2->op3->op4 op4->e ``` ### 方法 由上面架構圖可以看到使用了哪些方法,這部分就來講解一下。 首先做影像處理幾乎都是轉為單通道去做處理比較方便也好理解,整體過程都直接採用 OpenCV Library 進行,首先將 GBR 轉為 Gray ![](https://i.imgur.com/6EU6NiF.jpg =500x) 之後再透過 Gaussian Filter 進行低通濾波將影像中的雜訊給濾除掉, ![](https://i.imgur.com/HHkane6.jpg =500x) 接著進行邊緣偵測 ![](https://i.imgur.com/QjVGZBE.png =500x) 那這邊比較一下有無濾波的差異 沒有濾波 ![](https://i.imgur.com/rKClZwg.png) 有濾波 ![](https://i.imgur.com/c36wL04.png) 從上面可以看出來有些雜訊是被濾除掉的 那再來要偵測車道線,由於行車紀錄器都是固定位置,那可以直接抓出我們感興趣的位置進行偵測,由下圖可以看到只顯示出一部分要去做處理 ![](https://i.imgur.com/vKbHAvy.png) 從剛剛上面的圖再透過 hough transform 進行 line detection,當然會偵測到很多點然後顯示一堆線,所以必須採取一個步驟就是去限制這些點,然後把最需要的資訊再抓取出來,這邊透過高中所學的直線斜率簡單的知識就可以了! 大家應該都還記得兩點可以成一直線,那一直線就可以算出它的角度與斜率了吧,這邊附上一張圖讓各位回憶一下xd ![](https://i.imgur.com/JMa7vw9.png =300x) ![](https://i.imgur.com/nFhUMcR.png =400x) 那麼斜率 K 就等於 $$K ={y_2 - y_1 \over x_2 - x_1}$$ 那可以透過斜率方便尋找出我們需要的直線,這邊採用的方法是去將所有點的斜率去做一個限制與平均,可能這樣說會不懂直接上程式碼。 ```python= def make_coordinate(parameter, y_max, y_min): x1_mean = int((y_max - parameter[1]) / parameter[0]) x2_mean = int((y_min - parameter[1]) / parameter[0]) return np.array([x1_mean, y_max, x2_mean, y_min]) def mean_coordinate(img, lines): left_fit = [] right_fit = [] y_max = img.shape[0] y_min = img.shape[0] for line in lines: x1, y1, x2, y2 = line[0] y_min = min(min(y1, y2), y_min) parameter = np.polyfit((x1, x2), (y1, y2), 1) ## y = ax + b, 兩點求直線公式 slope = parameter[0] intercept = parameter[1] if abs(slope) < 0.5: continue if slope < 0: ## 判斷斜率來表示左右 left_fit.append((slope, intercept)) else: right_fit.append((slope, intercept)) if len(left_fit) > 0 and len(right_fit) > 0: left_fit_mean = np.mean(left_fit, axis=0) right_fit_mean = np.mean(right_fit, axis=0) left_coordinate = make_coordinate(left_fit_mean, y_max, y_min) right_coordinate = make_coordinate(right_fit_mean, y_max, y_min) return np.array([left_coordinate, right_coordinate]) return ``` ### Demo 可以偵測車道線,但是效果並不這麼理想,因此又想說做一個加強版的來讓車道偵測再完美一些。 ![](https://i.imgur.com/2d0vtuB.gif) ![](https://imgur.com/mFOsjvH.gif) ## 參考 >Lane Detection:https://github.com/davidawad/Lane-Detection >Hands-On Tutorial on Real-Time Lane Detection using OpenCV:https://www.analyticsvidhya.com/blog/2020/05/tutorial-real-time-lane-detection-opencv/

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully