Style (commas after , and around +)
Esse commit está contido em:
@@ -132,7 +132,7 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"block = img_slice[80:88,40:48]\n",
|
||||
"block = img_slice[80:88, 40:48]\n",
|
||||
"\n",
|
||||
"quantize_step = 5\n",
|
||||
"\n",
|
||||
@@ -194,7 +194,7 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"plt.imshow(dct_slice, interpolation='nearest',cmap=plt.cm.Paired)\n",
|
||||
"plt.imshow(dct_slice, interpolation='nearest', cmap=plt.cm.Paired)\n",
|
||||
"plt.colorbar(shrink=1)"
|
||||
]
|
||||
},
|
||||
@@ -224,7 +224,7 @@
|
||||
],
|
||||
"source": [
|
||||
"# a 8x8 block\n",
|
||||
"block = img_slice[80:88,40:48]\n",
|
||||
"block = img_slice[80:88, 40:48]\n",
|
||||
"\n",
|
||||
"# a 2D DCT\n",
|
||||
"dct_slice = fftpack.dct(fftpack.dct(block.T, norm='ortho').T, norm='ortho')\n",
|
||||
@@ -234,8 +234,8 @@
|
||||
"# keeps only the top left 5 element triangle\n",
|
||||
"for u in range(8):\n",
|
||||
" for v in range(8):\n",
|
||||
" if (u+v) >5:\n",
|
||||
" dct_slice[u,v] = 0\n",
|
||||
" if (u + v) > 5:\n",
|
||||
" dct_slice[u, v] = 0\n",
|
||||
"\n",
|
||||
"print(\"It compressed \", 100 - ((np.count_nonzero(dct_slice)/64) * 100), \"% of the block.\")"
|
||||
]
|
||||
@@ -273,7 +273,7 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"np.set_printoptions(precision=1,linewidth=140, suppress=True)\n",
|
||||
"np.set_printoptions(precision=1, linewidth=140, suppress=True)\n",
|
||||
"block"
|
||||
]
|
||||
},
|
||||
@@ -385,11 +385,11 @@
|
||||
"\n",
|
||||
"plt1.axis('off');\n",
|
||||
"plt1.set_title('Original')\n",
|
||||
"plt1.imshow(block, cmap='gray',interpolation='nearest')\n",
|
||||
"plt1.imshow(block, cmap='gray', interpolation='nearest')\n",
|
||||
"\n",
|
||||
"plt2.axis('off');\n",
|
||||
"plt2.set_title('Quantized')\n",
|
||||
"plt2.imshow(idct_slice, cmap='gray',interpolation='nearest')"
|
||||
"plt2.imshow(idct_slice, cmap='gray', interpolation='nearest')"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário