Skip to content

Commit 4b1f925

Browse files
committed
added Simulink example
1 parent d2e558f commit 4b1f925

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Deep Learning for Object Detection Series
22

3-
Copyright 2019-2020 The MathWorks, Inc.
3+
Copyright 2019-2023 The MathWorks, Inc.
44

55
[![View Deep Learning For Object Detection on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/73954-deep-learning-for-object-detection)
66

Utilities/imageToVideo.m

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
function imageToVideo(imageFolderPath)
2+
3+
% Copyright 2023 The MathWorks, Inc
4+
%
5+
% Converts a folder of images to a video that can be used in a Simulink
6+
% model
7+
%
8+
% Requires that you have already downloaded the raw data from here:
9+
% https://drive.google.com/drive/u/1/folders/1bhohhPoZy03ffbM_rl8ZUPSvJ5py8rM-
10+
%
11+
% Inputs:
12+
% imageFolderPath: the full path to the 'testResized' folder of
13+
% 'RoboSubFootage' passed as a char array
14+
% ex: 'C:\Users\name\Desktop\RoboSubFootage\testResized'
15+
%
16+
%--------------------------------------------------------------------------
17+
allFilesStruct = dir(fullfile(imageFolderPath, '2*.jpeg'));
18+
imageNames = {allFilesStruct.name};
19+
20+
outputVideo = VideoWriter('testDataRoboSub.avi');
21+
open(outputVideo);
22+
23+
for i = 1:length(imageNames)
24+
img = imread(fullfile(imageFolderPath,imageNames{i}));
25+
writeVideo(outputVideo,img);
26+
end
27+
28+
close(outputVideo);
29+
end
Binary file not shown.

0 commit comments

Comments
 (0)