fprintf showing multiple boxes instead of value

2 次查看(过去 30 天)
Hi i was trying to display student id: 164335 as im working on digit recognition using CNN
but instead it shows multiple boxes and not 164335
and when i change the script label = classify ( net, I) to label(k) = classify ( net , I ) with added script k = k + 1 the net recognize the digit wrongly
Below is the script
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);
storedStructure = load('test2.mat');
net = storedStructure.net;
%i = 0;
label = zeros(1,1e6);
%label = [];
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(k) = classify(net,I);
%i = 0;
k = k + 1;
label(k)=(classify(net,I));
title([' Recognized Digit is ' char(label(k))])
end
%% Displaying Detected Text
fprintf( 'student id: %s\n',label)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by