mymombehindme
    • 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

      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.
      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
    • Engagement control
    • 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 Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control 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

    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.
    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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tags: 多媒體筆記 --- # 多媒體筆記 ## Unit 1 Digital Media Representation and Compression - Computers can only work with digital data ## 類比/數位 轉換 (A/D Conversion) - Analog-to-digital conversion requires two steps: **Sampling (取樣)** and **Quantization (量化)**. - The number of samples taken per unit time or unit space is called the **sampling rate(取樣率)** or, alternatively, the **resolution(解析度)**. ## How to determine the sampling rate? - **Undersampling**:Sampling rate does not keep up with the rate of change in the signal. - **Aliasing**:In a digital signal arises from undersampling and results in the sampled discrete signal cannot reconstruct the original source signal ## 奈奎斯特取樣定理 (Nyquist Theorem) 奈奎斯特取樣定理說明了受量測訊號的取樣率與頻率之間的關係。根據此定理,取樣率 **r** 必須比受量測訊號中相關最高頻率分量高出兩倍。 此頻率通常稱為奈奎斯特頻率 **f**。 ``` r >= 2*f ``` - Sampling rate要大於被sample的最大freq的兩倍,才能無失真的還原 ## 量化(Quantization) - 找出最大最小的f - 然後在最大最小f區間中,固定等分切,中間的值都捨棄只留頭尾 - 間距**Q**為最大的f減去最小的f除上L(分成L等份) - $Q=(f_{max}-f_{min})/L$ - ![](https://i.imgur.com/biD9M8c.png) - (頻率f-最小的f)/間距Q **即為該頻率f經由量化後的索引值** - (量化索引值.間距Q)+(Q/2)+最小的f **即為該頻率f量化後的值** - ![](https://i.imgur.com/Suovdbx.png) ## 遊程編碼 (Run-Length encoding,RLE) - 舉例來說,一組資料串"AAAABBBCCDEEEE",由4個A、3個B、2個C、1個D、4個E組成,經過變動長度編碼法可將資料壓縮為4A3B2C1D4E(由14個單位轉成10個單位)。 - **優點**:將重複性高的資料量壓縮成小單位 - **缺點**:若該資料出現頻率不高,可能導致壓縮結果資料量比原始資料大 - 例如:原始資料"ABCDE",壓縮結果為"1A1B1C1D1E"(由5個單位轉成10個單位)。 - BMP 檔案格式可使用RLE去壓縮 - 用(c,n)表示pixel,c為資料的值,n為出現次數 - c: grayscale value - n: how many consecutive pixels have that value ## 熵編碼法(Entropy Encoding) - 常出現的顏色用比較少的bit去取代,不常出現的顏色就用較多的bit代替 - **Shannon’s Equation**, below, gives us a way a judging whether our choice of number of bits for different symbols is close to optimal $H(s)=η=\sum_{i}^{N}pil𝑜𝑔_2(\dfrac{1}{pi})$ - N:pixel總數 - i:index為i的資料 - pi:index為i的資料出現的機率 - ![](https://i.imgur.com/hTfjbeW.png) - 也就是說256個不同pixel,要用8bit去表示 - Shannon proves that you CAN NOT do better than this optimum ## 香農-范諾編碼 (Shannon-Fano algorithm) - ![](https://i.imgur.com/0XXQEqx.png) - 先排序所有frquency - 然後左右分堆,盡可能左邊的值跟右邊的值差不多 - 頻率最大的往左放,編碼0,剩下的往右,以此類推 ## 變換編碼 (Transform Encoding) - 轉換編碼過程乃利用線性轉換將影像映射至頻率領域中之一組轉換係數(Transform Coefficient),再進行量化與編碼 - Lossy(無失真) methods are often based upon transform encoding - No information is lost in the DCT or DFT ## (Unit 2) Digital Image Representation ## 點陣圖-數位化(Bitmaps - digitization) ### 點陣圖 - 以一格格的pixel來組成影像 - 每個pixel都指定有一特定位置及顏色數值 - 放大檢視時,可能會遺失細節並產生鋸齒 - 例如:JPG、BMP、TIF、GIF、PNG ### 數位化步驟 1. **取樣**:將影像分隔成許多固定大小的樣本,每個樣本稱為pixel ![](https://i.imgur.com/5fncqJc.png) 2. **量化**:把每個pixel的色彩以特定的數值表示。常見的有1bit、8bits、24bits,若為24bits表示為全彩影像(RGB)RGB各8bits各有2的8次方=256種色階變換。 ## 點陣圖-影像大小(Bitmaps – image size) - **影像大小**:又稱像素尺寸。 - **像素尺寸(Pixel dimension)**:像素尺寸=寬邊的像素數量*高邊的像素數量。 - 舉個例來說,一張300x200的數位影像,表示數位影像寬是300個像素、高是200個像素,共6萬個像素所組成(300x200=60,000)。 - **解析度(Resolution)**:在點陣圖中,單位長度內像素的數量(**Dots per inch,DPI**) - **(像素與解析度的關係**:這裡有兩張圖檔,像素尺寸都是300x450,但是一張解析度是300dpi,另一張則是100dpi。這邊我們把這兩張圖都列印出來,分別會是多大張的實體圖片呢?第一張的寬的尺寸就會300px/300dpi=1(inch),高則是450px/300dpi=1.5(inch)。第二張長寬同樣算法,寬300px/100dpi=3(inch)、高450px/100dpi=4.5(inch)。 ![](https://i.imgur.com/LZ5zghH.png) ## 離散餘弦變換(Discrete Cosine Transform, DCT) - 是與傅立葉變換相關的一種變換,類似於離散傅立葉變換,但是只使用實數。 - 任何複雜的周期波形都可以表示為正弦波的無限和 - ![](https://i.imgur.com/EMBDGR4.png) ## 1D Discrete Cosine Transform (DCT) - ![](https://i.imgur.com/ifJcryw.png) - ![](https://i.imgur.com/1QHZP2r.png) - The first element F(0) is called the DC component. Other components are AC components ## 2D DCT - ![](https://i.imgur.com/rgotSHo.png) ## JPEG Compression ## Quantization - We divide the DCT coefficients by Quantization Table to downgrade the value recorded in the jpeg file because it is hard for the human eyes to distinguish the strength of high frequency components. - ![](https://i.imgur.com/8RiTtQ9.png) - ![](https://i.imgur.com/dA7il7D.png) - ![](https://i.imgur.com/GHRyUMp.png) ## Nearest neighbor algorithm - ![](https://i.imgur.com/ZLShivf.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

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    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