Skip to content

Instantly share code, notes, and snippets.

@ochi46
Created November 18, 2022 07:41
Show Gist options
  • Save ochi46/c94c19bdd227532ccdbc999656a7d971 to your computer and use it in GitHub Desktop.
Save ochi46/c94c19bdd227532ccdbc999656a7d971 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "e5064da7-5d27-40f5-bfe0-946b5ae5e3bb",
"metadata": {},
"outputs": [],
"source": [
"import cv2"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "8255373c-bed0-4da5-b0c7-c935ef91f551",
"metadata": {},
"outputs": [],
"source": [
"img = cv2.imread(\"rin.jpg\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "e809dd01-3c37-4898-9a47-fdad662848d0",
"metadata": {},
"outputs": [],
"source": [
"cv2.imshow(\"test\",img)\n",
"cv2.waitKey(0)\n",
"cv2.destroyAllWindows()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "38fca1d9-cb09-421c-be45-96dc0a6fcbb8",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(3000, 4000, 3)\n"
]
}
],
"source": [
"print(img.shape)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "57b70044-9645-41e1-b539-0015aed2f2fa",
"metadata": {},
"outputs": [],
"source": [
"dst=cv2.resize(img,dsize=(400,300))"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "ad08c44d-d5b6-4e23-bb7e-23b91a63a68d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(300, 400, 3)\n"
]
}
],
"source": [
"print(dst.shape)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "a87fccf1-275d-45f2-a231-d5d30f775bad",
"metadata": {},
"outputs": [],
"source": [
"cv2.imshow(\"test\",dst)\n",
"cv2.waitKey(0)\n",
"cv2.destroyAllWindows()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "79555121-c0e8-49d3-9147-e4af13b6f2e2",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"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.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment