필터 지우기
필터 지우기

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

조회 수: 7 (최근 30일)
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
Image Analyst
Image Analyst 2023년 12월 16일
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 2023년 12월 16일
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?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Deep Learning with GPU Coder에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by