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