How to calculate total time required for (including preprocessing, conversion and prediction)per frame. Also how to convert all the images to greyscale for training and analysing .Then make the output to rgb image showing the correct prediction?

2 views (last 30 days)
How to calculate total time required for (including preprocessing, conversion and prediction)per frame. Also how to convert all the images to greyscale for training and analysing and make the output to rgb image showing the correct prediction? I have uploaded the code for the same . Please help me as I have just started using matlab.

Accepted Answer

Utkarsh Belwal
Utkarsh Belwal on 24 Aug 2020
You can use tic toc commands in MATLAB as follows,
tic
% Enter the code here for which time has to be measured
toc
Elapsed time will be shown in MATLAB terminal. See documentation for further information : Tic Toc
For rgb to grayscale conversion you can use rgb2gray
And for your last query, I don't think you can get RGB image from the grayscale as for the predicted image you do not have any information of colormap but as a workaround you can try the colormap of the original images and see the results. Look into the below MATLAB Answers for further understanding
DISCLAIMER: These are my own views and in no way depict those of MathWorks.
  3 Comments
Utkarsh Belwal
Utkarsh Belwal on 25 Aug 2020
Edited: Utkarsh Belwal on 25 Aug 2020
For that you can store the colormap of each image before converting them to grayscale,
[I,colormap] = imread(___);
After you have got your results, using the stored color maps convert them back to rgb,
rgbImage = ind2rgb(grayImage, colormap);

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!