Within our free Galaxy SDK for our industrial cameras, we offer a basic plugin to save captured images to the hard drive or to save the captured images as a video.In this article we explain the different settings and the settings we advise for capturing and saving images and videos using our industrial camera.
Go to Plugin->Videos and Images Save Plugin as shown in the screenshot below.
With this plugin captured images can be saved as images in different formats or even as a video file.
The following parameters can be set: - Number of memory, the amount of images that are buffered into the memory. - We recommend using the value 10. - File save path, this is the location where the images or videos are saved.
This option lets you decide the total amount of time the plugin will run, or the total amount of frames that will be saved. Unlimited -> No limit (until storage is full, plugin will stop when no more space available) Maximum number of frames -> stops image capturing when this number is reached. Duration -> you can choose how long the plugin will run, seconds minutes or hours.
File format settings
In this part you can choose either Save Image or Save video.
Choose between images and videos
Tick the box to enable Save Image. Depending on the amount of images you want to save per second, different formats are recommended. In our test setup we use a 1.6MP Mono camera and a laptop with I5 processor (10th generation), 8GB memory and SSD from the year 2020.
The max capturing frame rate for each format in this setup, without losing any frame are: - BMP, 200fps, 1.6mb uncompressed data. Ideal for saving images on high speed but for a limited amount of time as the hard drive gets full very quickly. - PNG, 5fps, 0.7mb, lossless compression. Every image is compressed and takes therefore a lot of CPU power. The compression is lossless, so ideal for image processing in a later stage. We recommend this file format if saving at max 5fps is acceptable. - JPG, 30fps, <0.1mb, compressed images. It decreases the image quality irreversibly and therefore we do not recommend this setting if image processing will be done at a later stage. - RAW, 100fps, 1.6mb uncompressed data. We do not recommend this file format, but we recommend BMP. Raw can only be opened with Halcon software, with color images this is a picture without debayering, with mono images the resulting file is the same as BMP but saved on a different file format.
The next 2 options let you choose how many pictures you want to keep every X frame or,X time.
For example, 1 image every 1 means each picture is saved. If you set it the value to 10, it means 1 image saved out of 10 captured images.
The plugin does work in software trigger mode, so you can grab images upon demand and within the save image parameters chosen.
If the camera is in free run, the plugin only works stable if the framerate is fixed. If you use the plugin in combination with automatic exposure/white balance/gain, these might influence the exposure time and therefore the framerate. As a result, the image save plugin could stop running and capturing images.
You can prevent this by limiting the framerate of the camera and limiting the automatic exposure/gain settings.
With this plugin it is possible to save captured images as video. Using the basic functiallity of the save video function of the GalaxySDK, you can choose different file types.
Using again the same laptop and 1.6MP mono camera this results in the following maximum framerates (without image drop) - H.264 Video in AVI Container, max 90fps - H.264 Video in mp4 Container, max 90fps - Uncompressed video in AVI Container, max 120fps
When recording a video with the 1.6MP mono camera on 60fps, for 1 minute, this will result in the following file sizes: - H.264 Video in AVI Container, 67mb - H.264 Video in mp4 Container, 67mb - Uncompressed video in AVI Container, 5490mb
Uncompressed files are very large, but they provide the best image quality and saving speed. If you have enough space on your hard drive we recommend this setting, otherwise we recommend the H.264 Video in AVI Container setting with 8mbit/s video bit rate.
The max framerate depends on PC specification, megapixels, and framerate.
In our example we have used a 1.6MP camera. If we would change it to a 6MP camera, we increase the data with a factor 6/1.6=3.75 so the max framerate will be reduced with a factor 3.75. In case of H.264 Video will be reduce from 90fps to 90/3.75= 24fps, using the 6MP camera.
Broadcast frame rate allows you to set the framerate for the video.
- Original framerate -> the framerate of the saved video is the same framerate as the framerate of the captured images. This is the setting we recommend.
- Custom framerate -> you can set a lower framerate for the saved video. For example, if you capture images at 90fps (camera frame rate) and you set the custom framerate of 30fps, the video will be played slower with a factor 90/30=3. So, if you record 10 seconds at 90fps, the video is saved as a video of 30 seconds on 30fps.
In this field you can see if your pc is powerful enough to record all the images / videos in realtime. The memory frame shows the number of images captured to the memory. The hard disk frames shows how many images are sent to the hard disk. If the number of hard disk frames is lower than the Memory frames, images are lost and not every captured image was saved. In that case you must reduce the framerate, change different file format saving or use a more powerful pc.
Example, saving 24h timelapse images using an industrial camera
In this example we explain how to save an image from an industrial camera every hour for in total 24h to create a 24h timelapse. We will program the plugin to run 24 hours and stop, saving in total 24 pictures. Mind that if storage is full, the plugin will stop acquiring and will not overwrite older frames. The correct settings are: • Reduce the camera framerate to 1 FPS
• Set duration limit to 24h • Enable the Save Image • Set the “Save one image out of every capture image” to 3600 (1 hr= 3600s so 1 image every hour) • Run the plugin.
Video and image recording for more complex applications
Our free GalaxyView software has basic functionality for saving images. If you need more advanced features, we recommend programming your own image save program based on our example programs in Python or C++.