Combine multiple output into single output
4 次查看(过去 30 天)
显示 更早的评论
I am working on a student id recognition using CNN and i manage to recognize every single digit but how can i combine every digit into one single output.
i want the output to be
student id number: 164335
below is my code
%% feed image
myFolder = 'D:\CNN test\segmentedImages1';
% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile(myFolder, '*.png');
theFiles = dir(filePattern);
for k = 2 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(theFiles(k).folder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
I = imread(fullFileName);
subplot(3, 4, k);
imshow(I); % Display image.
drawnow; % Force display to update immediately.
label = classify(net,I);
title([' Recognized Digit is ' char(label)])
end
%% Displaying Detected Text
fprintf('%s\n',label)
but my code right now only printing 5
9 个评论
采纳的回答
Walter Roberson
2021-6-21
but the file is in the same directory
Are you indicating that you have a file net.m in the same directory, which is a function that will return a Network suitable for use by classify() ?
but work fine on my matlab script
You loaded (or assigned to) a variable named net in your base workspace. The base workspace is not automatically searched when a function is invoked.
You can force the base workspace to be looked in... but when you shut down for the evening and come back tomorrow, the base workspace will have been cleared and you will be out of sorts.
You should be loading the net from a .mat file at the time that the GUI starts, and making it available within your GUI; see http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
5 个评论
Walter Roberson
2021-6-22
Perimeter = fprintf( 'student id: %s\n',label);
The output of fprintf is the number of items transfered, not the content of the string. Use sprintf() to get the content.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Pattern Recognition and Classification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!