How can I simultaneously acquire images and save them to disk as TIFF files?

5 views (last 30 days)
The videoinput DiskLogger functionality uses MATLAB VideoWriter to save images to a video file.
Since the video file formats supported by VideoWriter are not the best option for my application, I would instead prefer to save the acquired images into TIFF file format for later processing.
Is there example code for how this can be achieved?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 22 Aug 2019
Refer to attached "basic_gige_log_TIFF.m" and "basic_saveImageData.m" for a simple example on how to simultaneously acquire images and save them to disk as TIF files.
Since saving each acquired frame to disk uses imwrite, which is a blocking MATLAB function, at higher frame rates or higher frame sizes, the image file writing operation might not be able to keep up with the acquisition, resulting in an acquired frames backlog and increased memory usage.
In this situation, if Parallel Computing Toolbox is available, there is an option to improve performance by doing the file writing operation in a separate worker using parfeval.
Refer to attached "**" which includes:
  • example code "gige_log_TIFF.m" and required functions "saveImageData.m", "writeTIFF.m", and "checkFuturesErrors.m"
  • example code "basic_gige_log_TIFF.m" and required functions "basic_saveImageData.m" and "writeTIFF.m", which does not use Parallel Computing Toolbox. This is included for comparison with the example which uses parfeval.

More Answers (0)


Find more on Image Preview and Device Configuration in Help Center and File Exchange


No tags entered yet.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!