Borrar filtros
Borrar filtros

I want to code to add a return value

2 visualizaciones (últimos 30 días)
Chanhyeok
Chanhyeok el 19 de Jul. de 2023
Respondida: Mrutyunjaya Hiremath el 19 de Jul. de 2023
function raspi_webcam_resnet()
raspiObj = raspi();
cam = webcam(raspiObj,1);
net = coder.loadDeepLearningNetwork('dataset800_2.mat');
inputSize = [224, 224,3];
textToDisplay = '......';
start = tic;
fprintf('Entering into while loop.\n');
while true
img = snapshot(cam);
elapsedTime = toc(start);
if elapsedTime > 1
imgSizeAdjusted = imresize(img,inputSize(1:2));
[label,score] = net.classify(imgSizeAdjusted);
maxScore = max(score);
labelStr = cellstr(label);
textToDisplay = sprintf('Label : %s \nScore : %f',labelStr{:},maxScore);
start = tic;
end
img_label = insertText(img,[0,0],textToDisplay);
displayImage(raspiObj,img_label);
end
end
Can you change the value of label to return in this code? I want to keep the existing one but add it.

Respuesta aceptada

Mrutyunjaya Hiremath
Mrutyunjaya Hiremath el 19 de Jul. de 2023
If I am not wrong, I think this is what you are expecting :
function label = raspi_webcam_resnet()
% your code...
end

Más respuestas (0)

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by