fprintf showing multiple boxes instead of value

조회 수: 2 (최근 30일)
Muhamad Luqman Mohd Nasir
Muhamad Luqman Mohd Nasir 2021년 6월 21일
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