HomeHow to use Kinovea to capture/record & measure and annotate images with machine vision cameras
How to use Kinovea to capture/record & measure and annotate images with machine vision cameras
Kinovea is an open-source video recording, measurement and annotation tool, designed for image visualization, recording, measurement, annotation and (high-speed) motion analysis. It enables the user to capture, compare, annotate and measure motion in videos. It can record high speed cameras and play the recorded video back in slow motion. Kinovea is used in many markets such as:
sports (tracking the movement of athletes to improve the athletics’ technique)
labs (analysis of images made by a microscope)
industrial automation (use the slow-motion feature to debug mechanical problems with a machine)
This article is a step-by-step walkthrough explaining how to install Kinovea on your device, set up your recording parameters and take basic measurements and annotations.
Please note that GeT Cameras does not provide further support for Kinovea. For support, please contact Kinovea.
Step 1: Install Kinovea and the Daheng Plugin
To install the Kinovea software, go to the Kinovea download page and install both Kinovea and the Daheng plugin.
Open the readme.txt and follow the instructions.
Step 2: Acquire images from the camera
Do you first still need help selecting the right camera for this application? Please fill in the form below.
After installing Kinovea and the required plugin, you can start capturing live images. Double click on the camera name. You should get the live image of your camera.
To change the camera parameters, click on the little wrench in the down left corner
You will now see a pop-up with the camera parameters
Step 3: Capture an image or record a video in Kinovea
You are now ready to record videos or save single images. In the toolbar below, you have several options.
For capturing a single image, click on the photo camera icon under the capture screen.
For recording a video click on the red dot under the capture screen.
To change the default capturing / recording parameters go to options -> preferences->Capture. For more information about setting the perfect capturing parameters, see appendix 1, advanced video capture settings and the high-speed recording paragraph at the end of this article.
Step 4: (slow) motion playback
Kinovea is commonly used to play highspeed recordings back in slow motion. When playing back a recorded video, you can use this menu to control the playback speed, measure time, and take screenshots.
In Kinovea it’s possible to annotate images and video. Here a sum up of the most used annotation examples:
Example 1: Measuring Distances on a parallel surface
Thanks to the great annotation tools integrated in Kinovea, it is possible to measure distances. To measure lines on your acquired image, first draw a line using the line button marked yellow below.
Then left click on the line, select Display measure -> Length. Now the length in pixel is displayed.
To get the exact measuring in millimeters, you need a ruler, or an object that you know the size of in your image. Put the object in your image and draw a line, which length you know (like shown in the image below).
We know that this line is exactly 26 centimeters long. We do a left mouse click on the line and go to calibrate. Here we fill in the real length of the line (in our case 26 centimeters) and click on apply. Now every line that we draw from this point on is shown in the centimeters and we can start measuring objects in our images. This line calibration only works on 2D planes that are parallel to the camera.
Example 2, measuring distance of a non-Parallel surface
For calibrating 3D non-parallel surfaces or planes, we need to lay a grid over a plane with known dimensions. Therefore, click on the grid icon, marked yellow below an put the grid on the correct position.
Left click on a corner and open the calibration menu.
Put in the dimensions of the plane and click on “Apply”.
Now you can measure the distance with lines even if they have a certain depth. For more detailed explanations or more difficult applications please refer to the Kinovea documentation.
To start tracking a moving object in a recorded video, right click the object and select track path. Tracking will be done automatically but can be adjusted any time. For that just use the “Next” frame button or your mouse wheel and adjust the tracking point frame by frame.
The inner rectangle is the object window, and the outer rectangle is the search window. When automated tracking fails, correct it by dragging the object window to the right location. When tracking resumes, it will use this point as a reference.
You can also track angles, lines or models, by right clicking the line, angle or model then select Tracking > Start tracking. The correction procedure remains the same.
How to do high speed recording?
Kinovea is ideal for short high speed video recording. However, to do high speed recording it’s important that you tweak the settings to get the best performance. When the recording processing (the PC) is not fast enough to process the camera images, images are dropped and lost. These lost images can corrupt time measurements made on the output video, as it requires a stable framerate.
You can see the dropped images of your recording in the InfoBar at the top.
If you have too many drops, you need to find the bottleneck in your system and optimize the recording settings in Kinovea.
The first step is to check whether the CPU or the writing speed of the hard drive is the bottleneck. Avoid using the system drive as a storage target, as it is already occupied with running your operating system.
Recording and saving videos will always be a tradeoff between memory/storage and speed. If you for example have a big buffer, you can increase the buffer size and use “Retroactive” recording mode, this should avoid drops, but at the same time increase memory usage.
There is no general solution to what settings are the best. You need to try different settings and see which one works the best.
Please check appendix 1 and 2 on how you can tweak the Kinovea parameters to increase the high-speed recording performance.
Do you still have question after reading this article? Please check the Kinovea website. For updates regarding new knowledge center articles, make sure to follow our LinkedIn page.
Appendix 1: Advanced video capture settings
In the general tab of the capture preferences the following parameters can be set:
Record uncompressed video. When this option is checked the videos are recorded without compressing the video frames to MP4 first. Uncompressed images contain more data, but not all video players can play back uncompressed files. Recording uncompressed video reduces the CPU power required, but increases the write speed required of the hard drive
When this option is unchecked, the video frames are compressed to MP4 using high quality settings to retain integrity. Compressed video is smaller and can be stored faster. By using compressed images, you minimize the required storage capacity and write speed of the hard drive, but it increases the required CPU power.
Display framerate. This option defines the frequency at which the camera images are updated in the capture screen. While recording the computer resources are shared between displaying the camera stream and recording it to the storage medium. The highest priority is always given to recording but lowering this value can help reduce the overall load on the computer and improve recording performance.
Image format. In Kinovea you can save single images. Here you define the format of the saved image.
Video format. The video format setting sets the format of the recorded video stream. Choose the video format that matched the video player you are using. We recommend MP4 for best results.
Uncompressed video format. If you record in uncompressed mode, you can select here the video format for the uncompressed video.
Next step is the recording tab of the capture preferences.
The following settings can be set in the recording tap:
Recording mode and delay. The recording mode option determines how the recording system interacts with the delay buffer. Images from the camera are always put in the delay buffer. The recording system takes the images from this buffer, to create a video. There are 3 options:
Camera, when using this recording mode, the delay value set in the capture screen is ignored. Recording is performed on the fly, the saved frame is always the most recent frame sent by the camera.
Delayed, when using this recording mode, the delay value set in the capture screen is taken into account. Recording is performed on the fly, the saved frame is taken from the delay buffer based on the delay value. This can be used to record actions happening before the moment the record button is hit or triggered. This feature is especially useful if you want to record events, before the record button is pressed. With this option active, the saved frame is taken from the delay buffer, based on the value set in the capture screen.
Retroactive, when using the recording mode, the recording is not performed on the fly. Instead, at the end of the recording process, when clicking the stop recording button or when the maximum recording duration is reached, the camera feed is paused, the delay buffer is frozen, and the video file is created all at once. The delay value is taken into account for creating the recording. This mode offers the best recording performances and minimizes dropped frames, at the cost of a reduced maximum length for created videos and a temporary freezing of the camera feed. The maximum length of recorded videos depends on the size of the delay buffer. This can be configured from the Memory preference page.
Appendix 2: writing speed hard drive for highspeed recording
The writing speed of your hard drive is important for recording videos. The throughput shouldn’t be higher than the maximum writing speed of your drive. A high throughput will result in dropping frames. You can test your writing speed with a free benchmarking application. In the screenshot below we have a 6MP color camera at 60fps. This camera requires a throughput of roughly 1100mb/s. The best SSD hard drives support a writing speed of approx. 500mb/s. So, you would need 3 SSD’s in a RAID0 configuration.
To reduce the required writing speed of the hard drive, in case of a color camera, you could decide to capture the video not in RGB but in RAW format. The debarring of the image will be done during playback instead of during recording. As a result, there is more processor power free for the recording and the throughput get reduced. To change this setting, open de camera parameters and select as stream format Raw, see image below.
The Throughput is now reduced from 1100mb/s to 368mb/s. As a result, we don’t need three SSD hard drives but just one.
If your drive is fast enough and has enough storage, you can record uncompressed videos (see screenshot below). This will decrease the processing power needed for recording but increases the size of the video file dramatically. If this is not possible, then select Compressed recording. It will cost much more processor power and can causes more dropped frames.
Another parameter to tweak to prevent dropped frames, is setting the Recording mode (see screenshot below). Retroactive recording is the best option if your system complies to the requirements. Recommended are 16 GB of ram and a good processor. If your computer doesn’t have those requirements, you should choose “Camera” or “Delayed” recording depending on your needs. See also appendix 1.
The replacement framerate overwrites the framerate written in the metadata of the output file. This influences the number of resources required to replay the file and the apparent speed of the action.
A camera might be capable of producing and transmitting 1000 frames per second, but the computer will not be able to play the file back at that speed and the monitor won’t be able to refresh itself fast enough either. To work around this problem, it is usual to reduce the framerate of the output file to a more typical one. Recording devices normally apply this transformation automatically. This results in a video that appears to be in slow motion.
Framerate replacement threshold
This option decides at which framerate the output file is changed to the lower replacement framerate.
If you set your threshold on 100FPS, and your camera records with more than 100fps, the video will be stored with the set replacement framerate. This means that if you open the video afterwards, it will be displayed in the saved replacement framerate, and you will see the video in slow motion.