(Updated 2016.5.7) Support for Raspberry Pi (Updated September 22, 2016) Corrected the spelling of Professor Kanade ⇒ Takeo Kanade, the man who gave the robot "eyes": Meet the Legend | WIRED.jp 04 / interview-takeo-kanade /)
Optical Flow | Wikipedia is one of the methods to analyze the movement of images. When I want to use this, I have put together a sample that is easy to try.
You can find some samples of Optical Flow | Wikipedia by searching the Web. Especially the OpenCV article and the attached sample are easy to understand.
Also, especially here, in principle it is very helpful,
-Dynamic image captured by OpenCV, Optical Flow | Qiita
The following explanation linked from there is very easy to understand, and it will help you think about how to apply it.
-Tutorial of the Society of Quantitative Biology What are image informatics researchers doing?
I tried several, so as a "summary", I tried to make it possible to comprehensively check the movement when the webcam image is input to OpenCV. (Samples may be scattered in pieces)
I put it here. clone
$ git clone https://github.com/daisukelab/cv_opt_flow.git
$ cd cv_opt_flow
You can try it by running main.py (* camera required, built-in laptop, etc.).
For Raspberry Pi, execute raspi_main.py.
$ python main.py Hit followings to switch to: 1 - Dense optical flow by HSV color image (default); 2 - Dense optical flow by lines; 3 - Dense optical flow by warped image; 4 - Lucas-Kanade method.
Hit 's' to save image.
Hit 'f' to flip image horizontally.
Hit ESC to exit. (The preview window opens and the analysis result is displayed in real time)
Each display is classified separately in OpticalFlowShowcase.py.
This is a sample when you slowly wave your hand from side to side.
Recommended Posts