Skip to content

Commit ff14cef

Browse files
committed
Added optimal flow
1 parent 5f6df23 commit ff14cef

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

OpticalFlow_try.ipynb

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "d7f2c5dd",
6+
"metadata": {},
7+
"source": [
8+
"# Optical Flow"
9+
]
10+
},
11+
{
12+
"cell_type": "markdown",
13+
"id": "6e3c585f",
14+
"metadata": {},
15+
"source": [
16+
"</br><div align=\"center\"> <b> <font size=\"3\" color='green'>cv2.calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts, winSize, maxLevel)</font></b> </div>\n",
17+
"<b>prevImg: </b>first 8-bit input image. </br>\n",
18+
"<b>nextImg: </b>second input image. </br>\n",
19+
"<b>prevPts: </b>vector of 2D points for which the flow needs to be found.</br>\n",
20+
"<b>nextPts: </b>vector of 2D points for which the flow needs to be found.</br>\n",
21+
"<b>winSize: </b> size of the search window at each pyramid level.</br>\n",
22+
"<b>maxLevel: </b> 0-based maximal pyramid level number; if set to 0, pyramids are not used (single level), if set to 1, two levels are used, and so on."
23+
]
24+
},
25+
{
26+
"cell_type": "markdown",
27+
"id": "cf3e22a6",
28+
"metadata": {},
29+
"source": [
30+
"</br><div align=\"center\"> <b> <font size=\"3\" color='green'> cv2.calcOpticalFlowFarneback(prev, next, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma)</font></b> </div>\n",
31+
"\n",
32+
"<b>prev: </b> First input image in 8-bit single channel format.\n",
33+
"\n",
34+
"next : Second input image of same type and same size as prev.\n",
35+
"\n",
36+
"pyr_scale : parameter specifying the image scale to build pyramids for each image (scale < 1). A classic pyramid is of \n",
37+
"generally 0.5 scale, every new layer added, it is halved to the previous one.\n",
38+
"\n",
39+
"levels : levels=1 says, there are no extra layers (only the initial image) . It is the number of pyramid layers including the first image.\n",
40+
"\n",
41+
"winsize : It is the average window size, larger the size, the more robust the algorithm is to noise, and provide fast motion detection, though gives blurred motion fields.\n",
42+
"\n",
43+
"iterations : Number of iterations to be performed at each pyramid level.\n",
44+
"\n",
45+
"poly_n : It is typically 5 or 7, it is the size of the pixel neighbourhood which is used to find polynomial expansion between the pixels.\n",
46+
"\n",
47+
"poly_sigma : standard deviation of the gaussian that is for derivatives to be smooth as the basis of the polynomial expansion. It can be 1.1 for poly= 5 and 1.5 for poly= 7."
48+
]
49+
}
50+
],
51+
"metadata": {
52+
"kernelspec": {
53+
"display_name": "Python 3 (ipykernel)",
54+
"language": "python",
55+
"name": "python3"
56+
},
57+
"language_info": {
58+
"codemirror_mode": {
59+
"name": "ipython",
60+
"version": 3
61+
},
62+
"file_extension": ".py",
63+
"mimetype": "text/x-python",
64+
"name": "python",
65+
"nbconvert_exporter": "python",
66+
"pygments_lexer": "ipython3",
67+
"version": "3.7.11"
68+
}
69+
},
70+
"nbformat": 4,
71+
"nbformat_minor": 5
72+
}

0 commit comments

Comments
 (0)