フィルターのクリア

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

7 ビュー (過去 30 日間)
George
George 2023 年 12 月 16 日
コメント済み: Walter Roberson 2023 年 12 月 16 日
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 Center および File ExchangeDeep 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