|
@@ -105,11 +105,9 @@
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
- "cell_type": "code",
|
|
|
- "execution_count": 16,
|
|
|
- "id": "7ceb6a7b-2072-4b9b-9874-4c7faec07afe",
|
|
|
+ "cell_type": "markdown",
|
|
|
+ "id": "cad2c161-aac5-480a-97ab-53422e37a04e",
|
|
|
"metadata": {},
|
|
|
- "outputs": [],
|
|
|
"source": [
|
|
|
"# 2.图像的属性"
|
|
|
]
|
|
@@ -120,6 +118,53 @@
|
|
|
"id": "9e93da9e-6b85-4483-919e-b1d3a89bb2b7",
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
+ "source": [
|
|
|
+ "#打开"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "markdown",
|
|
|
+ "id": "0592b3dc-3485-4430-b93f-0e975984198d",
|
|
|
+ "metadata": {},
|
|
|
+ "source": [
|
|
|
+ "#3. 图像的像素与通道"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 22,
|
|
|
+ "id": "c6e3b010-0f7d-427f-88c8-aade9016eab9",
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [
|
|
|
+ {
|
|
|
+ "ename": "TypeError",
|
|
|
+ "evalue": "'NoneType' object is not subscriptable",
|
|
|
+ "output_type": "error",
|
|
|
+ "traceback": [
|
|
|
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
|
|
+ "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
|
|
|
+ "Cell \u001b[1;32mIn[22], line 8\u001b[0m\n\u001b[0;32m 5\u001b[0m img\u001b[38;5;241m=\u001b[39mcv2\u001b[38;5;241m.\u001b[39mimread(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgpu.bmp\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 7\u001b[0m \u001b[38;5;66;03m#print(img[0][0][0])\u001b[39;00m\n\u001b[1;32m----> 8\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mimg\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m)\n",
|
|
|
+ "\u001b[1;31mTypeError\u001b[0m: 'NoneType' object is not subscriptable"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "source": [
|
|
|
+ "# bmp:位图(原始存放像素):图像大,不适合网络,图像保真度高\n",
|
|
|
+ "# jpg 压缩存放:RGB,图像大小合适,主流的网路图片格式\n",
|
|
|
+ "# png 高压缩RGBA,有透明度\n",
|
|
|
+ "# gif 动图\n",
|
|
|
+ "img=cv2.imread(\"gpu.bmp\")\n",
|
|
|
+ "\n",
|
|
|
+ "#print(img[0][0][0])\n",
|
|
|
+ "print(img[0,0,0])\n"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": null,
|
|
|
+ "id": "0c5170d5-0759-41fb-ad25-acf659c5d2c9",
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [],
|
|
|
"source": []
|
|
|
}
|
|
|
],
|