constrast.ipynb 1.29 KB
Newer Older
Nianchen Deng's avatar
sync    
Nianchen Deng committed
1
2
3
4
{
 "cells": [
  {
   "cell_type": "code",
5
   "execution_count": null,
Nianchen Deng's avatar
sync    
Nianchen Deng committed
6
   "metadata": {},
7
   "outputs": [],
Nianchen Deng's avatar
sync    
Nianchen Deng committed
8
   "source": [
Nianchen Deng's avatar
sync    
Nianchen Deng committed
9
    "from common import *\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
10
11
    "from components import refine\n",
    "from utils import img\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
12
    "\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
13
    "img = img.load(rootdir / \"data/gas_2021.01.04_all_in_one/output/mid_0536.png\")\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
14
15
16
17
18
    "\n",
    "fe = 0.2\n",
    "leng_sigma = [0,3,5]\n",
    "\n",
    "mean, enhanced = refine.constrast_enhance(img, 3, 0.5)\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
19
    "img.save(enhanced, \"mid_enhanced.png\")\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
20
21
22
    "\n",
    "plt.figure(figsize=(12,12))\n",
    "plt.subplot(121)\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
23
    "img.plot(img)\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
24
25
26
    "plt.title('Original')\n",
    "plt.axis('off')\n",
    "plt.subplot(122)\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
27
    "img.plot(enhanced)\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
28
29
    "plt.title('Enhanced')\n",
    "plt.axis('off')\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
30
    "plt.show()"
Nianchen Deng's avatar
sync    
Nianchen Deng committed
31
32
33
34
35
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
Nianchen Deng's avatar
sync    
Nianchen Deng committed
36
37
   "display_name": "Python 3.7.9 64-bit ('pytorch': conda)",
   "name": "python379jvsc74a57bd0660ca2a75467d3af74a68fcc6f40bc78ab96b99ff17d2f100b5ca821fbb183f2"
Nianchen Deng's avatar
sync    
Nianchen Deng committed
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  },
  "orig_nbformat": 2
 },
 "nbformat": 4,
 "nbformat_minor": 2
Nianchen Deng's avatar
sync    
Nianchen Deng committed
55
}