Город МОСКОВСКИЙ
00:07:58

Using OpenCV and Python 3 for neuroscience research 1.1: Getting video parameters

Аватар
Python интернет-безопасность
Просмотры:
25
Дата загрузки:
02.12.2023 16:39
Длительность:
00:07:58
Категория:
Обучение

Описание

In this series we will use Python and OpenCV to help analyse simple behavioural experiments that are commonly used in neuroscience research.

So far, we have created a program that will read a video file and then display that to a named window (“OFT”, in this example). What we should do next is begin to get the while loop to look at the video capture object status (instead of just being set to True). This will be important for appropriate program execution (if and when our program becomes more complicated).

We notice that the playback of the video file seems to be too quick and so we should get some of the video properties. To get these properties we look at the cv2 (OpenCV) class reference documentation and see that we can use cv2 to get many different frame and recording properties. In our experiment we are interested in: 1) the frame width (pixels), 2) the frame height (pixels) and 3) the frames per second of the video file. Once we have access to these properties we can now start to control the speed of the play back, and we will be able to convert the position of the mouse (or beetle in this example) from pixels, to cm.

Disclaimer.
This is not designed to be a complete Python or OpenCV programming course, however it will be necessary to touch on different aspects of python programming as we learn to read and analyse video files generated from typical behavioural experiments.

Software used in these videos
Python (for windows) : http://python.org
Opencv: https://opencv.org/
Using pip installer: https://pypi.org/project/opencv-python/
Psychopy: http://psychopy.org
Atom Editor: http://atom.io

I hope these videos are helpful.

Рекомендуемые видео