Effacer les filtres
Effacer les filtres

Not enough input arguments. Input 'cameraName' is not supplied to this function or method.

7 vues (au cours des 30 derniers jours)
I keep getting this error when trying to use MATLAB coder:
"Not enough input arguments. Input 'cameraName' is not supplied to this function or method."
And this is my code:
classdef TinyYoloV4CocoDetector
properties
yolov4
webcam
display
end
methods
% Constructor
function obj = TinyYoloV4CocoDetector(cameraName, resolution)
% Load the pretrained YOLOv4 model (loaded only once)
if isempty(coder.target) % check if not in code generation
obj.yolov4 = coder.loadDeepLearningNetwork('codegenYOLOv4.m');
end
% Initialize the Jetson camera object
obj.webcam = jetson.camera(cameraName, resolution);
obj.display = jetson.imageDisplay;
end
% Main processing loop
function detectObjectsLive(obj)
% Start webcam preview
preview(obj.webcam);
% Infinite loop for live streaming
while true
% Capture the current frame from the webcam
I = snapshot(obj.webcam);
% Call the detect method
[bboxes, ~, labels] = detect(obj.yolov4, I, 'Threshold', 0.3);
% Convert categorical labels to cell array of character vectors
labels = cellstr(labels);
% Annotate detections in the image
outImg = insertObjectAnnotation(I, 'rectangle', bboxes, labels);
rotatedImg = imrotate(outImg, 90);
% Display the annotated and rotated image
image(obj.display, rotatedImg);
% Pause to allow time for display update (adjust the delay as needed)
pause(0.1);
end
end
end
end
  2 commentaires
Image Analyst
Image Analyst le 16 Déc 2023
Please supply ALL the red text, not just a snippet of it. You're not showing the actual traceback of the line of code that threw the error.
Walter Roberson
Walter Roberson le 16 Déc 2023
Are you trying to invoke the class without passing in any parameters? For example are you trying to run the code by pressing the green Run button when you are examining the code?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Deep Learning with GPU Coder dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by