Azzera filtri
Azzera filtri

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

7 visualizzazioni (ultimi 30 giorni)
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 Commenti
Image Analyst
Image Analyst il 16 Dic 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 il 16 Dic 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?

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Deep Learning with GPU Coder in Help Center e File Exchange

Prodotti


Release

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by