├── .gitattributes
├── .gitignore
├── .idea
├── .gitignore
├── ImgPractice.iml
├── deployment.xml
├── dictionaries
│ └── Administrator.xml
├── inspectionProfiles
│ ├── Project_Default.xml
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── other.xml
└── vcs.xml
├── README.md
├── external
└── histogram_match.py
├── folder.ini
├── image_data
├── DIP3E_CH03_Original_Images.zip
├── DIP3E_CH09_Original_Images.zip
├── DIP3E_CH11_Original_Images
│ ├── Fig1105(a)(noisy_stroke).tif
│ ├── Fig1108(a)(mapleleaf).tif
│ ├── Fig1111(a)(triangle).tif
│ ├── Fig1111(b)(square).tif
│ ├── Fig1116(leg_bone).tif
│ ├── Fig1120(a)(chromosome_boundary).tif
│ ├── Fig1122(1)(top-canada).tif
│ ├── Fig1122(2)(2nd-from-top-USA).tif
│ ├── Fig1122(3)(3rd-from-top-Central-Amer).tif
│ ├── Fig1122(4)(4th-from-top-South-Amer).tif
│ ├── Fig1127(a)(WashingtonDC Band4).tif
│ ├── Fig1128(a)(superconductor-smooth-texture)-DO NOT SEND.tif
│ ├── Fig1128(b)(cholesterol-rough-texture)-DO NOT SEND.tif
│ ├── Fig1128(c)(microporcessor-regular texture)-DO NOT SEND.tif
│ ├── Fig1130(a)(uniform_noise).tif
│ ├── Fig1130(b)(sinusoidal).tif
│ ├── Fig1130(c)(cktboard_section).tif
│ ├── Fig1135(a)(random_matches).tif
│ ├── Fig1135(b)(ordered_matches).tif
│ ├── Fig1137(a)(painting_original_padded).tif
│ ├── Fig1137(b)(painting_translated_padded).tif
│ ├── Fig1137(c)(painting_halfsize_padded).tif
│ ├── Fig1137(d)(painting_mirrored_padded).tif
│ ├── Fig1137(e)(painting_rot45deg).tif
│ ├── Fig1137(f)(painting_rot90deg_padded).tif
│ ├── Fig1138(a)(WashingtonDC_Band1_564).tif
│ ├── Fig1138(b)(WashingtonDC_Band2_564).tif
│ ├── Fig1138(c)(WashingtonDC_Band3_564).tif
│ ├── Fig1138(d)(WashingtonDC_Band4_564).tif
│ ├── Fig1138(e)(WashingtonDC_Band5_564).tif
│ ├── Fig1138(f)(WashingtonDC_Band6_564).tif
│ ├── FigP1126(bottles).tif
│ └── FigP1127(bubbles).tif
├── DIP3E_Original_Images_CH03
│ ├── 0_README.txt
│ ├── Fig0304(a)(breast_digital_Xray).tif
│ ├── Fig0305(a)(DFT_no_log).tif
│ ├── Fig0307(a)(intensity_ramp).tif
│ ├── Fig0308(a)(fractured_spine).tif
│ ├── Fig0309(a)(washed_out_aerial_image).tif
│ ├── Fig0310(b)(washed_out_pollen_image).tif
│ ├── Fig0312(a)(kidney).tif
│ ├── Fig0314(a)(100-dollars).tif
│ ├── Fig0316(1)(top_left).tif
│ ├── Fig0316(2)(2nd_from_top).tif
│ ├── Fig0316(3)(third_from_top).tif
│ ├── Fig0316(4)(bottom_left).tif
│ ├── Fig0320(1)(top_left).tif
│ ├── Fig0320(2)(2nd_from_top).tif
│ ├── Fig0320(3)(third_from_top).tif
│ ├── Fig0320(4)(bottom_left).tif
│ ├── Fig0323(a)(mars_moon_phobos).tif
│ ├── Fig0326(a)(embedded_square_noisy_512).tif
│ ├── Fig0327(a)(tungsten_original).tif
│ ├── Fig0333(a)(test_pattern_blurring_orig).tif
│ ├── Fig0334(a)(hubble-original).tif
│ ├── Fig0335(a)(ckt_board_saltpep_prob_pt05).tif
│ ├── Fig0338(a)(blurry_moon).tif
│ ├── Fig0340(a)(dipxe_text).tif
│ ├── Fig0342(a)(contact_lens_original).tif
│ ├── Fig0343(a)(skeleton_orig).tif
│ ├── Fig0354(a)(einstein_orig).tif
│ └── Fig0359(a)(headCT_Vandy).tif
├── DIP3E_Original_Images_CH04
│ ├── Fig0417(a)(barbara).tif
│ ├── Fig0418(a)(ray_traced_bottle_original).tif
│ ├── Fig0419(a)(text_gaps_of_1_and_2_pixels).tif
│ ├── Fig0421(car_newsprint_sampled_at_75DPI).tif
│ ├── Fig0422(newspaper_shot_woman).tif
│ ├── Fig0424(a)(rectangle).tif
│ ├── Fig0425(a)(translated_rectangle).tif
│ ├── Fig0427(a)(woman).tif
│ ├── Fig0429(a)(blown_ic).tif
│ ├── Fig0431(d)(blown_ic_crop).tif
│ ├── Fig0432(a)(square_original).tif
│ ├── Fig0438(a)(bld_600by600).tif
│ ├── Fig0441(a)(characters_test_pattern).tif
│ ├── Fig0442(a)(characters_test_pattern).tif
│ ├── Fig0445(a)(characters_test_pattern).tif
│ ├── Fig0448(a)(characters_test_pattern).tif
│ ├── Fig0450(a)(woman_original).tif
│ ├── Fig0451(a)(satellite_original).tif
│ ├── Fig0457(a)(thumb_print).tif
│ ├── Fig0458(a)(blurry_moon).tif
│ ├── Fig0459(a)(orig_chest_xray).tif
│ ├── Fig0462(a)(PET_image).tif
│ ├── Fig0464(a)(car_75DPI_Moire).tif
│ ├── Fig0465(a)(cassini).tif
│ ├── FigP0421(left)(padded_image).tif
│ ├── FigP0421(right)(center-padded_image).tif
│ ├── FigP0433(left)(DIP_image).tif
│ ├── FigP0436(left)(hand_xray).tif
│ └── FigP0438(left).tif
├── DIP3E_Original_Images_CH09
│ ├── .ipynb_checkpoints
│ │ └── 未命名-checkpoint.ipynb
│ ├── 20140307142628203.png
│ ├── Fig0905(a)(wirebond-mask).tif
│ ├── Fig0907(a)(text_gaps_1_and_2_pixels).tif
│ ├── Fig0911(a)(noisy_fingerprint).png
│ ├── Fig0911(a)(noisy_fingerprint).tif
│ ├── Fig0914(a)(licoln from penny).png
│ ├── Fig0914(a)(licoln from penny).tif
│ ├── Fig0916(a)(region-filling-reflections).tif
│ ├── Fig0918(a)(Chickenfilet with bones).tif
│ ├── Fig0929(a)(text_image).tif
│ ├── Fig0931(a)(text_image).tif
│ ├── Fig0935(a)(ckt_board_section).tif
│ ├── Fig0937(a)(ckt_board_section).tif
│ ├── Fig0938(a)(cygnusloop_Xray_original).tif
│ ├── Fig0939(a)(headCT-Vandy).tif
│ ├── Fig0940(a)(rice_image_with_intensity_gradient).tif
│ ├── Fig0941(a)(wood_dowels).tif
│ ├── Fig0943(a)(dark_blobs_on_light_background).tif
│ ├── Fig0944(a)(calculator).tif
│ ├── FigP0905(U).tif
│ ├── FigP0917(noisy_rectangle).tif
│ ├── FigP0918(left).tif
│ ├── FigP0919(UTK).tif
│ ├── FigP0934(blobs_in_circular_arrangement).tif
│ ├── FigP0936(bubbles_on_black_background).tif
│ ├── 击中集合A.png
│ └── 未命名.ipynb
├── DIP3E_Original_Images_CH10
│ ├── Fig1001(a)(constant_gray_region).tif
│ ├── Fig1001(b)(edge_image).tif
│ ├── Fig1001(c)(thresholded_image).tif
│ ├── Fig1001(d)(noisy_region).tif
│ ├── Fig1001(e)(edge_noisy_image).tif
│ ├── Fig1001(f)(region_split_merge_image).tif
│ ├── Fig1004(b)(turbine_blade_black_dot).tif
│ ├── Fig1005(a)(wirebond_mask).tif
│ ├── Fig1007(a)(wirebond_mask).tif
│ ├── Fig1008(a)(step edge).tif
│ ├── Fig1008(b)(ramp edge).tif
│ ├── Fig1008(c)(roof_edge).tif
│ ├── Fig1016(a)(building_original).tif
│ ├── Fig1022(a)(building_original).tif
│ ├── Fig1025(a)(building_original).tif
│ ├── Fig1026(a)(headCT-Vandy).tif
│ ├── Fig1027(a)(van_original).tif
│ ├── Fig1030(a)(tooth).tif
│ ├── Fig1034(a)(marion_airport).tif
│ ├── Fig1036(a)(original_septagon).tif
│ ├── Fig1036(b)(gaussian_noise_mean_0_std_10_added).tif
│ ├── Fig1036(c)(gaussian_noise_mean_0_std_50_added).tif
│ ├── Fig1037(a)(septagon_gaussian_noise_mean_0_std_10_added).tif
│ ├── Fig1037(b)(intensity_ramp).tif
│ ├── Fig1038(a)(noisy_fingerprint).tif
│ ├── Fig1039(a)(polymersomes).tif
│ ├── Fig1040(a)(large_septagon_gaussian_noise_mean_0_std_50_added).tif
│ ├── Fig1041(a)(septagon_small_noisy_mean_0_stdv_10).tif
│ ├── Fig1042(a)(septagon_small_noisy_mean_0_stdv_10).tif
│ ├── Fig1043(a)(yeast_USC).tif
│ ├── Fig1045(a)(iceberg).tif
│ ├── Fig1046(a)(septagon_noisy_shaded).tif
│ ├── Fig1048(a)(yeast_USC).tif
│ ├── Fig1049(a)(spot_shaded_text_image).tif
│ ├── Fig1050(a)(sine_shaded_text_image).tif
│ ├── Fig1051(a)(defective_weld).tif
│ ├── Fig1053(a)(cygnusloop_Xray_original).tif
│ ├── Fig1056(a)(blob_original).tif
│ ├── Fig1057(a)(small_blobs-original).tif
│ ├── Fig1059(a)(AbsADI).tif
│ ├── Fig1059(b)(PosADI).tif
│ ├── Fig1059(c)(NegADI).tif
│ ├── Fig1060(a)(car on left).tif
│ ├── Fig1060(b)(car on right).tif
│ ├── Fig1060(c)(car removed).tif
│ ├── Fig1061(LANDSAT_with moving target).tif
│ └── FigP1036(blobs).tif
├── folder.ini
└── 数据地址.txt
├── notebooks
├── 图像分割.ipynb
├── 图像表示与描述.ipynb
├── 形态学.ipynb
├── 灰度变换与空间滤波.ipynb
└── 频率域滤波.ipynb
├── src
├── __init__.py
├── chapter10
│ ├── __init__.py
│ └── edge_connect
│ │ ├── __init__.py
│ │ └── local_connect.py
├── chapter11
│ ├── __init__.py
│ ├── font_img_skeleton_feature.py
│ ├── freeman_code.py
│ ├── mark_sheet.py
│ ├── mat.py
│ ├── moment_invariants.py
│ ├── shape_number.py
│ └── texture.py
├── chapter3
│ ├── __init__.py
│ └── hist_local_enhance.py
├── chapter4
│ ├── __init__.py
│ └── frequency_dommain.py
├── chapter9
│ ├── __init__.py
│ └── morphology.py
└── morphology.py
└── tests
├── __init__.py
├── chapter10
├── __init__.py
└── edge_connect
│ ├── 1863694-20191206105727406-2050307115.jpg
│ ├── Fig1137(d)(painting_mirrored_padded).tif
│ ├── __init__.py
│ └── test_local_connect.py
├── chapter11
├── __init__.py
├── test_freeman_code.py
├── test_mark_sheet.py
├── test_moment_invariants.py
├── test_shape_number.py
└── test_texture.py
└── chapter3
└── __init__.py
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.html linguist-language=python
2 | *.h linguist-language=python
3 | *.m linguist-language=python
4 | *.ipynb linguist-language=python
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | share/python-wheels/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 | MANIFEST
28 |
29 | # PyInstaller
30 | # Usually these files are written by a python script from a template
31 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
32 | *.manifest
33 | *.spec
34 |
35 | # Installer logs
36 | pip-log.txt
37 | pip-delete-this-directory.txt
38 |
39 | # Unit test / coverage reports
40 | htmlcov/
41 | .tox/
42 | .nox/
43 | .coverage
44 | .coverage.*
45 | .cache
46 | nosetests.xml
47 | coverage.xml
48 | *.cover
49 | *.py,cover
50 | .hypothesis/
51 | .pytest_cache/
52 | cover/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | .pybuilder/
76 | target/
77 |
78 | # Jupyter Notebook
79 | .ipynb_checkpoints
80 |
81 | # IPython
82 | profile_default/
83 | ipython_config.py
84 |
85 | # pyenv
86 | # For a library or package, you might want to ignore these files since the code is
87 | # intended to run in multiple environments; otherwise, check them in:
88 | # .python-version
89 |
90 | # pipenv
91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
94 | # install all needed dependencies.
95 | #Pipfile.lock
96 |
97 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
98 | __pypackages__/
99 |
100 | # Celery stuff
101 | celerybeat-schedule
102 | celerybeat.pid
103 |
104 | # SageMath parsed files
105 | *.sage.py
106 |
107 | # Environments
108 | .env
109 | .venv
110 | env/
111 | venv/
112 | ENV/
113 | env.bak/
114 | venv.bak/
115 |
116 | # Spyder project settings
117 | .spyderproject
118 | .spyproject
119 |
120 | # Rope project settings
121 | .ropeproject
122 |
123 | # mkdocs documentation
124 | /site
125 |
126 | # mypy
127 | .mypy_cache/
128 | .dmypy.json
129 | dmypy.json
130 |
131 | # Pyre type checker
132 | .pyre/
133 |
134 | # pytype static type analyzer
135 | .pytype/
136 |
137 | # Cython debug symbols
138 | cython_debug/
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Datasource local storage ignored files
5 | /dataSources/
6 | /dataSources.local.xml
7 | # Editor-based HTTP Client requests
8 | /httpRequests/
9 |
--------------------------------------------------------------------------------
/.idea/ImgPractice.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/deployment.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.idea/dictionaries/Administrator.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ndarray
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
34 |
35 |
36 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/other.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Image-Process
2 | 闲暇之余对《数字图像处理》的实现,欢迎Star
3 |
4 | ------
5 |
6 | 冈萨雷斯《数字图像处理》Python实现(第三版)
7 |
8 | 个人技术博客:http://www.zhangqi2019.top/
9 |
10 | **本书预览地址:http://www.ailearndo.com/resource/数字图像处理(冈萨雷斯版).pdf**
11 |
12 | ## 第3章 灰度变换与空间滤波
13 |
14 | | | 实现代码 | Demo | 算法说明 |
15 | | -------------- | ---------------------------------------------------- | ------------------------------------------------------------ | -------- |
16 | | 局部直方图均衡 | | [局部直方图均衡](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E7%81%B0%E5%BA%A6%E5%8F%98%E6%8D%A2%E4%B8%8E%E7%A9%BA%E9%97%B4%E6%BB%A4%E6%B3%A2.ipynb#局部直方图均衡) | |
17 | | 直方图局部增强 | [直方图局部增强](src/chapter3/hist_local_enhance.py) | [直方图局部增强](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E7%81%B0%E5%BA%A6%E5%8F%98%E6%8D%A2%E4%B8%8E%E7%A9%BA%E9%97%B4%E6%BB%A4%E6%B3%A2.ipynb#局部直方图增强) | |
18 |
19 | ## 第4章 频率域滤波
20 |
21 | 频域章重在理解傅里叶变换和频域的思想,以下是对傅里叶和奈奎斯特定理的总结:
22 |
23 | * [傅里叶变换推导](https://www.zhangqi2019.top/posts/fb91b52c.html/)
24 | * [奈奎斯特定理推导](https://www.zhangqi2019.top/posts/88a0752c.html/)
25 |
26 | 实现包括以下内容:
27 |
28 | | | 实现代码 | Demo | 算法说明 |
29 | | ------------ | -------- | ------------------------------------------------------------ | -------- |
30 | | 图像重取样 | | [图像重取样](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E9%A2%91%E7%8E%87%E5%9F%9F%E6%BB%A4%E6%B3%A2.ipynb#图像重取样) | |
31 | | 傅里叶谱 | | [傅里叶谱](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E9%A2%91%E7%8E%87%E5%9F%9F%E6%BB%A4%E6%B3%A2.ipynb#傅里叶谱) | |
32 | | 直通分量置零 | | [直通分量置零](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E9%A2%91%E7%8E%87%E5%9F%9F%E6%BB%A4%E6%B3%A2.ipynb#直流分量置0) | |
33 | | 同态滤波 |[同态滤波](src/chapter4/frequency_dommain.py)| | |
34 |
35 |
36 |
37 | ## 第9章 形态学
38 |
39 | 以下形态学的Demo说明见:http://www.zhangqi2019.top/posts/c1f4dbab.html/
40 |
41 | 实现包括以下内容:
42 |
43 | | | 实现代码 | Demo | 算法说明 |
44 | | --------------------- | ------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
45 | | 腐蚀 | | [腐蚀](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#腐蚀) | [腐蚀](https://www.zhangqi2019.top/posts/c1f4dbab.html/#腐蚀) |
46 | | 膨胀 | | [膨胀](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#膨胀) | [膨胀](https://www.zhangqi2019.top/posts/c1f4dbab.html/#膨胀) |
47 | | 开操作 | | [开操作](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#开操作和闭操作) | [开操作](https://www.zhangqi2019.top/posts/c1f4dbab.html/#开操作和闭操作) |
48 | | 闭操作 | | [闭操作](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#开操作和闭操作) | [闭操作](https://www.zhangqi2019.top/posts/c1f4dbab.html/#开操作和闭操作) |
49 | | 击中以及不击中 | [击中和不击中](src/chapter9/morphology.py) | [击中以及不击中](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#击中和不击中) | [击中以及不击中](https://www.zhangqi2019.top/posts/c1f4dbab.html/#击中以及不击中) |
50 | | 边界提取 | | [边界提取](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#边界提取) | [边界提取](https://www.zhangqi2019.top/posts/c1f4dbab.html/#边界提取) |
51 | | 连通分量提取 | [连通分量提取](src/chapter9/morphology.py) | [连通分量提取](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#连通分量提取) | [连通分量提取](https://www.zhangqi2019.top/posts/c1f4dbab.html/#连通分量提取) |
52 | | 孔洞填充 | [孔洞填充](src/chapter9/morphology.py) | [孔洞填充](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#孔洞填充) | [孔洞填充](https://www.zhangqi2019.top/posts/c1f4dbab.html/#孔洞填充) |
53 | | 形态学重建-重建开操作 | [重建开操作](src/chapter9/morphology.py) | [形态学重建 -重建开操作](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#重建开操作) | [重建开操作](https://www.zhangqi2019.top/posts/c1f4dbab.html/#重建开操作) |
54 | | 灰度形态学-灰度腐蚀 | | [灰度级形态学- 灰度腐蚀](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#灰度腐蚀) | [灰度腐蚀](https://www.zhangqi2019.top/posts/c1f4dbab.html/#灰度腐蚀) |
55 | | 灰度形态学-灰度膨胀 | | [灰度级形态学-灰度膨胀](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#灰度膨胀) | [灰度膨胀](https://www.zhangqi2019.top/posts/c1f4dbab.html/#灰度膨胀) |
56 | | 灰度形态学-灰度开操作 | | [灰度级形态学-灰度开操作](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#灰度开操作) | [灰度开操作和闭操作](https://www.zhangqi2019.top/posts/c1f4dbab.html/#灰度开操作和闭操作) |
57 | | 灰度形态学-灰度闭操作 | | [灰度级形态学-灰度闭操作](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#灰度闭操作) | [灰度开操作和闭操作](https://www.zhangqi2019.top/posts/c1f4dbab.html/#灰度开操作和闭操作) |
58 | | 形态学梯度 | | [形态学梯度](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#形态学梯度) | [形态学梯度](https://www.zhangqi2019.top/posts/c1f4dbab.html/#形态学梯度) |
59 | | 顶帽操作 | | [顶帽操作](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#顶帽操作) | [顶帽和底帽变换](https://www.zhangqi2019.top/posts/c1f4dbab.html/#顶帽和底帽变换) |
60 | | 形态学纹理分割 | | [形态学纹理分割](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%BD%A2%E6%80%81%E5%AD%A6.ipynb#形态学纹理分割) | [纹理分割](https://www.zhangqi2019.top/posts/c1f4dbab.html/#纹理分割) |
61 |
62 | ## 第10章 图像分割
63 |
64 | | | 实现源码 | Demo | 算法说明 |
65 | | ------------------------- | -------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
66 | | 孤立点检测 | | [孤立点检测](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%9B%BE%E5%83%8F%E5%88%86%E5%89%B2.ipynb) | [孤立点检测](https://www.zhangqi2019.top/posts/d2113c07.html/#孤立点检测) |
67 | | 线检测 | | [孤立点检测](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%9B%BE%E5%83%8F%E5%88%86%E5%89%B2.ipynb) | [线检测](https://www.zhangqi2019.top/posts/d2113c07.html/#线检测) |
68 | | 简单边缘模型(Sobel检测) | | [Sobel边缘检测](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%9B%BE%E5%83%8F%E5%88%86%E5%89%B2.ipynb#基本检测模型(Sobel)) | [Sobel边缘检测](https://www.zhangqi2019.top/posts/d2113c07.html/#基本的检测模型) |
69 |
70 |
71 |
72 | ## 第11章 表示和描述
73 |
74 | Demo汇总: [Demo汇总](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/图像表示与描述.ipynb)
75 |
76 | 本章算法说明汇总:https://www.zhangqi2019.top/posts/d4747641.html/
77 |
78 | 算法实现包括以下:
79 |
80 | | | 实现源码 | Demo | 算法说明 |
81 | | --------------------- | ------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
82 | | Moore边界追踪 | | | [Moore说明](https://www.zhangqi2019.top/posts/d4747641.html/#%E8%BE%B9%E7%95%8C%E8%BF%BD%E8%B8%AA%EF%BC%88Moore%E8%BE%B9%E7%95%8C%E8%BF%BD%E8%B8%AA%EF%BC%89) |
83 | | Freeman链码 | [Freeman实现代码](src/chapter11/freeman_code.py) | [Freeman链码Demo](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%9B%BE%E5%83%8F%E8%A1%A8%E7%A4%BA%E4%B8%8E%E6%8F%8F%E8%BF%B0.ipynb#Freeman链码) | [Freeman链码](https://www.zhangqi2019.top/posts/d4747641.html/#%E9%93%BE%E7%A0%81) |
84 | | 标记图 | [标记图实现代码](src/chapter11/mark_sheet.py) | [标记图Demo](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%9B%BE%E5%83%8F%E8%A1%A8%E7%A4%BA%E4%B8%8E%E6%8F%8F%E8%BF%B0.ipynb#标记图) | [标记图](https://www.zhangqi2019.top/posts/d4747641.html/#%E9%93%BE%E7%A0%81) |
85 | | 骨架算法 | [骨架算法实现代码](src/chapter11/mat.py) | [骨架算法Demo](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%9B%BE%E5%83%8F%E8%A1%A8%E7%A4%BA%E4%B8%8E%E6%8F%8F%E8%BF%B0.ipynb#骨架) | [骨架](https://www.zhangqi2019.top/posts/d4747641.html/#%E9%AA%A8%E6%9E%B6) |
86 | | 形状数 | [形状数实现](src/chapter11/shape_number.py) | [形状数Demo](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%9B%BE%E5%83%8F%E8%A1%A8%E7%A4%BA%E4%B8%8E%E6%8F%8F%E8%BF%B0.ipynb#形状数) | [形状数](https://www.zhangqi2019.top/posts/d4747641.html/#%E5%BD%A2%E7%8A%B6%E6%95%B0) |
87 | | 灰度共生矩阵 | [灰度共生矩阵](src/chapter11/texture.py) | [灰度共生矩阵Demo](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%9B%BE%E5%83%8F%E8%A1%A8%E7%A4%BA%E4%B8%8E%E6%8F%8F%E8%BF%B0.ipynb#灰度共生矩阵) | |
88 | | 灰度共生矩阵描述子 | [灰度共生矩阵描述子](src/chapter11/texture.py) | [灰度共生矩阵描述子Demo](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%9B%BE%E5%83%8F%E8%A1%A8%E7%A4%BA%E4%B8%8E%E6%8F%8F%E8%BF%B0.ipynb#灰度共生矩阵描述子) | |
89 | | $n$步共生矩阵相关系数 | [n步共生矩阵相关系数](src/chapter11/texture.py) | [灰度共生矩阵描述子Demo](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%9B%BE%E5%83%8F%E8%A1%A8%E7%A4%BA%E4%B8%8E%E6%8F%8F%E8%BF%B0.ipynb#n跳共生矩阵组成的序列图像) | |
90 | | 不变矩 | [不变矩](src/chapter11/moment_invariants.py) | [不变矩Demo](https://nbviewer.jupyter.org/github/qcymkxyc/Image-Process/blob/master/notebooks/%E5%9B%BE%E5%83%8F%E8%A1%A8%E7%A4%BA%E4%B8%8E%E6%8F%8F%E8%BF%B0.ipynb#不变矩) | |
91 |
92 |
--------------------------------------------------------------------------------
/external/histogram_match.py:
--------------------------------------------------------------------------------
1 | import os
2 | import cv2
3 | import numpy as np
4 |
5 |
6 | def get_map(Hist) -> np.ndarray:
7 | """求直方图均衡的映射表
8 | :param Hist: 图像直方图
9 | :return np.ndarray, 映射表
10 | """
11 | """归一化,即计算概率"""
12 | sum_Hist = sum(Hist)
13 | Pr = Hist / sum_Hist
14 |
15 | """计算累积概率"""
16 | Sk = []
17 | temp_sum = 0
18 | for n in Pr:
19 | temp_sum = temp_sum + n
20 | Sk.append(temp_sum)
21 | Sk = np.array(Sk)
22 |
23 | """计算映射表"""
24 | img_map = []
25 | for m in range(256):
26 | temp_map = int(255 * Sk[m] + 0.5)
27 | img_map.append(temp_map)
28 | img_map = np.array(img_map)
29 | return img_map
30 |
31 |
32 | def get_off_map(map_): # 计算反向映射,寻找最小期望
33 | """建立反向映射表"""
34 | map_2 = list(map_)
35 | off_map = []
36 | temp_pre = 0 # 如果循环开始就找不到映射时,默认映射为0
37 | for n in range(256):
38 | try:
39 | temp1 = map_2.index(n)
40 | temp_pre = temp1
41 | except BaseException:
42 | temp1 = temp_pre # 找不到映射关系时,近似取向前最近的有效映射值
43 | off_map.append(temp1)
44 | off_map = np.array(off_map)
45 | return off_map
46 |
47 |
48 | def get_infer_map(infer_img) -> list:
49 | """"""
50 | """计算三个通道的直方图"""
51 | infer_Hist_b = cv2.calcHist([infer_img], [0], None, [256], [0, 255])
52 | infer_Hist_g = cv2.calcHist([infer_img], [1], None, [256], [0, 255])
53 | infer_Hist_r = cv2.calcHist([infer_img], [2], None, [256], [0, 255])
54 |
55 | """计算三个颜色的映射表"""
56 | infer_b_map = get_map(infer_Hist_b)
57 | infer_g_map = get_map(infer_Hist_g)
58 | infer_r_map = get_map(infer_Hist_r)
59 |
60 | """建立反向映射表"""
61 | infer_b_off_map = get_off_map(infer_b_map)
62 | infer_g_off_map = get_off_map(infer_g_map)
63 | infer_r_off_map = get_off_map(infer_r_map)
64 |
65 | return [infer_b_off_map, infer_g_off_map, infer_r_off_map]
66 |
67 |
68 | def get_finalmap(org_map, infer_off_map): # 计算原始图像到最终输出图像的映射关系
69 | org_map = list(org_map)
70 | infer_off_map = list(infer_off_map)
71 | final_map = []
72 | for n in range(256):
73 | temp1 = org_map[n]
74 | temp2 = infer_off_map[temp1]
75 | final_map.append(temp2)
76 | final_map = np.array(final_map)
77 | return final_map
78 |
79 |
80 | def get_newimg(img_org, org2infer_maps):
81 | """"""
82 | w, h, _ = img_org.shape
83 | b, g, r = cv2.split(img_org)
84 | for i in range(w):
85 | for j in range(h):
86 | temp1 = b[i, j]
87 | b[i, j] = org2infer_maps[0][temp1]
88 | for i in range(w):
89 | for j in range(h):
90 | temp1 = g[i, j]
91 | g[i, j] = org2infer_maps[1][temp1]
92 | for i in range(w):
93 | for j in range(h):
94 | temp1 = r[i, j]
95 | r[i, j] = org2infer_maps[2][temp1]
96 | newimg = cv2.merge([b, g, r])
97 | return newimg
98 |
99 |
100 | def get_new_img(img_org, infer_map):
101 | """"""
102 | """获取图片的直方图"""
103 | org_Hist_b = cv2.calcHist([img_org], [0], None, [256], [0, 255])
104 | org_Hist_g = cv2.calcHist([img_org], [1], None, [256], [0, 255])
105 | org_Hist_r = cv2.calcHist([img_org], [2], None, [256], [0, 255])
106 |
107 | """直方图映射表"""
108 | org_b_map = get_map(org_Hist_b)
109 | org_g_map = get_map(org_Hist_g)
110 | org_r_map = get_map(org_Hist_r)
111 |
112 | org2infer_map_b = get_finalmap(org_b_map, infer_map[0])
113 | org2infer_map_g = get_finalmap(org_g_map, infer_map[1])
114 | org2infer_map_r = get_finalmap(org_r_map, infer_map[2])
115 |
116 | return get_newimg(
117 | img_org, [org2infer_map_b, org2infer_map_g, org2infer_map_r])
118 |
119 |
120 | if __name__ == "__main__":
121 | dstroot = r'.\data'
122 | infer_img_path = r'.\0.jpg'
123 | infer_img = cv2.imread(infer_img_path)
124 | outroot = r'.\out1'
125 | infer_map = get_infer_map(infer_img) # 计算参考映射关系
126 | dstlist = os.listdir(dstroot)
127 | for n in dstlist:
128 | img_path = os.path.join(dstroot, n)
129 | print(img_path)
130 | img_org = cv2.imread(img_path)
131 | # TODO 待看
132 | new_img = get_new_img(img_org, infer_map) # 根据映射关系获得新的图像
133 | # cv2.imshow("image",new_img)
134 | # cv2.waitKey(0)
135 | new_path = os.path.join(outroot, n)
136 | print(new_path)
137 | cv2.imwrite(new_path, new_img)
138 | # cv2.destroyAllWindows(0)
139 |
--------------------------------------------------------------------------------
/folder.ini:
--------------------------------------------------------------------------------
1 | [State]
2 | Expanded=1
3 |
--------------------------------------------------------------------------------
/image_data/DIP3E_CH03_Original_Images.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH03_Original_Images.zip
--------------------------------------------------------------------------------
/image_data/DIP3E_CH09_Original_Images.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH09_Original_Images.zip
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1105(a)(noisy_stroke).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1105(a)(noisy_stroke).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1108(a)(mapleleaf).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1108(a)(mapleleaf).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1111(a)(triangle).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1111(a)(triangle).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1111(b)(square).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1111(b)(square).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1116(leg_bone).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1116(leg_bone).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1120(a)(chromosome_boundary).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1120(a)(chromosome_boundary).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1122(1)(top-canada).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1122(1)(top-canada).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1122(2)(2nd-from-top-USA).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1122(2)(2nd-from-top-USA).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1122(3)(3rd-from-top-Central-Amer).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1122(3)(3rd-from-top-Central-Amer).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1122(4)(4th-from-top-South-Amer).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1122(4)(4th-from-top-South-Amer).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1127(a)(WashingtonDC Band4).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1127(a)(WashingtonDC Band4).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1128(a)(superconductor-smooth-texture)-DO NOT SEND.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1128(a)(superconductor-smooth-texture)-DO NOT SEND.tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1128(b)(cholesterol-rough-texture)-DO NOT SEND.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1128(b)(cholesterol-rough-texture)-DO NOT SEND.tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1128(c)(microporcessor-regular texture)-DO NOT SEND.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1128(c)(microporcessor-regular texture)-DO NOT SEND.tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1130(a)(uniform_noise).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1130(a)(uniform_noise).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1130(b)(sinusoidal).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1130(b)(sinusoidal).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1130(c)(cktboard_section).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1130(c)(cktboard_section).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1135(a)(random_matches).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1135(a)(random_matches).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1135(b)(ordered_matches).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1135(b)(ordered_matches).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1137(a)(painting_original_padded).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1137(a)(painting_original_padded).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1137(b)(painting_translated_padded).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1137(b)(painting_translated_padded).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1137(c)(painting_halfsize_padded).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1137(c)(painting_halfsize_padded).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1137(d)(painting_mirrored_padded).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1137(d)(painting_mirrored_padded).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1137(e)(painting_rot45deg).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1137(e)(painting_rot45deg).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1137(f)(painting_rot90deg_padded).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1137(f)(painting_rot90deg_padded).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1138(a)(WashingtonDC_Band1_564).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1138(a)(WashingtonDC_Band1_564).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1138(b)(WashingtonDC_Band2_564).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1138(b)(WashingtonDC_Band2_564).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1138(c)(WashingtonDC_Band3_564).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1138(c)(WashingtonDC_Band3_564).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1138(d)(WashingtonDC_Band4_564).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1138(d)(WashingtonDC_Band4_564).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1138(e)(WashingtonDC_Band5_564).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1138(e)(WashingtonDC_Band5_564).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/Fig1138(f)(WashingtonDC_Band6_564).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/Fig1138(f)(WashingtonDC_Band6_564).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/FigP1126(bottles).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/FigP1126(bottles).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_CH11_Original_Images/FigP1127(bubbles).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_CH11_Original_Images/FigP1127(bubbles).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/0_README.txt:
--------------------------------------------------------------------------------
1 | **********************************************************
2 |
3 | Regarding Book Image Posted in the Book Web Site
4 |
5 | **********************************************************
6 |
7 | Only original images in tif format are posted in the Image
8 | Database section of the book web site. These are the images
9 | that you have just downloaded. No processed images, line
10 | drawings, or other types of graphics are posted. The idea
11 | is that posting the original images provides the necessary
12 | starting point to duplicate any image processing results
13 | in the book that are based on those images.
14 |
15 | The Classromm PowerPoint presentations (see Faculty tab in the
16 | book web site) do include ALL art in the book, but the resolution
17 | is not as good as with the original,individual images in the
18 | Image Database section of the book web site.
19 |
20 |
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0304(a)(breast_digital_Xray).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0304(a)(breast_digital_Xray).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0305(a)(DFT_no_log).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0305(a)(DFT_no_log).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0307(a)(intensity_ramp).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0307(a)(intensity_ramp).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0308(a)(fractured_spine).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0308(a)(fractured_spine).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0309(a)(washed_out_aerial_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0309(a)(washed_out_aerial_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0310(b)(washed_out_pollen_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0310(b)(washed_out_pollen_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0312(a)(kidney).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0312(a)(kidney).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0314(a)(100-dollars).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0314(a)(100-dollars).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0316(1)(top_left).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0316(1)(top_left).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0316(2)(2nd_from_top).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0316(2)(2nd_from_top).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0316(3)(third_from_top).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0316(3)(third_from_top).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0316(4)(bottom_left).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0316(4)(bottom_left).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0320(1)(top_left).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0320(1)(top_left).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0320(2)(2nd_from_top).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0320(2)(2nd_from_top).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0320(3)(third_from_top).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0320(3)(third_from_top).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0320(4)(bottom_left).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0320(4)(bottom_left).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0323(a)(mars_moon_phobos).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0323(a)(mars_moon_phobos).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0326(a)(embedded_square_noisy_512).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0326(a)(embedded_square_noisy_512).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0327(a)(tungsten_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0327(a)(tungsten_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0333(a)(test_pattern_blurring_orig).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0333(a)(test_pattern_blurring_orig).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0334(a)(hubble-original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0334(a)(hubble-original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0335(a)(ckt_board_saltpep_prob_pt05).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0335(a)(ckt_board_saltpep_prob_pt05).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0338(a)(blurry_moon).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0338(a)(blurry_moon).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0340(a)(dipxe_text).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0340(a)(dipxe_text).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0342(a)(contact_lens_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0342(a)(contact_lens_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0343(a)(skeleton_orig).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0343(a)(skeleton_orig).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0354(a)(einstein_orig).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0354(a)(einstein_orig).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH03/Fig0359(a)(headCT_Vandy).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH03/Fig0359(a)(headCT_Vandy).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0417(a)(barbara).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0417(a)(barbara).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0418(a)(ray_traced_bottle_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0418(a)(ray_traced_bottle_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0419(a)(text_gaps_of_1_and_2_pixels).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0419(a)(text_gaps_of_1_and_2_pixels).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0421(car_newsprint_sampled_at_75DPI).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0421(car_newsprint_sampled_at_75DPI).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0422(newspaper_shot_woman).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0422(newspaper_shot_woman).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0424(a)(rectangle).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0424(a)(rectangle).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0425(a)(translated_rectangle).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0425(a)(translated_rectangle).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0427(a)(woman).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0427(a)(woman).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0429(a)(blown_ic).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0429(a)(blown_ic).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0431(d)(blown_ic_crop).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0431(d)(blown_ic_crop).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0432(a)(square_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0432(a)(square_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0438(a)(bld_600by600).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0438(a)(bld_600by600).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0441(a)(characters_test_pattern).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0441(a)(characters_test_pattern).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0442(a)(characters_test_pattern).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0442(a)(characters_test_pattern).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0445(a)(characters_test_pattern).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0445(a)(characters_test_pattern).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0448(a)(characters_test_pattern).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0448(a)(characters_test_pattern).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0450(a)(woman_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0450(a)(woman_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0451(a)(satellite_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0451(a)(satellite_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0457(a)(thumb_print).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0457(a)(thumb_print).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0458(a)(blurry_moon).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0458(a)(blurry_moon).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0459(a)(orig_chest_xray).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0459(a)(orig_chest_xray).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0462(a)(PET_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0462(a)(PET_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0464(a)(car_75DPI_Moire).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0464(a)(car_75DPI_Moire).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/Fig0465(a)(cassini).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/Fig0465(a)(cassini).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/FigP0421(left)(padded_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/FigP0421(left)(padded_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/FigP0421(right)(center-padded_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/FigP0421(right)(center-padded_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/FigP0433(left)(DIP_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/FigP0433(left)(DIP_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/FigP0436(left)(hand_xray).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/FigP0436(left)(hand_xray).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH04/FigP0438(left).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH04/FigP0438(left).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/.ipynb_checkpoints/未命名-checkpoint.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [],
3 | "metadata": {},
4 | "nbformat": 4,
5 | "nbformat_minor": 4
6 | }
7 |
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/20140307142628203.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/20140307142628203.png
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0905(a)(wirebond-mask).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0905(a)(wirebond-mask).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0907(a)(text_gaps_1_and_2_pixels).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0907(a)(text_gaps_1_and_2_pixels).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0911(a)(noisy_fingerprint).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0911(a)(noisy_fingerprint).png
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0911(a)(noisy_fingerprint).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0911(a)(noisy_fingerprint).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0914(a)(licoln from penny).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0914(a)(licoln from penny).png
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0914(a)(licoln from penny).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0914(a)(licoln from penny).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0916(a)(region-filling-reflections).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0916(a)(region-filling-reflections).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0918(a)(Chickenfilet with bones).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0918(a)(Chickenfilet with bones).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0929(a)(text_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0929(a)(text_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0931(a)(text_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0931(a)(text_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0935(a)(ckt_board_section).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0935(a)(ckt_board_section).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0937(a)(ckt_board_section).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0937(a)(ckt_board_section).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0938(a)(cygnusloop_Xray_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0938(a)(cygnusloop_Xray_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0939(a)(headCT-Vandy).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0939(a)(headCT-Vandy).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0940(a)(rice_image_with_intensity_gradient).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0940(a)(rice_image_with_intensity_gradient).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0941(a)(wood_dowels).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0941(a)(wood_dowels).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0943(a)(dark_blobs_on_light_background).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0943(a)(dark_blobs_on_light_background).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/Fig0944(a)(calculator).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/Fig0944(a)(calculator).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/FigP0905(U).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/FigP0905(U).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/FigP0917(noisy_rectangle).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/FigP0917(noisy_rectangle).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/FigP0918(left).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/FigP0918(left).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/FigP0919(UTK).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/FigP0919(UTK).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/FigP0934(blobs_in_circular_arrangement).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/FigP0934(blobs_in_circular_arrangement).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/FigP0936(bubbles_on_black_background).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/FigP0936(bubbles_on_black_background).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/击中集合A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH09/击中集合A.png
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH09/未命名.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": []
9 | }
10 | ],
11 | "metadata": {
12 | "kernelspec": {
13 | "display_name": "Python 3",
14 | "language": "python",
15 | "name": "python3"
16 | },
17 | "language_info": {
18 | "codemirror_mode": {
19 | "name": "ipython",
20 | "version": 3
21 | },
22 | "file_extension": ".py",
23 | "mimetype": "text/x-python",
24 | "name": "python",
25 | "nbconvert_exporter": "python",
26 | "pygments_lexer": "ipython3",
27 | "version": "3.7.4"
28 | },
29 | "toc": {
30 | "base_numbering": 1,
31 | "nav_menu": {},
32 | "number_sections": true,
33 | "sideBar": true,
34 | "skip_h1_title": false,
35 | "title_cell": "Table of Contents",
36 | "title_sidebar": "Contents",
37 | "toc_cell": false,
38 | "toc_position": {},
39 | "toc_section_display": true,
40 | "toc_window_display": false
41 | },
42 | "varInspector": {
43 | "cols": {
44 | "lenName": 16,
45 | "lenType": 16,
46 | "lenVar": 40
47 | },
48 | "kernels_config": {
49 | "python": {
50 | "delete_cmd_postfix": "",
51 | "delete_cmd_prefix": "del ",
52 | "library": "var_list.py",
53 | "varRefreshCmd": "print(var_dic_list())"
54 | },
55 | "r": {
56 | "delete_cmd_postfix": ") ",
57 | "delete_cmd_prefix": "rm(",
58 | "library": "var_list.r",
59 | "varRefreshCmd": "cat(var_dic_list()) "
60 | }
61 | },
62 | "types_to_exclude": [
63 | "module",
64 | "function",
65 | "builtin_function_or_method",
66 | "instance",
67 | "_Feature"
68 | ],
69 | "window_display": false
70 | }
71 | },
72 | "nbformat": 4,
73 | "nbformat_minor": 4
74 | }
75 |
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1001(a)(constant_gray_region).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1001(a)(constant_gray_region).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1001(b)(edge_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1001(b)(edge_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1001(c)(thresholded_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1001(c)(thresholded_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1001(d)(noisy_region).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1001(d)(noisy_region).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1001(e)(edge_noisy_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1001(e)(edge_noisy_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1001(f)(region_split_merge_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1001(f)(region_split_merge_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1004(b)(turbine_blade_black_dot).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1004(b)(turbine_blade_black_dot).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1005(a)(wirebond_mask).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1005(a)(wirebond_mask).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1007(a)(wirebond_mask).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1007(a)(wirebond_mask).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1008(a)(step edge).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1008(a)(step edge).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1008(b)(ramp edge).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1008(b)(ramp edge).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1008(c)(roof_edge).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1008(c)(roof_edge).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1016(a)(building_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1016(a)(building_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1022(a)(building_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1022(a)(building_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1025(a)(building_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1025(a)(building_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1026(a)(headCT-Vandy).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1026(a)(headCT-Vandy).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1027(a)(van_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1027(a)(van_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1030(a)(tooth).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1030(a)(tooth).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1034(a)(marion_airport).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1034(a)(marion_airport).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1036(a)(original_septagon).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1036(a)(original_septagon).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1036(b)(gaussian_noise_mean_0_std_10_added).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1036(b)(gaussian_noise_mean_0_std_10_added).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1036(c)(gaussian_noise_mean_0_std_50_added).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1036(c)(gaussian_noise_mean_0_std_50_added).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1037(a)(septagon_gaussian_noise_mean_0_std_10_added).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1037(a)(septagon_gaussian_noise_mean_0_std_10_added).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1037(b)(intensity_ramp).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1037(b)(intensity_ramp).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1038(a)(noisy_fingerprint).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1038(a)(noisy_fingerprint).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1039(a)(polymersomes).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1039(a)(polymersomes).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1040(a)(large_septagon_gaussian_noise_mean_0_std_50_added).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1040(a)(large_septagon_gaussian_noise_mean_0_std_50_added).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1041(a)(septagon_small_noisy_mean_0_stdv_10).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1041(a)(septagon_small_noisy_mean_0_stdv_10).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1042(a)(septagon_small_noisy_mean_0_stdv_10).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1042(a)(septagon_small_noisy_mean_0_stdv_10).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1043(a)(yeast_USC).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1043(a)(yeast_USC).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1045(a)(iceberg).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1045(a)(iceberg).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1046(a)(septagon_noisy_shaded).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1046(a)(septagon_noisy_shaded).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1048(a)(yeast_USC).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1048(a)(yeast_USC).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1049(a)(spot_shaded_text_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1049(a)(spot_shaded_text_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1050(a)(sine_shaded_text_image).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1050(a)(sine_shaded_text_image).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1051(a)(defective_weld).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1051(a)(defective_weld).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1053(a)(cygnusloop_Xray_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1053(a)(cygnusloop_Xray_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1056(a)(blob_original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1056(a)(blob_original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1057(a)(small_blobs-original).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1057(a)(small_blobs-original).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1059(a)(AbsADI).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1059(a)(AbsADI).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1059(b)(PosADI).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1059(b)(PosADI).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1059(c)(NegADI).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1059(c)(NegADI).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1060(a)(car on left).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1060(a)(car on left).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1060(b)(car on right).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1060(b)(car on right).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1060(c)(car removed).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1060(c)(car removed).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/Fig1061(LANDSAT_with moving target).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/Fig1061(LANDSAT_with moving target).tif
--------------------------------------------------------------------------------
/image_data/DIP3E_Original_Images_CH10/FigP1036(blobs).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/image_data/DIP3E_Original_Images_CH10/FigP1036(blobs).tif
--------------------------------------------------------------------------------
/image_data/folder.ini:
--------------------------------------------------------------------------------
1 | [State]
2 | Expanded=1
3 |
--------------------------------------------------------------------------------
/image_data/数据地址.txt:
--------------------------------------------------------------------------------
1 | http://www.imageprocessingplace.com/DIP-3E/dip3e_book_images_downloads.htm
--------------------------------------------------------------------------------
/src/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/7/7 14:45
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : __init__.py.py
9 | @Title :
10 | @Description :
11 | """
--------------------------------------------------------------------------------
/src/chapter10/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/8/7 16:33
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : __init__.py.py
9 | @Title :
10 | @Description :
11 | """
--------------------------------------------------------------------------------
/src/chapter10/edge_connect/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2021/5/24 15:41
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : __init__.py
9 | @Title :
10 | @Description :
11 | """
12 |
--------------------------------------------------------------------------------
/src/chapter10/edge_connect/local_connect.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2021/5/24 15:39
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : edge_connect.py
9 | @Title : 边界连接
10 | @Description :
11 | """
12 | import numpy as np
13 | import matplotlib.pyplot as plt
14 | import cv2
15 |
16 |
17 | def connect_gap(binary_matrix:np.ndarray,gap_length:int):
18 | """连接缝隙"""
19 | for i,row in enumerate(binary_matrix):
20 | last_1_index = - np.inf
21 | for j,pix in enumerate(row):
22 | if pix != 0:
23 | """填充缝隙"""
24 | if j - last_1_index < gap_length:
25 | binary_matrix[i][last_1_index + 1:j + 1] = 1
26 | last_1_index = j
27 | return binary_matrix
28 |
29 |
30 | def _check_binary_matrix(gradient_value_matrix:np.ndarray,
31 | gradient_angel_matrix:np.ndarray,
32 | gradient_value_threshold:float,
33 | gradient_angle_threshold:float,
34 | gradient_angle_bandwidth:float):
35 | """条件二值化"""
36 | tmp1 = gradient_value_matrix > gradient_value_threshold
37 | tmp2 = gradient_angel_matrix == (gradient_angle_threshold - gradient_angle_bandwidth)
38 | tmp3 = gradient_angel_matrix == (gradient_angle_threshold + gradient_angle_bandwidth)
39 | matrix = np.logical_and(tmp1,np.logical_or(tmp2,tmp3))
40 |
41 | matrix = matrix.astype(int)
42 | return matrix
43 |
44 |
45 | def _horizontal_connect(img: np.ndarray,
46 | gradient_angle_threshold:float,
47 | gradient_angle_bandwidth:float,
48 | gradient_value_threshold_rate:float, ) -> np.ndarray:
49 | img_diff_x = cv2.Sobel(img, -1, 1, 0)
50 | img_diff_y = cv2.Sobel(img, -1, 0, 1)
51 |
52 | # TODO 角度有nan出现
53 | gradient_value = np.sqrt(img_diff_x ** 2 + img_diff_y ** 2)
54 | gradient_angle = np.rad2deg(np.arctan(img_diff_y / img_diff_x))
55 |
56 | """计算梯度的阈值"""
57 | gradient_value_threshold = np.max(gradient_value) * gradient_value_threshold_rate
58 |
59 | """判断"""
60 | matrix = _check_binary_matrix(
61 | gradient_angel_matrix=gradient_angle,
62 | gradient_value_matrix=gradient_value,
63 | gradient_value_threshold=gradient_value_threshold,
64 | gradient_angle_bandwidth=gradient_angle_bandwidth,
65 | gradient_angle_threshold=gradient_angle_threshold,)
66 |
67 | """缝隙连接"""
68 | matrix = connect_gap(binary_matrix=matrix, gap_length=50)
69 |
70 | plt.imshow(img)
71 | plt.title("img")
72 | plt.show()
73 |
74 | tmp = np.logical_or(matrix,img)
75 | tmp = tmp.astype(int)
76 | plt.imshow(tmp)
77 | plt.title("t")
78 | plt.show()
79 |
80 |
81 | # return tmp * img
82 | return matrix + img
83 |
84 |
85 | def local_connect(img: np.ndarray,
86 | gradient_angle_threshold:float,
87 | gradient_angle_bandwidth:float,
88 | gradient_value_threshold_rate:float, ) -> np.ndarray:
89 | """"""
90 | res_img = _horizontal_connect(img,
91 | gradient_angle_threshold,
92 | gradient_angle_bandwidth,
93 | gradient_value_threshold_rate)
94 |
95 | import matplotlib.pyplot as plt
96 | plt.imshow(res_img)
97 | plt.show()
98 |
99 | res_img = cv2.rotate(res_img,cv2.ROTATE_90_COUNTERCLOCKWISE)
100 | res_img = res_img.astype("uint8")
101 | res_img = _horizontal_connect(res_img,
102 | gradient_angle_threshold,
103 | gradient_angle_bandwidth,
104 | gradient_value_threshold_rate)
105 | res_img = cv2.rotate(res_img,cv2.ROTATE_90_CLOCKWISE)
106 |
107 | return res_img
108 |
--------------------------------------------------------------------------------
/src/chapter11/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/7/13 14:37
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : __init__.py.py
9 | @Title :
10 | @Description :
11 | """
--------------------------------------------------------------------------------
/src/chapter11/font_img_skeleton_feature.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/5/11 17:35
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : font_img_skeleton_feature.py
9 | @Title : 字体骨架图片的特征
10 | @Description :
11 | """
12 | import preprocess.neaten_data
13 | from algorithm.image import mat
14 | import copy
15 | import numpy as np
16 | from util import decorators
17 | from util import image_helper
18 | import pandas as pd
19 |
20 | @decorators.func_input_type_check()
21 | @decorators.func_output_type_check()
22 | def get_font_skeleton_by_img(img: np.ndarray) ->np.ndarray:
23 | """给定一个字体图片,返回该字体的骨架
24 |
25 | :param img: numpy.ndarray, 字体图片
26 | :return: numpy.ndarray, 骨架图片
27 | """
28 | '''二值化图片,并且统一为黑底白字'''
29 | binary_img = image_helper.font_img_binary_and_black_ground(img)
30 | '''标准化图片'''
31 | norm_img = image_helper.font_img_normalization(binary_img)
32 | '''骨架化后的图片'''
33 | stroke_img = mat.get_img_skeleton_by_mat(norm_img)
34 | return stroke_img
35 |
36 |
37 | @decorators.func_output_type_check()
38 | @decorators.func_input_type_check()
39 | def get_font_skeleton_by_seq(signature_data: pd.DataFrame) -> np.ndarray:
40 | """给定一个签字序列,返回该签字序列的骨架(实际上是不加粗细的绘图)
41 |
42 | :param signature_data: pandas.DataFrame,
43 | :return: numpy.ndarray, 骨架图片
44 | """
45 | try:
46 | img = draw_img(
47 | data=signature_data,
48 | is_resize=True,
49 | size=font_shape_model_config.resize_img_shape
50 | )
51 | except KeyError:
52 | '''列名错误的情况'''
53 | temp_data = signature_data.copy()
54 | temp_data.columns = preprocess.neaten_data.replace_columns(temp_data.columns, 2)
55 | img = draw_img(
56 | data=temp_data,
57 | is_resize=True,
58 | size=font_shape_model_config.resize_img_shape
59 | )
60 | finally:
61 | img = img.resize(font_shape_model_config.resize_img_shape)
62 | img = np.asarray(img)
63 | """二值化图片,并且统一为黑底白字"""
64 | binary_img = image_helper.font_img_binary(img)
65 | '''转换为黑底白字'''
66 | # binary_img = 255 - binary_img
67 | '''标准化图片'''
68 | norm_img = image_helper.font_img_normalization(binary_img)
69 |
70 | return norm_img
71 |
--------------------------------------------------------------------------------
/src/chapter11/freeman_code.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/7/7 14:45
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : freeman_code.py
9 | @Title : Freeman链码实现
10 | @Description :
11 | """
12 | import numpy as np
13 | from deprecated.sphinx import deprecated
14 |
15 | """表示是按4方向编码还是按8方向编码"""
16 | FOUR_DIRECTION = 1
17 | EIGHT_DIRECTION = 2
18 |
19 | # =========================================================
20 | # 获取Freeman链码坐标
21 | # =========================================================
22 |
23 |
24 | def __get_freeman_box_list(
25 | img: np.ndarray, n_box_x: int = 10, n_box_y: int = 10) -> ([int], [int]):
26 | """给定一张图片,返回该图片对应的Freeman网格对应的坐标,坐标分为
27 | x和y,所以返回的是两个list,分别是x的list和y的list
28 |
29 | :param img: numpy.ndarray, 图片
30 | :param n_box_x: int ,x轴的网格数
31 | :param n_box_y: int, y轴的网格数
32 | :return: [int],[int]
33 | 网格对应的list,list中的个数等于网格数加一
34 | """
35 | freeman_x_coordination_list = list()
36 | freeman_y_coordination_list = list()
37 | '''获取图像的长宽'''
38 | if len(img.shape) == 2:
39 | img_h, img_w = img.shape
40 | else:
41 | img_h, img_w, _ = img.shape
42 |
43 | # 获取每个网格的长和宽
44 | cell_w, cell_h = img_w / n_box_x, img_h / n_box_y
45 | for i in range(n_box_x + 1):
46 | freeman_x_coordination_list.append(i * cell_w)
47 | for i in range(n_box_y + 1):
48 | freeman_y_coordination_list.append(i * cell_h)
49 |
50 | return freeman_x_coordination_list, freeman_y_coordination_list
51 |
52 | # ===============================================================
53 | # 获取边缘对应的Freeman链码坐标
54 | # ===============================================================
55 |
56 |
57 | def __get_close_num(num: float, num_list: [float]) -> (float, float):
58 | """给定一个数字以及一个有序的list,返回离该数字最近的两个数组中的元素
59 |
60 | :param num: float,该数字
61 | :param num_list: List[float],有序的list
62 | :return: Tuple(flaot,float),最近的两个元素
63 | """
64 | for i in range(len(num_list) - 1):
65 | current_num = num_list[i]
66 | next_num = num_list[i + 1]
67 | if current_num <= num <= next_num:
68 | return current_num, next_num
69 |
70 |
71 | def __get_freeman_coordination(
72 | point: (int, int), freeman_x_list: list, freeman_y_list: list) -> (int, int):
73 | """给出当前点,放回该点在Freeman网格中的坐标
74 |
75 | :param point: (int,int), 点的坐标
76 | :param freeman_x_list: List[float], Freeman网格x
77 | :param freeman_y_list: List[float], Freeman网格y
78 | :return: (int,int) or None
79 | 如果该点在Freeman网格线上则返回对应的Freeman网格坐标,否则返回None
80 | """
81 | x, y = point
82 | x_index, y_index = None, None
83 | """如果该点在网格的线上"""
84 | if x in freeman_x_list or y in freeman_y_list:
85 | try:
86 | x_index = freeman_x_list.index(x)
87 | except ValueError:
88 | '''如果该点在横线上'''
89 | last_freeman_x, next_freeman_x = __get_close_num(x, freeman_x_list)
90 | mean_freeman_x = (last_freeman_x + next_freeman_x) / 2
91 | x_index = freeman_x_list.index(last_freeman_x)
92 | x_index = x_index if x < mean_freeman_x else x_index + 1
93 | y_index = freeman_y_list.index(y)
94 |
95 | return x_index, y_index
96 |
97 | else:
98 | """如果该点在纵线上"""
99 | try:
100 | y_index = freeman_y_list.index(y)
101 | except ValueError:
102 | '''如果该点在纵线上'''
103 | last_freeman_y, next_freeman_y = __get_close_num(
104 | y, freeman_y_list)
105 | mean_freeman_y = (last_freeman_y + next_freeman_y) / 2
106 | y_index = freeman_y_list.index(last_freeman_y)
107 | y_index = y_index if y < mean_freeman_y else y_index + 1
108 | x_index = freeman_x_list.index(x)
109 | else:
110 | '''如果该点刚好在Freeman编码的坐标点上'''
111 | x_index = freeman_x_list.index(x)
112 | y_index = freeman_y_list.index(y)
113 | finally:
114 | return x_index, y_index
115 | else:
116 | '''如果没有'''
117 | return
118 |
119 |
120 | # ============================================================
121 | # FreeMan编码
122 | # ============================================================
123 | @deprecated(version="1.0", reason="该函数判断不合理")
124 | def __is_freeman_coordination_correct(
125 | freeman_coordination_list: [(int, int)]) -> bool:
126 | """验证Freeman链码是否正确
127 |
128 | 如果下一个点和当前点仅差一个距离(即8个方向),则判定下一个点是正确的,否则判定下一个
129 | 点是错误的
130 |
131 | :param freeman_coordination_list: List[(int,int)],得到的Freeman链码的List
132 | :return: bool,链码是否正确
133 | """
134 | for i in range(len(freeman_coordination_list) - 1):
135 | current_freeman_point = freeman_coordination_list[i]
136 | current_point_x, current_point_y = current_freeman_point
137 | next_freeman_point = freeman_coordination_list[i + 1]
138 |
139 | # 8个方向候选点(包括当前点),如果在候选点中得到超出范围的Freeman坐标点,不影响结果
140 | candidate_point_list = list()
141 | for x_direct_offset in [-1, 0, 1]:
142 | for y_direct_offset in [-1, 0, 1]:
143 | candidate_point_list.append(
144 | (current_point_x + x_direct_offset,
145 | current_point_y + y_direct_offset))
146 | if next_freeman_point not in candidate_point_list:
147 | # print(current_freeman_point, next_freeman_point)
148 | return False
149 | return True
150 |
151 |
152 | def __get_freeman_code_by_two_point(
153 | point1: (int, int), point2: (int, int),) -> int:
154 | """给定两个点(Freeman点),返回Freeman编码
155 |
156 | :param point1: (int,int),点1
157 | :param point2: (int,int),点2
158 | :return: int, Freeman编码
159 | """
160 | freeman_code_dict = {
161 | str((1, 0)): 0,
162 | str((1, 1)): 1,
163 | str((0, 1)): 2,
164 | str((-1, 1)): 3,
165 | str((-1, 0)): 4,
166 | str((-1, -1)): 5,
167 | str((0, -1)): 6,
168 | str((1, -1)): 7,
169 | }
170 | point_gap = (point2[0] - point1[0], point2[1] - point1[1])
171 | try:
172 | return freeman_code_dict[str(point_gap)]
173 | except KeyError:
174 | return
175 |
176 |
177 | def __get_freeman_code(freeman_coordination_list: [(int, int)]) -> [int]:
178 | """给定Freeman坐标,返回Freeman编码的结果
179 |
180 | :param freeman_coordination_list: List[(int,int)],Freman坐标组成的List
181 | :return: List[int],Freeman编码结果
182 | """
183 | freeman_code_list = list()
184 | for i in range(len(freeman_coordination_list) - 1):
185 | current_freeman_point = freeman_coordination_list[i]
186 | next_freeman_point = freeman_coordination_list[i + 1]
187 |
188 | freeman_code = __get_freeman_code_by_two_point(
189 | point1=current_freeman_point,
190 | point2=next_freeman_point)
191 | '''排除重复点 '''
192 | if freeman_code is not None:
193 | freeman_code_list.append(freeman_code)
194 | return freeman_code_list
195 |
196 |
197 | # ============================================================
198 | # 主函数
199 | # ============================================================
200 |
201 | def get_freeman_coordination(img: np.ndarray, contour: [(int, int)]) -> [int]:
202 | """给定图像和对应的边界,返回Freeman对应的坐标
203 |
204 | :param img: numpy.ndarray, 图像
205 | :param contour: List[(int,int)],边界的List
206 | :return: Freeman对应的坐标
207 | """
208 | freeman_coordination_list = list() # 用于保存得出的Freeman链码坐标
209 | '''获取Freeman链码的网格坐标'''
210 | freeman_x_coordination_list, freeman_y_coordination_list = \
211 | __get_freeman_box_list(img=img)
212 |
213 | """得到边缘在Freeman链码上的坐标"""
214 | for point in contour:
215 | x, y = point
216 | point_freeman_coordination = __get_freeman_coordination(
217 | point=(x, y),
218 | freeman_x_list=freeman_x_coordination_list,
219 | freeman_y_list=freeman_y_coordination_list,
220 | )
221 | """如果该点在Freeman网格上"""
222 | if point_freeman_coordination is not None:
223 | freeman_coordination_list.append(point_freeman_coordination)
224 |
225 | '''添加最后一个点到第一个点的连线'''
226 | freeman_coordination_list.append(freeman_coordination_list[0])
227 | return freeman_coordination_list
228 |
229 |
230 | def get_freeman_code(img: np.ndarray, contour: [
231 | (int, int)]) -> [int]:
232 | """给定图像和对应的边界,返回Freeman链码
233 |
234 | :param img: numpy.ndarray, 图像
235 | :param contour: List[(int,int)],边界的list
236 | :return: [int], 弗雷曼链码
237 | """
238 | freeman_coordination_list = get_freeman_coordination(img, contour)
239 | """验证得到的Freeman坐标是否正确"""
240 | assert __is_freeman_coordination_correct(freeman_coordination_list)
241 |
242 | """根据方向得到Freeman链码"""
243 | return __get_freeman_code(freeman_coordination_list)
244 |
--------------------------------------------------------------------------------
/src/chapter11/mark_sheet.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/7/10 14:21
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : mark_sheet.py
9 | @Title : 标记图
10 | @Description :
11 | """
12 | from scipy.spatial.distance import euclidean
13 | import numpy as np
14 | import cv2
15 |
16 |
17 | def get_centroid(img: np.ndarray) -> (int, int):
18 | """给定一张图的,返回其亮点的质心
19 |
20 | :param img: numpy.ndarray, 图像
21 | :return: (int,int), 质心的坐标
22 | """
23 | white_point = np.where([img == 1])
24 | x = white_point[1].mean()
25 | y = white_point[2].mean()
26 |
27 | return x, y
28 |
29 |
30 | def get_mark_sheet(img: np.ndarray) -> np.ndarray:
31 | """根据图像返回标记图
32 |
33 | :param img: numpy.array,
34 | :return:
35 | """
36 | # TODO 结果有问题
37 | distance_list = list()
38 | '''获取质心'''
39 | centroid = get_centroid(img)
40 |
41 | '''获取边界'''
42 | image, contours, hierarchy = cv2.findContours(
43 | img, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
44 | contour = contours[0]
45 | '''距离list'''
46 | for point in contour:
47 | dist = euclidean(centroid, point)
48 | distance_list.append(dist)
49 | return distance_list
50 |
51 |
52 | def get_mark_sheet_by_contour(
53 | centroid: (int, int), contour: [(int, int)]):
54 | """给定边界的list,返回距离的list
55 |
56 | :param centroid: (int,int),质心
57 | :param contour: List[(int,int)],边界
58 | :return: List[int], 距离的List
59 | """
60 | distance_list = list()
61 | '''距离list'''
62 | for point in contour:
63 | dist = euclidean(centroid, point)
64 | distance_list.append(dist)
65 | return distance_list
66 |
--------------------------------------------------------------------------------
/src/chapter11/mat.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/4/28 11:13
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : mat.py
9 | @Title : MAT算法
10 | @Description :
11 | MAT算法用于给定一个字的图片,通过MAT算法返回这个字对应的骨架图片
12 | """
13 | import numpy as np
14 | from functools import reduce
15 |
16 |
17 | # =================================================================
18 | # MAT算法提取骨架
19 | # =================================================================
20 |
21 |
22 | def __mat_process_first(around_area: np.ndarray) -> bool:
23 | """MAT算法步骤1
24 |
25 | 对于相邻像素区域:
26 | [
27 | [p9,p2,p3],
28 | [p8,p1,p4],
29 | [p7,p6,p5]
30 | ]
31 | 包括以下几个部分:
32 | a. 2 <=非零像素个数 <= 6
33 | b. 顺时针跳数 = 1
34 | c. p2 * p4 * p6 = 0
35 | d. p4 * p6 * p8 = 0
36 |
37 | :param around_area: numpy.array, 一个像素的相邻像素,为3*3
38 | :return: bool,是否满足以上所有条件
39 | """
40 | result_list = list() # 保存所有步骤是否符合条件
41 | """步骤a"""
42 | near_one_count = __near_pix_equal_one_count(around_area)
43 | result_list.append(2 <= near_one_count <= 6)
44 | """步骤b"""
45 | result_list.append(__binary_transform_count(around_area) == 1)
46 | """步骤c"""
47 | pix_2 = around_area[0][1]
48 | pix_4 = around_area[1][2]
49 | pix_6 = around_area[2][1]
50 | result_list.append(pix_2 * pix_4 * pix_6 == 0)
51 | """步骤d"""
52 | pix_8 = around_area[1][0]
53 | result_list.append(pix_4 * pix_6 * pix_8 == 0)
54 |
55 | return bool(reduce(lambda x, y: x and y, result_list))
56 |
57 |
58 | def __mat_process_second(around_area: np.ndarray) -> bool:
59 | """MAT算法步骤2
60 | 对于相邻像素区域:
61 | [
62 | [p9,p2,p3],
63 | [p8,p1,p4],
64 | [p7,p6,p5]
65 | ]
66 | 包括以下几个部分:
67 | a. 2 <=非零像素个数 <= 6
68 | b. 顺时针跳数 = 1
69 | c. p2 * p4 * p8 = 0
70 | d. p2 * p6 * p8 = 0
71 | :param around_area: numpy.array, 周围的区域
72 | :return: bool,是否全部子条件
73 | """
74 | result_list = list() # 保存所有步骤是否符合条件
75 | """步骤a"""
76 | near_one_count = __near_pix_equal_one_count(around_area)
77 | result_list.append(2 <= near_one_count <= 6)
78 | """步骤b"""
79 | result_list.append(__binary_transform_count(around_area) == 1)
80 | """步骤c"""
81 | pix_2 = around_area[0][1]
82 | pix_4 = around_area[1][2]
83 | pix_8 = around_area[1][0]
84 | pix_6 = around_area[2][1]
85 | result_list.append(pix_2 * pix_4 * pix_8 == 0)
86 | """步骤d"""
87 | result_list.append(pix_2 * pix_6 * pix_8 == 0)
88 |
89 | return bool(reduce(lambda x, y: x and y, result_list))
90 |
91 |
92 | def __near_pix_equal_one_count(around_area: np.ndarray) -> int or np.int:
93 | """计算相邻像素中为1的个数(不包括中间点)
94 |
95 | 即,对于相邻像素区域:
96 | [
97 | [p9,p2,p3],
98 | [p8,p1,p4],
99 | [p7,p6,p5]
100 | ]
101 | 统计出p1之外所有的1的个数
102 | :param around_area: numpy.array, 一个像素的相邻像素,为3*3
103 | :return int,像素为1的个数
104 | """
105 | temp_around_area = np.copy(around_area)
106 | temp_around_area[1][1] = 0
107 | return int(np.sum(temp_around_area, dtype=np.int))
108 |
109 |
110 | def __binary_transform_count(around_area: np.ndarray) -> int or np.int:
111 | """给定一个3*3的二进制图片,获取其顺时针的跳数(从0到1)
112 |
113 | 即,对于相邻像素区域:
114 | [
115 | [p9,p2,p3],
116 | [p8,p1,p4],
117 | [p7,p6,p5]
118 | ]
119 | 以p9,p2,p3,p4,p5,p6,p7,p8的顺序访问,如果是0到1,则为一跳
120 | :param around_area: numpy.array, 一个像素的相邻像素,为3*3
121 | :return int, 顺时针跳数
122 | """
123 | def __next_index(current_coor: (int, int)) -> (int, int):
124 | """给定当前位置,返回下一个位置
125 |
126 | :param current_coor: (int,int),当前位置
127 | :return: (int,int), 下一个位置
128 | """
129 | '''四个方向的下一个位置'''
130 | right_next = (current_coor[0], current_coor[1] + 1)
131 | down_next = (current_coor[0] + 1, current_coor[1])
132 | left_next = (current_coor[0], current_coor[1] - 1)
133 | up_next = (current_coor[0] - 1, current_coor[1])
134 |
135 | """按照指定的规则寻找,不报错则表示正确的方向"""
136 | next_coordinate_list = [right_next, down_next, left_next, up_next]
137 | for i, next_coordinate in enumerate(next_coordinate_list):
138 | try:
139 | around_area[next_coordinate]
140 | except IndexError:
141 | continue
142 | else:
143 | '''如果该点已经走过'''
144 | if is_walked[next_coordinate[0], next_coordinate[1]]:
145 | continue
146 | else:
147 | is_walked[next_coordinate[0], next_coordinate[1]] = True
148 | return next_coordinate
149 |
150 | is_walked = np.full_like(around_area, False) # 用于标识该点是否已经走过
151 | is_walked[1][1] = True
152 | transform_count = 0 # 用于记录跳数
153 | """循环对比"""
154 | last_pix = around_area[0][0] # 上一个的值
155 | current_coordinate = (0, 1)
156 | while current_coordinate != (0, 0):
157 | current_pix = around_area[current_coordinate[0], current_coordinate[1]]
158 | if last_pix == 0 and current_pix == 1:
159 | transform_count += 1
160 |
161 | last_pix = current_pix
162 | current_coordinate = __next_index(current_coordinate)
163 |
164 | '''当循环到第一个点时再对比一次'''
165 | current_pix = around_area[current_coordinate[0], current_coordinate[0]]
166 | if last_pix == 0 and current_pix == 1:
167 | transform_count += 1
168 |
169 | return transform_count
170 |
171 |
172 | def __remove_pix_by_coordination(img: np.ndarray, points: list):
173 | """给定坐标的list,删除图像上的点(实际就是标记为0)
174 |
175 | :param img: numpy.array,图像
176 | :param points: List[(int,int)]
177 | """
178 | for single_coordination in points:
179 | i_row, i_col = single_coordination
180 | img[i_row][i_col] = 0
181 |
182 |
183 | def __get_remove_points(img: np.ndarray, func) -> [(int, int)]:
184 | """给定图像以及,删除点的规则,返回要删除的点
185 |
186 | :param img: numpy.array, 原图像
187 | :param func: function, 规则,也就是一个函数
188 | :return: List[(int,int)],坐标的list
189 | """
190 | remove_points_list = list()
191 | temp_img = img
192 | img_iter = np.nditer(temp_img, flags=["multi_index"])
193 | while not img_iter.finished:
194 | current_pix = img_iter[0]
195 | i_row, i_col = img_iter.multi_index
196 | img_iter.iternext()
197 | '''如果是背景点则直接跳过'''
198 | if current_pix != 1:
199 | continue
200 |
201 | """如果是前景点"""
202 | around_area = temp_img[i_row - 1:i_row + 2, i_col - 1:i_col + 2]
203 | if func(around_area):
204 | remove_points_list.append((i_row, i_col))
205 |
206 | img_iter.iternext()
207 | return remove_points_list
208 |
209 |
210 | def get_img_skeleton_by_mat(img: np.ndarray) -> np.ndarray:
211 | """根据字体的图像得到字的骨架
212 |
213 | :param img, numpy.array, 原图片
214 | :raise ValueError
215 | - 图片不为单通道
216 | - 图片并未归一化
217 | - 图片并未标准化
218 | :return: numpy.array, 骨架图
219 | """
220 | '''检验图片是否是单通道'''
221 | if len(img.shape) != 2:
222 | raise ValueError("该图片不是单通道")
223 | """检验标准化"""
224 | if img.max() > 1:
225 | raise ValueError("该图片并未标准化")
226 | """检验二值化"""
227 | if (np.unique(img.flatten()) != (0, 1)).all():
228 | raise ValueError("该函数并未二值化")
229 |
230 | temp_img = img.copy()
231 | """遍历每一个像素点"""
232 | is_remove_flag = True # 表示是否继续删除的标志
233 | i_round = 1 # 记录迭代的轮数
234 | while is_remove_flag:
235 | is_remove_flag = False
236 | print("正在执行MAT算法的第{}轮".format(i_round))
237 | """执行步骤1"""
238 | remove_points = __get_remove_points(temp_img, __mat_process_first)
239 | if len(remove_points) != 0:
240 | is_remove_flag = True
241 | __remove_pix_by_coordination(temp_img, remove_points)
242 |
243 | """执行步骤2"""
244 | remove_points = __get_remove_points(temp_img, __mat_process_second)
245 | if len(remove_points) != 0:
246 | is_remove_flag = True
247 | __remove_pix_by_coordination(temp_img, remove_points)
248 |
249 | i_round += 1
250 |
251 | return temp_img
252 |
--------------------------------------------------------------------------------
/src/chapter11/moment_invariants.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/9/3 11:32
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : moment_invariants.py
9 | @Title : 不变矩
10 | @Description :
11 | """
12 | import numpy as np
13 | import logging
14 |
15 |
16 | def get_rank_moment(image: np.ndarray, row_moment: int,
17 | col_moment: int) -> np.ndarray:
18 | """返回不变矩,阶数为row_moment + col_moment
19 |
20 | :param image: numpy.array, 图像
21 | :param row_moment: int, 行阶数
22 | :param col_moment: int, 列阶数
23 | :return: numpy.array,不变矩
24 | """
25 | """初始化"""
26 | moment = 0.
27 |
28 | """计算矩"""
29 | n_row, n_col = image.shape
30 | for i_row in range(n_row):
31 | for j_col in range(n_col):
32 | moment += np.power(i_row, row_moment)\
33 | * np.power(j_col, col_moment) * image[i_row][j_col]
34 | return moment
35 |
36 |
37 | def get_center_moment(image: np.ndarray, row_moment: int,
38 | col_moment: int) -> np.ndarray:
39 | """计算中心矩
40 |
41 | :param image: numpy.array, 图像
42 | :param row_moment: int,行阶数
43 | :param col_moment: int,列阶数
44 | :return: numpy.array, 中心矩
45 | """
46 | """计算均值"""
47 | '''计算1阶矩'''
48 | rank_moment00 = get_rank_moment(image, row_moment=0, col_moment=0)
49 | rank_moment10 = get_rank_moment(image, row_moment=1, col_moment=0)
50 | rank_moment01 = get_rank_moment(image, row_moment=0, col_moment=1)
51 |
52 | '''计算均值'''
53 | mean_row = rank_moment10 / rank_moment00
54 | mean_col = rank_moment01 / rank_moment00
55 |
56 | """计算不变矩"""
57 | moment = 0.
58 | n_row, n_col = image.shape
59 | for i_row in range(n_row):
60 | for j_col in range(n_col):
61 | moment += np.power((i_row - mean_row), row_moment) * \
62 | np.power((j_col - mean_col), col_moment) * image[i_row][j_col]
63 | return moment
64 |
65 |
66 | def normal_center_moment(image: np.ndarray, row_moment: int,
67 | col_moment: int) -> np.ndarray:
68 | """计算归一化后的中心矩
69 |
70 | :param image: numpy.array, 图像
71 | :param row_moment: int,行阶数
72 | :param col_moment: int,列阶数
73 | :return: numpy.array, 中心矩
74 | """
75 | """中心矩"""
76 | center_moment = get_center_moment(
77 | image, row_moment=row_moment, col_moment=col_moment)
78 |
79 | """归一化的分母部分"""
80 | tmp_center_moment = get_center_moment(image, row_moment=0, col_moment=0)
81 | tmp_power = (row_moment + col_moment) / 2 + 1
82 | tmp_moment = tmp_center_moment ** tmp_power
83 |
84 | return center_moment / tmp_moment
85 |
86 |
87 | def get_moment_invariants_seq(image: np.ndarray) -> list:
88 | """返回二阶和三阶不变矩组(7个)
89 |
90 | :param image: numpy.array, 图片
91 | :return:
92 | """
93 |
94 | """计算归一化后的中心矩"""
95 | '''二阶'''
96 | logging.info("正在计算二阶中心矩")
97 | moment20 = normal_center_moment(image, row_moment=2, col_moment=0)
98 | moment02 = normal_center_moment(image, row_moment=0, col_moment=2)
99 | moment11 = normal_center_moment(image, row_moment=1, col_moment=1)
100 | '''三阶'''
101 | logging.info("正在计算三阶中心矩")
102 | moment03 = normal_center_moment(image, 0, 3)
103 | moment12 = normal_center_moment(image, 1, 2)
104 | moment21 = normal_center_moment(image, 2, 1)
105 | moment30 = normal_center_moment(image, 3, 0)
106 |
107 | """计算不变矩组"""
108 | logging.info("正在计算不变矩组")
109 | num1 = moment02 + moment20
110 | num2 = (moment02 - moment20) ** 2 + 4 * moment11 ** 2
111 | num3 = (moment30 - 3 * moment12) ** 2 + (3 * moment21 - moment03) ** 2
112 | num4 = (moment30 + moment12) ** 2 + (moment21 + moment03) ** 2
113 | num5 = (moment30 - 3 * moment12) * (moment30 + moment12) * ((moment30 + moment12) ** 2 - 3 * (moment21 + moment03) ** 2) + \
114 | (3 * moment21 - moment03) * (moment21 + moment03) * \
115 | (3 * (moment30 - moment12) ** 2 - (moment21 - moment03) ** 2)
116 | num6 = (moment20 - moment02) * ((moment30 + moment12) ** 2 - (moment21 + moment03)
117 | ** 2) + 4 * moment11 * (moment30 + moment12) * (moment21 + moment03)
118 | num7 = (3 * moment21 - moment03) * (moment30 + moment12) * ((moment30 + moment12) ** 2 - 3 * (moment21 + moment03) ** 2) + \
119 | (3 * moment12 - moment03) * (moment21 + moment03) * \
120 | (3 * (moment30 + moment12) ** 2 - (moment21 - moment03) ** 2)
121 |
122 | moment_invariants_list = [num1, num2, num3, num4, num5, num6, num7]
123 | return moment_invariants_list
124 |
--------------------------------------------------------------------------------
/src/chapter11/shape_number.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/7/14 14:31
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : shape_number.py
9 | @Title : 形状数
10 | @Description :
11 | """
12 | import numpy as np
13 | from src.chapter11 import freeman_code
14 |
15 |
16 | # =============================================================
17 | # 获取差分编码
18 | # =============================================================
19 |
20 |
21 | def __get_freeman_difference(freeman_code_list: [int]) -> [int]:
22 | """给定Freeman List,返回Freeman差分
23 |
24 | :param freeman_code_list: List[int],Freeman编码的List,
25 | :return: List[int], 差分后的编码
26 | """
27 | # 用于保存差分后的编码
28 | different_code_list = list()
29 | for i in range(len(freeman_code_list) - 1):
30 | current_code = freeman_code_list[i]
31 | next_code = freeman_code_list[i + 1]
32 | if next_code < current_code:
33 | next_code += 8
34 | different_code_list.append(next_code - current_code)
35 | return different_code_list
36 |
37 |
38 | # ===============================================================
39 | # 获取形状数
40 | # ===============================================================
41 |
42 | def __get_shape_number_by_freeman_difference(
43 | freeman_difference_list: [int]) -> [int]:
44 | """给定已经差分后的freeman编码,返回形状数
45 |
46 | :param freeman_difference_list: List[int], 差分后的Freeman编码
47 | :return: List[int],形状数
48 | """
49 | queue1, queue2 = list(), list()
50 | min_num = np.min(freeman_difference_list)
51 |
52 | # queue1用于存放最小数前面的数字,queue2用于存放最小数后面的数字(包括最小数)
53 | # 最后将两个queue拼接在一起即是最后的结果
54 | queue = queue1
55 | for num in freeman_difference_list:
56 | if num == min_num:
57 | queue = queue2
58 | queue.append(num)
59 | return queue2 + queue1
60 |
61 |
62 | # ===============================================================
63 | # 主函数
64 | # ===============================================================
65 |
66 | def get_shape_number(img: np.ndarray, contour: [(int, int)]) -> [int]:
67 | """给定一幅图像以及边界的List,返回形状数
68 |
69 | :param img: numpy.ndarray, 图像
70 | :param contour: List[(int,int)],边界的list
71 | :return: List[int],形状数
72 | """
73 | """获取Freeman编码"""
74 | freeman_code_list = freeman_code.get_freeman_code(img, contour)
75 |
76 | """获取差分编码"""
77 | freeman_difference_list = __get_freeman_difference(freeman_code_list)
78 |
79 | """获取形状数"""
80 | return __get_shape_number_by_freeman_difference(freeman_difference_list)
81 |
--------------------------------------------------------------------------------
/src/chapter11/texture.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/7/24 10:41
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : texture.py
9 | @Title : 纹理
10 | @Description :
11 | """
12 | import numpy as np
13 |
14 | # ===================================================================
15 | # 建立等级矩阵
16 | # ===================================================================
17 |
18 |
19 | def __get_rank_list(gray_rank: int, max_value: int = 255,
20 | min_value: int = 0) -> [int]:
21 | """返回等级的list
22 |
23 | :param gray_rank: int, 等级数
24 | :param max_value: int, 像素值的最大值
25 | :param min_value: int, 像素值的最小值
26 | :return: List[int],分段的list
27 | """
28 | rank_list = list()
29 | num_value = max_value - min_value + 1
30 | current_value = min_value
31 | while current_value <= max_value:
32 | rank_list.append(current_value)
33 | interval_value = num_value // gray_rank
34 | current_value += interval_value
35 |
36 | """最后加入max value"""
37 | if rank_list[-1] < max_value:
38 | rank_list.append(max_value)
39 | return rank_list
40 |
41 |
42 | def __get_rank_index(gray_value: int, rank_list: [int]) -> int:
43 | """给定灰度值和一个等级的list,返回该灰度值对应的index
44 |
45 | :param gray_value: int, 灰度值
46 | :param rank_list: List[int], 等级list
47 | :return: int, 等级index
48 | """
49 | for i in range(len(rank_list) - 1):
50 | current_value = rank_list[i]
51 | next_value = rank_list[i + 1]
52 | if current_value <= gray_value < next_value:
53 | return i
54 |
55 | """如果该值刚好是最大值,则放回最大的rank Index"""
56 | if gray_value == rank_list[-1]:
57 | return len(rank_list) - 2
58 |
59 | # =================================================================
60 | # 建立共生矩阵
61 | # =================================================================
62 |
63 |
64 | def __get_occurrence_matrix_by_rank_matrix(
65 | rank_matrix: np.ndarray, gray_rank: int, n_step: int = 1) -> np.ndarray:
66 | """跟定一个等级矩阵,返回共生矩阵,且会根据不同的跳数返回不同的共生矩阵
67 |
68 | :param rank_matrix: numpy.array, 等级矩阵
69 | :param gray_rank: int, 灰度等级
70 | :param n_step: int, 跳数,默认为1,表示相邻的元素建立跳数
71 | :return: numpy.array, 共生矩阵
72 | """
73 | if n_step < 1:
74 | raise ValueError("跳数设定错误")
75 | """初始化"""
76 | # 共生矩阵
77 | co_occurrence_matrix = np.zeros(shape=(gray_rank, gray_rank))
78 |
79 | """计算共生矩阵"""
80 | for i_row in range(len(rank_matrix)):
81 | for i_col in range(len(rank_matrix[0]) - n_step):
82 | current_value = rank_matrix[i_row][i_col]
83 | next_value = rank_matrix[i_row][i_col + n_step]
84 | co_occurrence_matrix[current_value][next_value] += 1
85 |
86 | return co_occurrence_matrix
87 |
88 |
89 | # ================================================================
90 | # 共生矩阵描述子辅助函数
91 | # ================================================================
92 |
93 | def __get_probability_matrix(occurrence_matrix: np.ndarray) -> np.ndarray:
94 | """给定共生矩阵,返回概率矩阵
95 |
96 | :param occurrence_matrix: numpy.array, 共生矩阵
97 | :return: numpy.array, 概率矩阵
98 | """
99 | return occurrence_matrix / np.sum(occurrence_matrix)
100 |
101 |
102 | def __get_occurrence_mean(occurrence_matrix: np.ndarray, axis=0) -> float:
103 | """返回共生矩阵的平均值
104 |
105 | :param occurrence_matrix: numpy.array, 共生矩阵
106 | :param axis: int, 方向,同numpy
107 | :return: numpy.array, 行平均向量
108 | """
109 | prob_matrix = __get_probability_matrix(occurrence_matrix)
110 | tmp_mean = np.sum(prob_matrix, axis=axis)
111 |
112 | mean_value = 0.
113 | for i in range(len(tmp_mean)):
114 | mean_value += (i + 1) * tmp_mean[i]
115 | return mean_value
116 |
117 |
118 | def __get_occurrence_variance(occurrence_matrix: np.ndarray, axis=0) -> float:
119 | """返回共生矩阵的方差
120 |
121 | :param occurrence_matrix: numpy.array,共生矩阵
122 | :param axis: int, 方向
123 | :return: float, 方差
124 | """
125 | prob_matrix = __get_probability_matrix(occurrence_matrix)
126 | tmp_mean_vec = np.sum(prob_matrix, axis=axis)
127 | mean_value = __get_occurrence_mean(occurrence_matrix, axis=axis)
128 |
129 | var_value = 0.
130 | for i in range(len(tmp_mean_vec)):
131 | var_value += (i + 1 - mean_value) ** 2 * tmp_mean_vec[i]
132 |
133 | return var_value
134 |
135 |
136 | # =================================================================
137 | # Main
138 | # =================================================================
139 |
140 |
141 | def get_co_occurrence_matrix(
142 | img: np.ndarray, gray_rank: int = 8) -> np.ndarray:
143 | """给定一张图片,返回灰度共生矩阵
144 |
145 | 步骤如下:
146 | * 给出每一个像素值对应的等级
147 | * 给出等级分段的list
148 | * 给出该像素值对应的分段index
149 | * 从左到右扫描两个像素,在对应的共生矩阵加1
150 | * 初始化一个共生矩阵,里面的值全为0
151 | * 根据两个index锁定位置的元素加1
152 | :param img: numpy.array, 图片
153 | :param gray_rank: int, 共生矩阵的等级数
154 | :return: numpy.array, 共生矩阵
155 | """
156 | """排序list"""
157 | rank_list = __get_rank_list(gray_rank=gray_rank)
158 | """获取Rank矩阵"""
159 | get_rank_matrix_f = np.frompyfunc(
160 | lambda x: __get_rank_index(
161 | x, rank_list), 1, 1)
162 | rank_matrix = get_rank_matrix_f(img)
163 |
164 | """获取共生矩阵"""
165 | return __get_occurrence_matrix_by_rank_matrix(
166 | rank_matrix=rank_matrix, gray_rank=gray_rank)
167 |
168 |
169 | def get_co_occurrence_correlation_seq(
170 | img: np.ndarray, gray_rank: int = 8, start_step: int = 1, end_step: int = 50) -> list:
171 | """
172 |
173 | :param img: numpy.array, 图像
174 | :param gray_rank: int,共生矩阵的等级数
175 | :param start_step: int,开始跳数
176 | :param end_step: int, 结束跳数
177 | :return: list, 共生矩阵相关性序列
178 | """
179 | """获取等级矩阵"""
180 | '''排序list'''
181 | rank_list = __get_rank_list(gray_rank=gray_rank)
182 | '''获取Rank矩阵'''
183 | get_rank_matrix_f = np.frompyfunc(
184 | lambda x: __get_rank_index(
185 | x, rank_list), 1, 1)
186 | rank_matrix = get_rank_matrix_f(img)
187 |
188 | """计算共生矩阵的相关性"""
189 | correlation_list = list()
190 | for step in range(start_step, end_step):
191 | occurrence_matrix = __get_occurrence_matrix_by_rank_matrix(
192 | rank_matrix=rank_matrix, gray_rank=gray_rank, n_step=step)
193 | correlation = get_correlation(occurrence_matrix)
194 | correlation_list.append(correlation)
195 | return correlation_list
196 |
197 |
198 | # ================================共生矩阵描述子=========================
199 |
200 |
201 | def get_max_probability(occurrence_matrix: np.ndarray):
202 | """给定共生矩阵,返回最大概率
203 |
204 | :param occurrence_matrix: numpy.array, 共生矩阵
205 | :return: float, 最大概率
206 | """
207 | return np.max(occurrence_matrix) / np.sum(occurrence_matrix)
208 |
209 |
210 | def get_correlation(occurrence_matrix: np.ndarray) -> float:
211 | """给定共生矩阵,返回其相关性
212 |
213 | :param occurrence_matrix: numpy.array, 共生矩阵
214 | :return: float, 相关性
215 | """
216 | """概率矩阵"""
217 | prob_matrix = __get_probability_matrix(occurrence_matrix)
218 | """行平均以及列平均"""
219 | row_mean = __get_occurrence_mean(occurrence_matrix, axis=0)
220 | col_mean = __get_occurrence_mean(occurrence_matrix, axis=1)
221 | """行方差以及列方差"""
222 | row_var = __get_occurrence_variance(occurrence_matrix, axis=0)
223 | col_var = __get_occurrence_variance(occurrence_matrix, axis=1)
224 |
225 | """计算相关性"""
226 | correlation_value = 0.
227 | for i_row in range(len(prob_matrix)):
228 | for j_col in range(len(prob_matrix[0])):
229 | tmp = (i_row + 1 - row_mean) * (j_col + 1 -
230 | col_mean) * prob_matrix[i_row][j_col]
231 | tmp /= row_var * col_var
232 | correlation_value += tmp
233 | return correlation_value
234 |
235 |
236 | def get_contrast(occurrence_matrix: np.ndarray) -> float:
237 | """给定共生矩阵,返回其对比度
238 |
239 | :param occurrence_matrix: numpy.array, 共生矩阵
240 | :return: float,对比度
241 | """
242 | prob_matrix = __get_probability_matrix(occurrence_matrix)
243 |
244 | contrast_value = 0.
245 | for i_row in range(len(occurrence_matrix)):
246 | for j_col in range(len(occurrence_matrix[0])):
247 | contrast_value += ((i_row + 1) - (j_col + 1)
248 | ) ** 2 * prob_matrix[i_row][j_col]
249 |
250 | return contrast_value
251 |
252 |
253 | def get_consistency(occurrence_matrix: np.ndarray) -> np.ndarray:
254 | """给定共生矩阵,返回一致性
255 |
256 | :param occurrence_matrix: numpy.array,共生矩阵
257 | :return: float,一致性
258 | """
259 | prob_matrix = __get_probability_matrix(occurrence_matrix)
260 | return np.sum(prob_matrix ** 2)
261 |
262 |
263 | def get_homogeneity(occurrence_matrix: np.ndarray) -> float:
264 | """给定灰度共生矩阵,返回其同质性
265 |
266 | :param occurrence_matrix: numpy.array,灰度共生矩阵
267 | :return: float, 同质性
268 | """
269 | prob_matrix = __get_probability_matrix(occurrence_matrix)
270 |
271 | homogeneity_value = 0.
272 | for i_row in range(len(prob_matrix)):
273 | for j_col in range(len(prob_matrix[0])):
274 | tmp = prob_matrix[i_row][j_col] / \
275 | (1 + abs((i_row + 1) - (j_col + 1)))
276 | homogeneity_value += tmp
277 | return homogeneity_value
278 |
279 |
280 | def get_entropy(occurrence_matrix: np.ndarray) -> float:
281 | """给定灰度共生矩阵,返回信息熵
282 |
283 | :param occurrence_matrix: numpy.array, 灰度共生矩阵
284 | :return: float,信息熵
285 | """
286 | prob_matrix = __get_probability_matrix(occurrence_matrix)
287 | tmp_log_matrix = np.log2(prob_matrix)
288 | '''替换计算熵时出现的无穷小'''
289 | tmp_log_matrix[tmp_log_matrix == -np.inf] = 0
290 |
291 | return - np.sum(prob_matrix * tmp_log_matrix)
292 |
--------------------------------------------------------------------------------
/src/chapter3/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2021/5/21 14:59
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : __init__.py.py
9 | @Title :
10 | @Description :
11 | """
12 |
--------------------------------------------------------------------------------
/src/chapter3/hist_local_enhance.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2021/5/21 15:34
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : hist_local_enhance.py
9 | @Title : 局部直方图增强
10 | @Description :
11 | """
12 | import numpy as np
13 |
14 |
15 | def _location_transform(c_position: int, total: int) -> int:
16 | """位置转换,返回正确位置"""
17 | if c_position < 0:
18 | return 0
19 | elif c_position > total:
20 | return total - 1
21 | else:
22 | return c_position
23 |
24 |
25 | def _is_shadow(local_mean, local_std, global_mean, global_std, k0, k1, k2):
26 | """检测是否是阴影"""
27 | tmp1 = local_mean < k0 * global_mean
28 | tmp2 = (global_std * k1 <= local_std <= global_std * k2)
29 | return tmp1 and tmp2
30 |
31 |
32 | def get_dead_area(img: np.ndarray, local_size=3, k0=0.4, k1=0.02, k2=0.4):
33 | """返回暗色区域"""
34 | """全局均值和标准差"""
35 | global_mean = np.mean(img.flatten())
36 | global_std = np.std(img.flatten())
37 |
38 | """"""
39 | shadow_matrix = np.zeros_like(img)
40 |
41 | """比较"""
42 | h, w, _ = img.shape
43 | local_part_size = np.floor(local_size / 2.)
44 | local_part_size = local_part_size.astype(int)
45 | for i, row in enumerate(img):
46 | for j, pix in enumerate(row):
47 | """局部位置坐标"""
48 | start_i = _location_transform(i - local_part_size, h)
49 | end_i = _location_transform(i + local_part_size, h)
50 | start_j = _location_transform(j - local_part_size, w)
51 | end_j = _location_transform(j + local_part_size, w)
52 |
53 | """局部位置统计数据"""
54 | local_mean = np.mean(img[start_i:end_i, start_j:end_j].flatten())
55 | local_std = np.std(img[start_i:end_i, start_j:end_j].flatten())
56 |
57 | """"""
58 | shadow_matrix[i][j] = _is_shadow(
59 | local_mean, local_std, global_mean, global_std, k0, k1, k2)
60 | return shadow_matrix
61 |
62 |
63 | def local_enhance(img: np.ndarray, local_size=3, k0=0.4, k1=0.02, k2=0.4):
64 | """"""
65 | """获取暗色区域"""
66 | shadow_matrix = get_dead_area(img, local_size, k0, k1, k2)
67 |
68 | """暗色增强"""
69 | tmp1 = img * shadow_matrix * 3
70 | tmp2 = np.logical_not(shadow_matrix)
71 | tmp2 = tmp2.astype(int)
72 | tmp2 = img * tmp2
73 |
74 | return tmp1 + tmp2
75 |
--------------------------------------------------------------------------------
/src/chapter4/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/10/19 13:30
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : __init__.py.py
9 | @Title :
10 | @Description :
11 | """
12 |
--------------------------------------------------------------------------------
/src/chapter4/frequency_dommain.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2021/1/29 9:32
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : frequency_domain.py
9 | @Title :
10 | @Description :
11 | """
12 | import numpy as np
13 |
14 |
15 | def __get_filter(image, d_0: int = 80, high: float = 1.5,
16 | low: float = 0.25, c: int = 1):
17 | """返回同态滤波的滤波器
18 | :param d_0: int, 参数
19 | :param high: float: 参数
20 | :param low: float, 参数
21 | :param c: int, 参数
22 | :return np.array, 滤波器
23 | """
24 | h, w = image.shape
25 | u, v = np.meshgrid(np.arange(w), np.arange(h))
26 | median_u, median_v = np.floor(w / 2), np.floor(h / 2)
27 |
28 | u = u - median_u
29 | v = v - median_v
30 | dist_matrix = u**2 + v**2
31 |
32 | tmp = 1 - np.exp(-c * dist_matrix / (d_0**2))
33 | return (high - low) * tmp + low
34 |
35 |
36 | def homomorphic_filtering(image: np.ndarray) -> np.ndarray:
37 | """同态滤波"""
38 | """时域转频域"""
39 | log_image = np.log1p(image)
40 | fft_image = np.fft.fft2(log_image)
41 | fft_image = np.fft.fftshift(fft_image)
42 |
43 | """滤波"""
44 | h_matrix = __get_filter(fft_image)
45 | fft_image = fft_image * h_matrix
46 |
47 | """频域转时域"""
48 | fft_image = np.fft.ifftshift(fft_image)
49 | tmp_image = np.fft.ifft2(fft_image)
50 | return np.exp(tmp_image).real
51 |
--------------------------------------------------------------------------------
/src/chapter9/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/9/28 17:13
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : __init__.py.py
9 | @Title :
10 | @Description :
11 | """
--------------------------------------------------------------------------------
/src/chapter9/morphology.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/9/28 17:14
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : hit.py
9 | @Title :
10 | @Description :
11 | """
12 | import numpy as np
13 | import cv2
14 |
15 |
16 | def hit(img: np.ndarray, shape1: np.ndarray, shape2: np.ndarray):
17 | """击中
18 |
19 | :param img: numpy.array, 图像
20 | :param shape1: numpy.array, 匹配的模板,即目标模板
21 | :param shape2: numpy.array, 匹配模板的反模板,即背景模板
22 | """
23 | if shape1.dtype != np.uint8 or shape2.dtype != np.uint8:
24 | raise TypeError
25 |
26 | part1 = cv2.erode(img, shape1)
27 | part2 = cv2.erode(1 - img, shape2)
28 |
29 | return np.logical_and((part1 == part2), part1 == 1).astype(int)
30 |
31 |
32 | def connected_area(img:np.ndarray, start_coordination:(int, int)) -> np.ndarray:
33 | """提取连通分量
34 |
35 | :param img: numpy.array, 图像
36 | :param start_coordination: (int,int), 起始位置
37 | """
38 | kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3))
39 |
40 | last_temp_img = np.zeros_like(img)
41 | last_temp_img[start_coordination] = 1
42 | current_temp_img = cv2.dilate(last_temp_img, kernel)
43 |
44 | while (current_temp_img != last_temp_img).any():
45 | last_temp_img = current_temp_img
46 | current_temp_img = cv2.dilate(current_temp_img, kernel)
47 | current_temp_img = np.logical_and((current_temp_img == img), current_temp_img == 1).astype(float)
48 |
49 | return current_temp_img
50 |
51 |
52 | def blank_fill(img:np.ndarray, start_coordination:(int,int)) -> np.ndarray:
53 | """孔洞填充
54 |
55 | :param img: numpy.array, 图像
56 | :param start_coordination: 起始位置
57 | :return: numpy.array:填充结果
58 | """
59 | kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (9, 9))
60 |
61 | last_temp_img = np.zeros_like(img)
62 | last_temp_img[start_coordination] = 1
63 | current_temp_img = cv2.dilate(last_temp_img, kernel)
64 |
65 | while (current_temp_img != last_temp_img).any():
66 | last_temp_img = current_temp_img
67 | current_temp_img = cv2.dilate(current_temp_img, kernel)
68 |
69 | current_temp_img = np.logical_and(current_temp_img == 1, current_temp_img == (1 - img)).astype(float)
70 |
71 | return current_temp_img
72 |
73 |
74 | def rebuild_open(img: np.ndarray, kernel: np.ndarray, erode_time: int = 1) -> np.ndarray:
75 | """重建开操作
76 |
77 | :param img: numpy.array, 图像
78 | :param kernel: numpy.array, 开操作的核
79 | :param erode_time: int, 腐蚀次数
80 | """
81 | """多次腐蚀"""
82 | temp_img = img.copy()
83 | for i in range(erode_time):
84 | temp_img = cv2.erode(temp_img, kernel)
85 |
86 | """测地膨胀"""
87 | dialate_kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3))
88 | last_img = temp_img.copy()
89 |
90 | while True:
91 | current_img = cv2.dilate(last_img, dialate_kernel)
92 | current_img = np.logical_and(current_img == 1, current_img == img)
93 | current_img = current_img.astype(float)
94 |
95 | if (current_img == last_img).all():
96 | break
97 | else:
98 | last_img = current_img
99 |
100 | return current_img
101 |
--------------------------------------------------------------------------------
/src/morphology.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/5/20 17:08
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : morphology.py
9 | @Title :
10 | @Description :
11 | """
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/7/7 14:45
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : __init__.py.py
9 | @Title :
10 | @Description :
11 | """
--------------------------------------------------------------------------------
/tests/chapter10/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2021/5/28 11:12
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : __init__.py.py
9 | @Title :
10 | @Description :
11 | """
12 |
--------------------------------------------------------------------------------
/tests/chapter10/edge_connect/1863694-20191206105727406-2050307115.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/tests/chapter10/edge_connect/1863694-20191206105727406-2050307115.jpg
--------------------------------------------------------------------------------
/tests/chapter10/edge_connect/Fig1137(d)(painting_mirrored_padded).tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qcymkxyc/Image-Process/345905f2fea003e1eca03dcb2c8acf9214cb6158/tests/chapter10/edge_connect/Fig1137(d)(painting_mirrored_padded).tif
--------------------------------------------------------------------------------
/tests/chapter10/edge_connect/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2021/5/28 11:12
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : __init__.py.py
9 | @Title :
10 | @Description :
11 | """
12 |
--------------------------------------------------------------------------------
/tests/chapter10/edge_connect/test_local_connect.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | """
4 | @Time : 2021/5/28 11:12
5 | @Author : Zhang Qi
6 | @Email : zhangqi@onlinesign.com.cn
7 | @File : test_local_connect.py
8 | @Title :
9 | @Description :
10 | """
11 | from src.chapter10.edge_connect import local_connect
12 | import cv2
13 | import matplotlib.pyplot as plt
14 | import unittest
15 |
16 |
17 | class LocalConnectTestCase(unittest.TestCase):
18 | def setUp(self) -> None:
19 | self.img = cv2.imread("1863694-20191206105727406-2050307115.jpg")
20 | self.gray_img = cv2.cvtColor(self.img,cv2.COLOR_RGB2GRAY)
21 | self.binary_img = cv2.threshold(self.gray_img,127,1,cv2.THRESH_BINARY)[1]
22 | self.binary_img = self.binary_img.astype("uint8")
23 |
24 | def test_local_connect(self):
25 | plt.imshow(self.gray_img)
26 | plt.show()
27 |
28 | gray_img = cv2.Laplacian(self.gray_img,-1)
29 | plt.imshow(gray_img)
30 | plt.show()
31 |
32 | res = local_connect.local_connect(self.binary_img,
33 | gradient_angle_threshold=90,
34 | gradient_angle_bandwidth=45,
35 | gradient_value_threshold_rate=0.3)
36 | plt.imshow(res)
37 | plt.show()
38 |
39 |
40 | if __name__ == '__main__':
41 | unittest.main()
42 |
--------------------------------------------------------------------------------
/tests/chapter11/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/7/14 14:49
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : __init__.py.py
9 | @Title :
10 | @Description :
11 | """
--------------------------------------------------------------------------------
/tests/chapter11/test_freeman_code.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2020/7/7 15:13
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : test_freeman_code.py
9 | @Title :
10 | @Description :
11 | """
12 | from unittest import TestCase
13 | import cv2
14 | import unittest
15 | from src.chapter11 import freeman_code
16 | from PIL import Image
17 | import os
18 | import numpy as np
19 |
20 |
21 | def get_freeman_box_list(img, n_box_x, n_box_y):
22 | return freeman_code.__get_freeman_box_list(img, n_box_x, n_box_y)
23 |
24 |
25 | def get_freeman_coordination(point, freeman_x_list, freeman_y_list):
26 | return freeman_code.__get_freeman_coordination(
27 | point, freeman_x_list, freeman_y_list)
28 |
29 |
30 | class FreemanTest(TestCase):
31 | def setUp(self) -> None:
32 | root, _ = os.path.split(os.getcwd())
33 | img_path = os.path.join(root, "image_data")
34 | img_path = os.path.join(
35 | img_path, r"DIP3E_CH11_Original_Images/Fig1105(a)(noisy_stroke).tif")
36 | self.img = Image.open(img_path)
37 | self.img = np.asarray(self.img)
38 |
39 | def test_get_freeman_coordination_by_img(self):
40 | import matplotlib.pyplot as plt
41 | img_path = "../../image_data/DIP3E_CH11_Original_Images/Fig1105(a)(noisy_stroke).tif"
42 | img = Image.open(img_path)
43 | img = np.asarray(img)
44 |
45 | tmp_img = cv2.blur(img, (9, 9))
46 | th, tmp_img = cv2.threshold(
47 | tmp_img, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
48 | image, contours, hierarchy = cv2.findContours(
49 | tmp_img, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
50 | contour = contours[-1]
51 | contour = np.reshape(contour, (contour.shape[0], contour.shape[-1]))
52 | x = [i[0] for i in contour]
53 | y = [i[1] for i in contour]
54 | plt.plot(x, y)
55 | plt.show()
56 |
57 | a = freeman_code.get_freeman_coordination(tmp_img, contour)
58 | x = [i[0] for i in a]
59 | y = [i[1] for i in a]
60 | plt.plot(x, y)
61 | plt.show()
62 |
63 | def test_get_freeman_code(self):
64 | import matplotlib.pyplot as plt
65 | img_path = "../../image_data/DIP3E_CH11_Original_Images/Fig1105(a)(noisy_stroke).tif"
66 | img = Image.open(img_path)
67 | img = np.asarray(img)
68 |
69 | tmp_img = cv2.blur(img, (9, 9))
70 | th, tmp_img = cv2.threshold(
71 | tmp_img, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
72 | image, contours, hierarchy = cv2.findContours(
73 | tmp_img, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
74 | contour = contours[-1]
75 | contour = np.reshape(contour, (contour.shape[0], contour.shape[-1]))
76 | x = [i[0] for i in contour]
77 | y = [i[1] for i in contour]
78 | plt.plot(x, y)
79 | plt.show()
80 |
81 | a = freeman_code.get_freeman_code(tmp_img, contour)
82 | print(a)
83 |
84 | def test_get_freeman_coordination_by_point(self):
85 | freeman_x_list = np.arange(0, 100, 10).tolist()
86 | freeman_y_list = np.arange(0, 100, 10).tolist()
87 |
88 | """刚好在交点上"""
89 | point = (10, 10)
90 | r = get_freeman_coordination(point, freeman_x_list, freeman_y_list)
91 | self.assertEqual(r, (1, 1))
92 |
93 | """在横轴上"""
94 | point = (10, 22)
95 | r = get_freeman_coordination(point, freeman_x_list, freeman_y_list)
96 | self.assertEqual(r, (1, 2))
97 |
98 | """在纵轴上"""
99 | point = (22, 10)
100 | r = get_freeman_coordination(point, freeman_x_list, freeman_y_list)
101 | self.assertEqual(r, (2, 1))
102 |
103 | """没在线上"""
104 | point = (22, 22)
105 | r = get_freeman_coordination(point, freeman_x_list, freeman_y_list)
106 | self.assertIsNone(r)
107 |
108 | def test_get_freeman_box_list(self):
109 | n_box_x = 10
110 | n_box_y = 10
111 | x_list, y_list = get_freeman_box_list(self.img, n_box_x, n_box_y)
112 | self.assertEqual(len(x_list), n_box_x + 1)
113 | self.assertEqual(len(y_list), n_box_y + 1)
114 |
115 | img_h, img_w = self.img.shape
116 | self.assertLessEqual(x_list[-1], img_w)
117 | self.assertLessEqual(x_list[-1], img_h)
118 |
119 |
120 | if __name__ == "__main__":
121 | unittest.main()
122 |
--------------------------------------------------------------------------------
/tests/chapter11/test_mark_sheet.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | """
4 | @Time : 2020/7/10 14:25
5 | @Author : Zhang Qi
6 | @Email : zhangqi@onlinesign.com.cn
7 | @File : test_mark_sheet.py
8 | @Title :
9 | @Description :
10 | """
11 | import unittest
12 | from PIL import Image
13 | import numpy as np
14 | from src.chapter11 import mark_sheet
15 |
16 |
17 | class MarkSheetTestCase(unittest.TestCase):
18 | def setUp(self) -> None:
19 | img_path = r"../../image_data/DIP3E_CH11_Original_Images/Fig1111(a)(triangle).tif"
20 | self.img = Image.open(img_path)
21 | self.img = np.asarray(self.img)
22 | self.img = self.img.astype(np.uint8)
23 |
24 | def test_get_centroid(self):
25 | centroid = mark_sheet.get_centroid(self.img)
26 | print(centroid)
27 | import matplotlib.pyplot as plt
28 | plt.imshow(self.img, cmap="gray")
29 | plt.plot([centroid[1]], [centroid[0]], linewidth="10", color="green")
30 | plt.show()
31 |
32 | def test_get_mark_sheet(self):
33 | r = mark_sheet.get_mark_sheet(self.img)
34 | import matplotlib.pyplot as plt
35 | plt.plot(r)
36 | plt.show()
37 |
38 |
39 | if __name__ == '__main__':
40 | unittest.main()
41 |
--------------------------------------------------------------------------------
/tests/chapter11/test_moment_invariants.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | """
4 | @Time : 2020/9/25 15:39
5 | @Author : Zhang Qi
6 | @Email : zhangqi@onlinesign.com.cn
7 | @File : test_moment_invariants.py
8 | @Title :
9 | @Description :
10 | """
11 | import unittest
12 | from src.chapter11 import moment_invariants
13 | import numpy as np
14 | from PIL import Image
15 |
16 |
17 | class MomentInvariantsTestCase(unittest.TestCase):
18 | def setUp(self) -> None:
19 | img_path = r"../../image_data/DIP3E_CH11_Original_Images/Fig1137(a)(painting_original_padded).tif"
20 | self.img = Image.open(img_path)
21 | self.img = np.asarray(self.img)
22 | self.img = self.img.astype(np.uint8)
23 |
24 | def test_get_moment_invariants_seq(self):
25 | moment_invariants.get_moment_invariants_seq(self.img)
26 |
27 |
28 | if __name__ == '__main__':
29 | unittest.main()
30 |
--------------------------------------------------------------------------------
/tests/chapter11/test_shape_number.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | """
4 | @Time : 2020/7/14 14:50
5 | @Author : Zhang Qi
6 | @Email : zhangqi@onlinesign.com.cn
7 | @File : test_shape_number.py
8 | @Title :
9 | @Description :
10 | """
11 | import unittest
12 | from src.chapter11 import shape_number
13 | import os
14 | from PIL import Image
15 | import numpy as np
16 |
17 |
18 | def get_shape_number_by_freeman_difference(
19 | freeman_difference_list: [int]) -> [int]:
20 | return shape_number.__get_shape_number_by_freeman_difference(freeman_difference_list)
21 |
22 |
23 | class ShapeNumberTestCase(unittest.TestCase):
24 | def setUp(self) -> None:
25 | root, _ = os.path.split(os.getcwd())
26 | root = os.path.split(root)[0]
27 | img_path = os.path.join(root, "image_data")
28 | img_path = os.path.join(
29 | img_path, r"DIP3E_CH11_Original_Images/Fig1105(a)(noisy_stroke).tif")
30 | self.img = Image.open(img_path)
31 | self.img = np.asarray(self.img)
32 |
33 | def test_shape_number_by_freeman_difference(self):
34 | x = np.random.randint(0, 8, size=10)
35 | print(x)
36 | y = get_shape_number_by_freeman_difference(x)
37 | print(np.asarray(y))
38 |
39 | def test_get_shape_number(self):
40 | pass
41 |
42 |
43 | if __name__ == '__main__':
44 | unittest.main()
45 |
--------------------------------------------------------------------------------
/tests/chapter11/test_texture.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | """
4 | @Time : 2020/7/24 11:16
5 | @Author : Zhang Qi
6 | @Email : zhangqi@onlinesign.com.cn
7 | @File : test_texture.py
8 | @Title :
9 | @Description :
10 | """
11 | import unittest
12 | from src.chapter11 import texture
13 | import numpy as np
14 |
15 |
16 | def get_rank_list(grak_rank, max_value=255, min_value=0):
17 | return texture.__get_rank_list(grak_rank, max_value, min_value)
18 |
19 |
20 | def get_rank_index(gray_value: int, rank_list: [int]) -> int:
21 | return texture.__get_rank_index(gray_value, rank_list)
22 |
23 |
24 | def get_occurrence_mean(occurrence_matrix,axis):
25 | return texture.__get_occurrence_mean(occurrence_matrix,axis)
26 |
27 | def get_occurrence_variance(occurrence_matrix,axis):
28 | return texture.__get_occurrence_variance(occurrence_matrix,axis)
29 |
30 | class TextureTestCase(unittest.TestCase):
31 | def test_get_rank_list(self):
32 | rank_list = get_rank_list(8)
33 | print(rank_list)
34 | self.assertEqual(len(rank_list), 9)
35 |
36 | def test_get_rank_index(self):
37 | rank_list = get_rank_list(8)
38 | print(rank_list)
39 | gray_value = 130
40 | rank_index = get_rank_index(gray_value, rank_list=rank_list)
41 | self.assertEqual(rank_index, 4)
42 |
43 | rank_index = get_rank_index(255, rank_list=rank_list)
44 | print(rank_index)
45 | self.assertEqual(rank_index, 7)
46 |
47 | rank_index = get_rank_index(0, rank_list)
48 | self.assertEqual(rank_index, 0)
49 |
50 | def test_co_occurrence_matrix(self):
51 | img = np.random.randint(0, 255, size=(10, 10))
52 | occurrence_matrix = texture.get_co_occurrence_matrix(img)
53 | print(occurrence_matrix)
54 |
55 | def test_get_mean(self):
56 | occurrence_matrix = np.arange(16).reshape((4,4))
57 | value = get_occurrence_mean(occurrence_matrix,axis = 0)
58 | print(value)
59 |
60 | value = get_occurrence_mean(occurrence_matrix, axis=1)
61 | print(value)
62 |
63 | def test_get_occurrence_variance(self):
64 | occurrence_matrix = np.arange(16).reshape((4,4))
65 | var_value = get_occurrence_variance(occurrence_matrix,axis = 0)
66 | print(var_value)
67 |
68 | var_value = get_occurrence_variance(occurrence_matrix,axis = 1)
69 | print(var_value)
70 |
71 | def test_get_correlation(self):
72 | occurrence_matrix = np.arange(16).reshape((4,4))
73 | occurrence_value = texture.get_correlation(occurrence_matrix)
74 | print(occurrence_value)
75 |
76 | def test_get_contrast(self):
77 | occurrence_matrix = np.arange(16).reshape((4,4))
78 | contrast_value = texture.get_contrast(occurrence_matrix)
79 | print(contrast_value)
80 |
81 | def test_get_entropy(self):
82 | occurrence_matrix = np.arange(16).reshape((4, 4))
83 | entropy_value = texture.get_entropy(occurrence_matrix)
84 | print(entropy_value)
85 |
86 |
87 | if __name__ == '__main__':
88 | unittest.main()
89 |
--------------------------------------------------------------------------------
/tests/chapter3/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # cython: language_level=3
4 | """
5 | @Time : 2021/5/28 17:08
6 | @Author : Zhang Qi
7 | @Email : zhangqi@onlinesign.com.cn
8 | @File : __init__.py.py
9 | @Title :
10 | @Description :
11 | """
12 |
--------------------------------------------------------------------------------