MATLAB Answers


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

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?


No tags entered yet.




1 Answer

Answer by MathWorks Support Team on 22 Aug 2019 at 4:00
 Accepted Answer

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.


Sign in to comment.