test_ycbcr.ipynb 1.41 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
9
10
11
12
   "source": [
    "import sys\n",
    "import os\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
13
14
    "os.chdir('../')\n",
    "sys.path.append(os.getcwd())\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
15
    "\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
16
17
    "from utils import img\n",
    "from utils import color\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
18
    "\n",
19
    "input_img = img.load('data/gas_fovea_2020.12.31/upsampling_test/input/out_view_0000.png')\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
20
21
    "ycbcr = color.rgb2ycbcr(input_img)\n",
    "rgb = color.ycbcr2rgb(ycbcr)\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
22
23
    "\n",
    "plt.figure()\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
24
    "img.plot(input_img)\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
25
26
    "plt.figure()\n",
    "plt.subplot(1, 4, 1)\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
27
    "img.plot(ycbcr)\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
28
    "plt.subplot(1, 4, 2)\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
29
    "img.plot(ycbcr[:, 0])\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
30
    "plt.subplot(1, 4, 3)\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
31
    "img.plot(ycbcr[:, 1])\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
32
    "plt.subplot(1, 4, 4)\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
33
    "img.plot(ycbcr[:, 2])\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
34
    "plt.figure()\n",
Nianchen Deng's avatar
sync    
Nianchen Deng committed
35
    "img.plot(rgb)\n"
Nianchen Deng's avatar
sync    
Nianchen Deng committed
36
37
38
39
40
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
Nianchen Deng's avatar
sync    
Nianchen Deng committed
41
42
   "display_name": "Python 3.7.9 64-bit ('pytorch': conda)",
   "name": "python379jvsc74a57bd0660ca2a75467d3af74a68fcc6f40bc78ab96b99ff17d2f100b5ca821fbb183f2"
Nianchen Deng's avatar
sync    
Nianchen Deng committed
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  },
  "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
}