fprintf showing multiple boxes instead of value

3 Ansichten (letzte 30 Tage)
Muhamad Luqman Mohd Nasir
Muhamad Luqman Mohd Nasir am 21 Jun. 2021
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)

Antworten (0)

Kategorien

Mehr zu Image Data Workflows finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by