謝豐安
  • 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- tags: CCU, 計算攝影學 --- # 2020計算攝影學整理筆記(下) [2020計算攝影學整理筆記(上)](https://hackmd.io/@bshG7JUyR_29IAVeaT9ZDA/H1jpqDd_D) --- [Course Works 課業倉儲](https://www.cs.ccu.edu.tw/~damon/secure/course-wk.html) [Discussion Board 課程討論區](https://140.123.101.97/login.htm) :::danger 每天記得看一次課程討論區有沒有最新的資訊 ::: # Overview ## Grading :::danger 評分標準可能會變動 ::: | 評分標準 | 比重 | | ----------------- |:----------------------- | | Laboratories (4~7) | 25% | | Midterm | 33% | | Final exam | 20% | | Final project / PowerPoint slides | 12% | | Punctuality, attendance, <br> and participation in discussions | 10% | :::warning 計算攝影學上課不定期點名 ::: --- # Image Quilting ## 紋理(Texture) 1. 通常會是重複的pattern 2. 有頻率的出現,而且很自然 ### 紋理合成(Texture Synthesis) **從小圖變大圖** ![](https://i.imgur.com/iURTESg.png) 紋理種類: 1. 重複出現(repeated) 2. 隨機排列(stochastic) 3. 兩種都有(both) #### 合成方法 1. 計算輸入紋理的機率分布,讓生成的過程保持此機率分布 :::warning 此方法通常不會成功,很難model一個好的結果 ::: 2. 從影像取樣 從輸入影像中找出所有跟P點相似的pattern,再隨機挑選一個 :::info Markov property: 隨機過程未來的分配,只決定於隨機過程的現值,與隨機過程的過去沒有關係。 p(pixel | rest of image) = p(pixel | neighborhood) ::: MRF : Markov Random Field (Assume stochastic model of texture) Stationarity: 隨機模型不會因為圖像選取不同位置而改變 <br> Efros& Leung Algorithm(計算量大) ![](https://i.imgur.com/5BwN6Xb.png) 使用 **SSD(Sum of squared differences)** 計算差異性 :::info 可以乘上高斯權重讓較近的鄰居有較高權重 ![](https://i.imgur.com/XQyIzma.png) ::: 隨機取樣or挑選最佳的 <br> 填補pixel的順序: **Onion skin,有最多鄰居的先合成** :::success 可以看出 Neighborhood Window 太小合成效果會不好 (P.19~P.24) ::: ### 影像修補(Inpainting) 外推法(也會失敗) ![](https://i.imgur.com/Qf9uZHi.png) ### 總結 The Efros & Leung texture synthesis algorithm: 1. 簡單、效果也很好 2. 合成比分析簡單 3. 在hole filling上表現的很自然 4. 很慢 ### 加速紋理合成 高斯金字塔(Gaussian pyramid): 多解析度 優點: neighbor window size可以不用那麼大 先從小張的開始算。然後在算較高level的texture時, 會利用不同的解析度填補 :::info 更快的方法: neighbor pixels are highly correlated(相鄰者高度相關) 以Block為基本單位,一次填一整個Block的Pixels ![](https://i.imgur.com/vszv959.png) ::: #### 演算法 1. 設定block size 跟 overlap size 2. 照raster order順序合成(左到右,上到下) 3. 選擇符合overlap constraints的block 4. 貼上紋理:(1)blending, (2)DP(dynamic programming)計算minimal error boundry cut :::info ![](https://i.imgur.com/qXwNDNq.png) ::: #### Inpainting Filling order matters ![](https://i.imgur.com/e9GwlXZ.png) ### 紋理轉移(Texture Transfer) 跟紋理合成(Texture Synthesis)一樣,只是多了限制 1. 紋理一致性 2. 影像相似度 <br> 雖然有難度,但是可以藉由影像的邊界形狀跟陰影產生類似的形狀 #### Iterative Texture Transfer 重複做幾次紋理轉移演算法,並且使用上一個iteration的結果當成這次的target image ### 影像類比(Image Analogies) 使用最近鄰居搜尋與Ashikhmin’s coherence searchheuristic 使用**特徵向量**: 除了RGB還有亮度、導數等等 ### Super-resolution 1. 把影像中的高頻拉高 2. 使用多個frame來增加取樣率 3. 評估影像中沒有顯示的高頻 #### Unsharp masking ![](https://i.imgur.com/g7qvVVF.png) ![](https://i.imgur.com/xOkqYsc.png) ![](https://i.imgur.com/53lFUwP.png) ![](https://i.imgur.com/QFAC8ug.png) #### Sharpening ![](https://i.imgur.com/oEcpzeY.png) --- # Image Based Rendering ## 幾何模型渲染問題 1. 建模太慢 2. 缺乏真實感 3. 渲染太慢 -- 互動是不可能的 4. 渲染的cost取決於場景的複雜度 ## IBR 利用多張影像組成3D Model,除了使用照片外,還會使用額外的資訊例如深度 計算複雜度受限於影像的解析度 優點: 1. 快,跟場景複雜度無關 2. 影像來源可以是真實相片或合成相片 缺點: 1. 需要大量儲存空間 2. 有限的解析度 3. 前置運算的cost可能會很高 ## 影像鑲嵌(Image Mosaics) ![](https://i.imgur.com/5lcYBwq.png) ## Warping and Morphing Warping: 將一張照片扭曲成另一張 Morphing: 是由⼀張圖像流暢地變成另⼀張圖像的視覺效果(多次處理) ### IBM(Warping) warping成不同角度去貼合成model Take several pictures of an object: 從多個角度、涵蓋整個物體 Create a rough polygonal model of object: 只須建立簡易的模型 Render final textured model: 校正切面位置 使用紋理補全模型細節 :::warning 剪影會失敗 ::: 步驟: 1. 拍多張照片 2. 尋找特徵 3. 關聯每個特徵 4. 解決世界座標相機的位置 5. 使用特徵去建立一個簡易模型 6. 重新投影此模型 ### Image Morphing #### View Morphing 更改相機位置->不同場景 平行or非平行 相機位置 相機參數 (使用內插) --- # Image Warping ![](https://i.imgur.com/aOTIfzC.png) Global warping: transition, rotation, aspect, affine, perspective, cylindrical ## Forward Warping 把原本影像的pixel從(x,y)轉換至(x',y') 在轉換過程中,如果pixel的新位置落在兩個pixel位置之間(非整數座標)時,則分配給(x',y')的neighbor pixels(按最近的取整)(**splatting**) ## Inverse Warping 假設原圖像是f(u,v),扭曲的目標圖像是g(x,y)。 對於每個獲得的新坐標(x,y),用逆向的映射函數u(x,y),v(x,y)找到它在原圖中對應的位置(u,v),然後讓g(x ,y)= f(u,v)。如果算出來的點(u,v)不在格子上,就用插值方法獲得回報值。 如果轉換過來的舊座標(x,y)是在兩個pixel之間,則使用 **nearest neighbor**, **bilinear**, **Gaussian**, **bicubic**等等方法 Forward vs. Inverse Warping usually inverse — eliminates holes 需要可逆的warp function 不總是可行 ## Morphing = warping + cross-dissolving Morphing是兩個物件的平均影像 :::info 根據時間T去做weighted average達到平滑的轉換 ::: 1. Create an intermediate warping field . 創建一個中間的warping field 2. Warp both images towards it. 變形 3. Cross-dissolve the colors in the newly warped images. 做變換到中間的顏色 ## Cross-Dissolve溶解 •內插整個圖像:Image<sub>halfway</sub> = (1-t) * Image<sub>1</sub> + t * image<sub>2</sub> •這在電影行業中稱為交叉溶解,會導致沒有對齊 ## Align(對齊), then cross-dissolve -> still valid ## 兩個物件重疊,全局對齊、Cross-Dissolve無效 Feature matching: a local (non-parametric) warp then cross-dissolve -找到代表物件的特徵->local warping -融合->Cross-dissolve the warped images ## Morphing – Revisited 從一個圖像到另一個圖像的流體轉換 Cross dissolving是切割之間的常見過渡,但是由於ghosting effects,因此變形效果不好。 ### Morphing sequence 對於每個時間點t: 1. 使用內插找出每個時間中間的warping field 2. 把兩張圖片warping到這個field 3. 對兩張圖片做Cross-dissolve運算 ## Warping – Non-Parametric 移動控制點以指定spline warp Spline產生平滑的vector field。 ![](https://i.imgur.com/kxdZEcl.png) #### Warp Specification – Dense 指定相應的樣條控制點,內插到完整的變形函數,但通常想控制少數幾個點而不是整個網格 ![](https://i.imgur.com/DzbgYFn.png) #### Warp Specification – Sparse 指定對應點,內插到完整的變形功能 ![](https://i.imgur.com/2tmFJo3.png) ### Triangular Mesh 1.在關鍵特徵點輸入對應關係。 2.在這些點上定義一個三角形網格:兩個圖像中的網格相同,因此有了三角形之間的對應關係 3.從source到destination分別變形每個三角形: :::info 每三個點=一個三角形=對三角形做affine的wraping ::: --- # Image Alignment(圖像對齊) ## Direct (pixel-based) alignment: 找到大多數像素相同的特徵進行對齊,需要定義匹配function,常見的有**SSD (sum squared differences), Normalized Correlation, edge matching** #### Brute Force 將所有內容全都看過一次,並在過程中一一比對內容和搜尋樣本內的所有內容, 但是是不現實的,O(n<sup>8</sup>),可以用 **梯度下降(Gradient Descent)** 減少計算量。 ## Feature-based alignment: 找到匹配的特徵進行對齊 1. 找到重要的特徵(重要特徵類似兩張圖像都有的、容易進行localize、邊界) 2. 兩張圖像進行匹配 3. 計算 #### 特徵所需的條件 1. Distinctive:獨特性,單個特徵也能辨識 2. Invariant:不變性,對旋轉、縮放等映射均不會影響,重複出現的特徵 3. 如果遇到特徵類似,則擴大特徵範圍 4. 如果由於旋轉、縮放導致特徵改變->需要一個不變的描述方法 -- 傅立葉轉換 ![](https://i.imgur.com/bCPmTtM.png) #### Harris Corner Detector 在corner上向任何方向移動窗口都應在強度上產生很大的變化,線段縮小範圍之後,可能會檢測為corner ![](https://i.imgur.com/hssSPqv.png) 平坦區域(Figure 1):各個方向都沒有變化。 邊緣(Figure 2):沿邊緣方向沒有變化。 角(Figure 3):全方位變化。 步驟: 1. Compute corner response R 2. Find points with large corner response: R > threshold 3. Take only the points of local maxima of R 一些特徵: 1. Rotation invariance.旋轉不變性 Corner response R is invariant to image rotation #### SIFT • Scale-space extrema detection 尺度空間極值檢測 • Keypoint localization 關鍵點本地化 • Orientation assignment 方向分配 • Keypoint descriptor 關鍵點描述符 --- # Image Retargeting 最常用的縮略技術是均勻縮放,但是當比例變化太大時,會導致明顯拉伸或擠壓變形。 其次是剪切技術,但是剪切在目標區域大的時候,往往丟棄了部分重點內容。 #### Importance Map Estimation Bottom-up methods: – Low-level features(強度,顏色,邊緣方向) Top-down methods: – Semantic information (面孔,文字,結構,對稱) Semi-automatic methods (user interaction) #### Content-Aware Retargeting Operators 1. Automatic Cropping Select the cropping window that maximizes a quality measure.提取需要的資訊or Object,只能消除外圍不重要的因素,遇到重要資訊散亂則無法使用 2. Scaling Variants 3. Rapid Serial Visual Presentation (RSVP) 4. Segmentation-Based 取得saliency map剪下重要資訊,背景縮放後再接上重要資訊 5. Seam Carving 保留高能量的pixel,並移除低能量的pixel 算法會找出一系列的**接縫(seam)**(接縫是在圖像中最不重要的一連串像素,是低能量像素從上到下或從左到右穿過圖像的連接路徑,恰好為每一行or列各一pixel) 人類的視覺對邊緣更加敏感,基於梯度的能量的直覺:**保留強烈的輪廓**。 •對於圖像縮小,接縫選擇可確保在保留圖像結構的同時,刪除更多的低能量像素,而減少高能量像素。 方法:一直將最低能量的seam刪去 •對於圖像放大,接縫插入的順序可確保原始圖像內容和人工插入的像素之間達到平衡。 方法: 1.直接複製seam. 2.由seam的左右兩邊鄰居取平均. 3.取seam的能量值與其中一邊鄰居(左或右)的能量值做平均(即時運算). **Dynamic Programming**(上左、上、上右找最小相加) -> **Backtracking**(右到左、下到上) searching for minimum ![](https://i.imgur.com/wCLAu0M.png) 實時計算seam不可能,先計算好所有seam,實時調整大小發布內容。 :::warning 若影像太過單調,且不包含不太重要的部分,則不太適用此方法,用傳統的 scaling反而會比較好。 ::: 6. Warping-Based 重要區域的局部失真被限制為盡可能小,而其他區域可能會失真更大。 取得輸入圖像的網狀圖,**標記重要部分**後對其餘地方進行縮放 7. Patch-Based 8. Multi-Operator <br>找出一連串operation讓input與output的距離最小 #### Energy Functions 1. gradient magnitude 2. entropy 3. visual saliency 4. eye-gaze movement :::info 目標是把不顯眼的pixel移除 ::: ### Image reduction & enlarging 1. reduction 移除更多低能量的pixel,移除較少高能量的pixel :::info 影像縮減是一直將最低能量的seam刪去 ::: 2. enlarging 好的插入seam順序可以保持新pixel與原圖內容的平衡 ### Object Removal 1. 使用者標記要被移除的object 2. 使用seam carving去移除pixel 3. 直到被標記的pixel都被移除就結束 --- # Image Blending ## 剪下貼上(Cut and Paste) 1. 小的分段error會被注意到 2. 剪下的會有塊狀問題 3. 半透明的材質無法適用 :::info 2解決法: 羽化(Feathering) 物體邊界像素值,部分來⾃前景,部分來⾃背景。 ![](https://i.imgur.com/ODCaRi9.png) ::: ### Alpha compositing Alpha: 不透明度 ![](https://i.imgur.com/N3QiMBp.png) :::info 最佳的window size: 平順的blending但不會有鬼影產生 ::: ## 拉普拉斯金字塔混合(Pyramid Laplacian Blending) 在低頻的地方做blending速度會變慢,因為在低頻的地方要做blending的話,需要blending的寬度加大,則顏色的變化較難被注意到, 在高頻的地方做blending速度會變快,因為需要較小的寬度,減少鬼影的範圍 :::info 1. Build Laplacian pyramids LA and LB from images A and B ; 2. Build a Gaussian pyramid GM from selection mask M; 3. Form a combined pyramid LS from LA and LB using nodes of GM as weights: <br>LS = GM * LA + (1-GM) * LB <br> 4. Collapse the LS pyramid to get the final blended image ::: :::warning Laplacian 會對影像作2階微分,用以凸顯快速的變化 高斯kernel 是一個2D Convolution 的運算子,用以模糊照片,並移除細節與雜訊 ::: ### Minimal error boundary ![](https://i.imgur.com/T7k7AHl.png) ## Poisson Blending 好的融合不該改變背景 ![](https://i.imgur.com/VgD7fTY.png)

    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