File:JPEG example subimage - equalized.svg
来自testwiki
跳转到导航
跳转到搜索
此SVG文件的PNG预览的大小:400 × 400像素。 其他分辨率:240 × 240像素 | 480 × 480像素 | 768 × 768像素 | 1,024 × 1,024像素 | 2,048 × 2,048像素。
原始文件 (SVG文件,尺寸为400 × 400像素,文件大小:3 KB)
本文件来自维基共享资源并可能被其他项目使用。 其文件描述页上的描述显示在下面。
摘要
| 描述JPEG example subimage - equalized.svg | |
| 日期 | |
| 来源 |
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:
我,本作品著作权人,特此采用以下许可协议发表本作品:
| 已授权您依据自由软件基金会发行的无固定段落及封面封底文字(Invariant Sections, Front-Cover Texts, and Back-Cover Texts)的GNU自由文件许可协议1.2版或任意后续版本的条款,复制、传播和/或修改本文件。该协议的副本请见“GNU Free Documentation License”。http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
| 本文件采用知识共享署名-相同方式共享 3.0 未本地化版本许可协议授权。 | ||
| ||
| 本许可协议标签作为GFDL许可协议更新的组成部分被添加至本文件。http://creativecommons.org/licenses/by-sa/3.0/CC BY-SA 3.0Creative Commons Attribution-Share Alike 3.0truetrue |
您可以选择您需要的许可协议。
Source code is licensed under the GPL version 2:
我,本作品著作权人,特此采用以下许可协议发表本作品:
| 本作品为自由软件,您可以在自由软件基金会出版的GNU通用公共许可证第2版条款下再分发和/或修改本作品。分发本作品是希望它能有用,但没有任何担保,甚至没有隐含的销售或对于特定目的的适应性的担保。详见GNU通用公共许可证第2版正文。 GNU General Public License v2GPLv2https://www.gnu.org/licenses/old-licenses/gpl-2.0.htmltrue |
说明
添加一行文字以描述该文件所表现的内容
此文件中描述的项目
描繪內容
3 1 2008
image/svg+xml
3,336 字节
文件历史
点击某个日期/时间查看对应时刻的文件。
| 日期/时间 | 缩略图 | 大小 | 用户 | 备注 | |
|---|---|---|---|---|---|
| 当前 | 2022年10月23日 (日) 14:16 | 400 × 400(3 KB) | wikimediacommons>Smasongarrison | seems to have passed the validation check after slimmed down with svgomg // Editing SVG source code using c:User:Rillke/SVGedit.js |
文件用途
以下页面使用本文件: