Skip to content

Commit f3c640d

Browse files
committed
resizing
1 parent 9e3763e commit f3c640d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Image_manipulation_1.ipynb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,39 @@
7272
"cv2.destroyAllWindows()"
7373
]
7474
},
75+
{
76+
"cell_type": "markdown",
77+
"metadata": {},
78+
"source": [
79+
"# Scaling"
80+
]
81+
},
82+
{
83+
"cell_type": "code",
84+
"execution_count": 1,
85+
"metadata": {},
86+
"outputs": [],
87+
"source": [
88+
"import cv2\n",
89+
"import numpy as np\n",
90+
"\n",
91+
"pic = cv2.imread(\"cvimg.jpg\")\n",
92+
"\n",
93+
"scale_image = cv2.resize(pic,None,fx = 0.75,fy = 0.75)\n",
94+
"cv2.imshow(\"Scaling without interpolation\",scale_image)\n",
95+
"cv2.waitKey(0)\n",
96+
"\n",
97+
"scale_image_cubic = cv2.resize(pic,None,fx = 2,fy = 2,interpolation = cv2.INTER_CUBIC)\n",
98+
"cv2.imshow(\"Scaling with Cubic interpolation\",scale_image_cubic)\n",
99+
"cv2.waitKey(0)\n",
100+
"\n",
101+
"scale_image_skewed = cv2.resize(pic,(900,400),scale_image,interpolation = cv2.INTER_CUBIC)\n",
102+
"cv2.imshow(\"Scaling-skewed\",scale_image_skewed)\n",
103+
"cv2.waitKey(0)\n",
104+
"\n",
105+
"cv2.destroyAllWindows()"
106+
]
107+
},
75108
{
76109
"cell_type": "code",
77110
"execution_count": null,

0 commit comments

Comments
 (0)