Skip to content

Commit 8a97df7

Browse files
committed
Colaboratory를 통해 생성됨
1 parent 568266d commit 8a97df7

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

Diff for: 11. OpenCV Tracker/OpenCV Tracker.ipynb

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"nbformat": 4,
3+
"nbformat_minor": 0,
4+
"metadata": {
5+
"colab": {
6+
"name": "OpenCV Tracker",
7+
"version": "0.3.2",
8+
"provenance": [],
9+
"include_colab_link": true
10+
},
11+
"kernelspec": {
12+
"name": "python3",
13+
"display_name": "Python 3"
14+
}
15+
},
16+
"cells": [
17+
{
18+
"cell_type": "markdown",
19+
"metadata": {
20+
"id": "view-in-github",
21+
"colab_type": "text"
22+
},
23+
"source": [
24+
"<a href=\"https://colab.research.google.com/github/ndb796/Python-Data-Analysis-and-Image-Processing-Tutorial/blob/master/11.%20OpenCV%20Tracker/OpenCV%20Tracker.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
25+
]
26+
},
27+
{
28+
"cell_type": "markdown",
29+
"metadata": {
30+
"id": "o9DKbjierGO_",
31+
"colab_type": "text"
32+
},
33+
"source": [
34+
"## OpenCV Tracker\n",
35+
"[강의 노트](https://github.com/ndb796/Python-Data-Analysis-and-Image-Processing-Tutorial/blob/master/11.%20OpenCV%20Tracker/Python%20%EB%8D%B0%EC%9D%B4%ED%84%B0%20%EB%B6%84%EC%84%9D%EA%B3%BC%20%EC%9D%B4%EB%AF%B8%EC%A7%80%20%EC%B2%98%EB%A6%AC%20-%20OpenCV%20Tracker.pdf)"
36+
]
37+
},
38+
{
39+
"cell_type": "markdown",
40+
"metadata": {
41+
"id": "JOEp9Hg0rI8a",
42+
"colab_type": "text"
43+
},
44+
"source": [
45+
"cv2.createTracker(track_bar, name, window_name, value, count, on_change): Tracker를 생성하는 함수\n",
46+
"\n",
47+
"- value: 초기 값\n",
48+
"- count: Max 값 (Min: 0)\n",
49+
"- on_change: 값이 변경될 때 호출되는 Callback 함수\n",
50+
"\n",
51+
"cv2.getTrackerPos(track_bar, name, window_name): Tracker로부터 값을 얻어 오는 함수"
52+
]
53+
},
54+
{
55+
"cell_type": "markdown",
56+
"metadata": {
57+
"id": "6XrNbFUzr1vy",
58+
"colab_type": "text"
59+
},
60+
"source": [
61+
"### OpenCV Tracker 실습\n",
62+
"\n",
63+
"- *본 실습은 PyCharm등의 **개인 개발환경에서 진행**하세요.*"
64+
]
65+
},
66+
{
67+
"cell_type": "code",
68+
"metadata": {
69+
"id": "knbs8aM7rmyD",
70+
"colab_type": "code",
71+
"colab": {}
72+
},
73+
"source": [
74+
"import cv2\n",
75+
"import numpy as np\n",
76+
"\n",
77+
"def change_color(x):\n",
78+
" r = cv2.getTrackbarPos(\"R\", \"Image\")\n",
79+
" g = cv2.getTrackbarPos(\"G\", \"Image\")\n",
80+
" b = cv2.getTrackbarPos(\"B\", \"Image\")\n",
81+
" image[:] = [b, g, r]\n",
82+
" cv2.imshow('Image', image)\n",
83+
" \n",
84+
"image = np.zeros((600, 400, 3), np.uint8)\n",
85+
"cv2.namedWindow(\"Image\")\n",
86+
"\n",
87+
"cv2.createTrackbar(\"R\", \"Image\", 0, 255, change_color)\n",
88+
"cv2.createTrackbar(\"G\", \"Image\", 0, 255, change_color)\n",
89+
"cv2.createTrackbar(\"B\", \"Image\", 0, 255, change_color)\n",
90+
"\n",
91+
"cv2.imshow('Image', image)\n",
92+
"cv2.waitKey(0)"
93+
],
94+
"execution_count": 0,
95+
"outputs": []
96+
}
97+
]
98+
}

0 commit comments

Comments
 (0)