File:JPEG example subimage - equalized.svg

頁面內容不支援其他語言。
這個檔案來自維基共享資源
維基百科,自由的百科全書

原始檔案(SVG 檔案,表面大小:400 × 400 像素,檔案大小:3 KB)


摘要

描述
English: 8x8 pixel subimage used as an example for JPEG that has been histogram equalization.
日期
來源

Own work in Inkscape

作者 en:User:Cburnett
授權許可
(重用此檔案)
GFDL (image); GPL (source code)
其他版本 Image:JPEG example subimage.svg — Non-equalized image

Source code

I generated the normalized data by writing a simple python script:

import math

img = [
    [52, 55, 61,  66,  70,  61, 64, 73],
    [63, 59, 55,  90, 109,  85, 69, 72],
    [62, 59, 68, 113, 144, 104, 66, 73],
    [63, 58, 71, 122, 154, 106, 70, 69],
    [67, 61, 68, 104, 126,  88, 68, 70],
    [79, 65, 60,  70,  77,  68, 58, 75],
    [85, 71, 64,  59,  55,  61, 65, 83],
    [87, 79, 69,  68,  65,  76, 78, 94]
]

# Number of pixels
N = len(img) * len(img[0])

# Initialize histogram and cumulative distribution function (cdf)
hist = {}
cdf = {}
norm_cdf = {}
for i in range(255):
    hist[i] = 0
    cdf[i] = 0
    norm_cdf[i] = 0

# Create histogram
for row in img:
    for val in row:
        hist[val] += 1

# Create cdf
for i in range(255):
    for j in range(i+1):
        cdf[i] += hist[j]
    norm_cdf[i] = int(math.floor(float(cdf[i]-1)/63*255))

newimg = [
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0]
]

for i in range(8):
    for j in range(8):
        newimg[i][j] = norm_cdf[ img[i][j] ]

print '+-------+-----------+-----+----------------+'
print '| %5s | %9s | %3s | %14s |' % ('Value', 'Histogram', 'cdf', 'Normalized cdf')
print '+-------+-----------+-----+----------------+'
for i in range(255):
    if hist[i] == 0: continue
    print '| %5s | %9s | %3s | %14s |' % (i, hist[i], cdf[i], norm_cdf[i])
print '+-------+-----------+-----+----------------+'

print ''
print 'Original subimage:'
print ''
for i in range(8):
    print ('%4d'*8) % tuple(img[i])

print ''
print ''
print 'Equalized subimage:'
print ''

for i in range(8):
    print ('%4d'*8) % tuple(newimg[i])

Sample output:

+-------+-----------+-----+----------------+
| Value | Histogram | cdf | Normalized cdf |
+-------+-----------+-----+----------------+
|    52 |         1 |   1 |              0 |
|    55 |         3 |   4 |             12 |
|    58 |         2 |   6 |             20 |
|    59 |         3 |   9 |             32 |
|    60 |         1 |  10 |             36 |
|    61 |         4 |  14 |             52 |
|    62 |         1 |  15 |             56 |
|    63 |         2 |  17 |             64 |
|    64 |         2 |  19 |             72 |
|    65 |         3 |  22 |             85 |
|    66 |         2 |  24 |             93 |
|    67 |         1 |  25 |             97 |
|    68 |         5 |  30 |            117 |
|    69 |         3 |  33 |            129 |
|    70 |         4 |  37 |            145 |
|    71 |         2 |  39 |            153 |
|    72 |         1 |  40 |            157 |
|    73 |         2 |  42 |            165 |
|    75 |         1 |  43 |            170 |
|    76 |         1 |  44 |            174 |
|    77 |         1 |  45 |            178 |
|    78 |         1 |  46 |            182 |
|    79 |         2 |  48 |            190 |
|    83 |         1 |  49 |            194 |
|    85 |         2 |  51 |            202 |
|    87 |         1 |  52 |            206 |
|    88 |         1 |  53 |            210 |
|    90 |         1 |  54 |            214 |
|    94 |         1 |  55 |            218 |
|   104 |         2 |  57 |            226 |
|   106 |         1 |  58 |            230 |
|   109 |         1 |  59 |            234 |
|   113 |         1 |  60 |            238 |
|   122 |         1 |  61 |            242 |
|   126 |         1 |  62 |            246 |
|   144 |         1 |  63 |            250 |
|   154 |         1 |  64 |            255 |
+-------+-----------+-----+----------------+

