reworked images
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -27,7 +27,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -58,17 +58,26 @@
|
||||
"\n",
|
||||
"Qualify the noise and sharpness in the images. Make a plot images, noise\n",
|
||||
"\n",
|
||||
"Please download sample picture from [here](http://www.imageprocessingplace.com/downloads_V3/root_downloads/image_databases/standard_test_images.zip)"
|
||||
"Please download sample picture from [here](http://sipi.usc.edu/database/misc.zip)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Load the pictures here\n",
|
||||
"sample_images = None"
|
||||
"sample_images = []\n",
|
||||
"direc = 'misc/' # directory of the sample pictures realtivly to your notebook\n",
|
||||
"for number in [1,3,5,6]:\n",
|
||||
" sample_images.append(\n",
|
||||
" np.array(Image.open(direc+'4.2.0'+str(number)+'.tiff'))\n",
|
||||
" )\n",
|
||||
"for name in ['house', 'ruler.512']:\n",
|
||||
" sample_images.append(\n",
|
||||
" np.array(Image.open(direc+name+'.tiff'))\n",
|
||||
" )"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -117,15 +126,13 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def jpeg_enocde(img, quality):\n",
|
||||
" pil_img = Image.fromarray(img)\n",
|
||||
" buffer = BytesIO()\n",
|
||||
" im1.save(buffer, \"JPEG\", quality=quality)\n",
|
||||
" pil_img.save(buffer, \"JPEG\", quality=quality)\n",
|
||||
" return buffer\n",
|
||||
"\n",
|
||||
"def jpeg_decode(buffer):\n",
|
||||
@@ -137,15 +144,6 @@
|
||||
" return jpeg_decode(as_jpeg)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"len(images_for_jpeg)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
@@ -169,7 +167,7 @@
|
||||
" # your code\n",
|
||||
" return random.randint(0, 10)\n",
|
||||
"\n",
|
||||
"for i, img in enumerate(images_for_jpeg):\n",
|
||||
"for i, img in enumerate(sample_images):\n",
|
||||
" print(i)\n",
|
||||
" compressed_images = [images10[i], images50[i], images80[i]]\n",
|
||||
" plt.bar(range(len(compressed_images)),\n",
|
||||
@@ -180,9 +178,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user