Original subimage:

  52  55  61  66  70  61  64  73
  63  59  55  90 109  85  69  72
  62  59  68 113 144 104  66  73
  63  58  71 122 154 106  70  69
  67  61  68 104 126  88  68  70
  79  65  60  70  77  68  58  75
  85  71  64  59  55  61  65  83
  87  79  69  68  65  76  78  94

Equalized subimage:

   0  12  52  93 145  52  72 165
  64  32  12 214 234 202 129 157
  56  32 117 238 250 226  93 165
  64  20 153 242 255 230 145 129
  97  52 117 226 246 210 117 145
 190  85  36 145 178 117  20 170
 202 153  72  32  12  52  85 194
 206 190 129 117  85 174 182 218

授權條款

Image is licensed under the GFDL:

我,本作品的著作權持有者,決定用以下授權條款發佈本作品:
GNU head 已授權您依據自由軟體基金會發行的無固定段落、封面文字和封底文字GNU自由文件授權條款1.2版或任意後續版本,對本檔進行複製、傳播和/或修改。該協議的副本列在GNU自由文件授權條款中。
w:zh:共享創意
姓名標示 相同方式分享
此檔案採用共享創意 姓名標示-相同方式分享 3.0 未在地化版本授權條款。
您可以自由:
  • 分享 – 複製、發佈和傳播本作品
  • 重新修改 – 創作演繹作品
惟需遵照下列條件:
  • 姓名標示 – 您必須指名出正確的製作者,和提供授權條款的連結,以及表示是否有對內容上做出變更。您可以用任何合理的方式來行動,但不得以任何方式表明授權條款是對您許可或是由您所使用。
  • 相同方式分享 – 如果您利用本素材進行再混合、轉換或創作,您必須基於如同原先的相同或兼容的條款,來分布您的貢獻成品。
已新增授權條款標題至此檔案,作為GFDL授權更新的一部份。
您可以選擇您需要的授權條款。

Source code is licensed under the GPL version 2:

我,本作品的著作權持有者,決定用以下授權條款發佈本作品:
GNU head This work is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2. This work is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See version 2 of the GNU General Public License for more details.

說明

添加單行說明來描述出檔案所代表的內容

在此檔案描寫的項目

描繪內容

著作權狀態 繁體中文 (已轉換拼寫)

有著作權 繁體中文 (已轉換拼寫)

共享創意署名-相同方式共享3.0Unported Chinese (Hong Kong) (已轉換拼寫)

GNU通用公眾特許條款2.0版 Chinese (Hong Kong) (已轉換拼寫)

GNU自由文檔許可證1.2或更高版本 繁體中文 (已轉換拼寫)

多媒體型式 繁體中文 (已轉換拼寫)

image/svg+xml

檔案歷史

點選日期/時間以檢視該時間的檔案版本。

日期/時間縮⁠圖尺寸用戶備⁠註
目前2022年10月23日 (日) 13:16於 2022年10月23日 (日) 13:16 版本的縮圖400 × 400(3 KB)Smasongarrisonseems to have passed the validation check after slimmed down with svgomg // Editing SVG source code using c:User:Rillke/SVGedit.js
2008年1月4日 (五) 00:55於 2008年1月4日 (五) 00:55 版本的縮圖400 × 400(22 KB)Cburnett{{Information |Description={{en|8x8 pixel subimage used as an example for JPEG that has been histogram equalization.}} |Source=Own work in Inkscape |Date=January 3, 2008 |Author=en:User:Cburnett |Pe

下列頁面有用到此檔案:

全域檔案使用狀況

以下其他 wiki 使用了這個檔案:

詮釋資料