Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webcam #40

Open
montaghem2 opened this issue Nov 26, 2024 · 1 comment
Open

webcam #40

montaghem2 opened this issue Nov 26, 2024 · 1 comment

Comments

@montaghem2
Copy link

montaghem2 commented Nov 26, 2024

What should I write for the webcam video file? Usually it is zero in opencv

Accepts rtsp URL.

using var yolo = new Yolo(new YoloOptions
{
OnnxModel = @"models\besto.onnx", // Path to the YOLO model in ONNX format
ModelType = ModelType.ObjectDetection, // Model type: Object Detection
Cuda = true, // Enable CUDA for GPU inference
GpuId = 0, // Use the first GPU (ID = 0)
PrimeGpu = true // Preallocate GPU resources
});

        // Configure video options for webcam
        var options = new VideoOptions
        {
            VideoFile = "",
            OutputDir = @"output\webcam_results", // Path to save the output frames and/or processed video
            GenerateVideo = false, // Do not save an output video; just process live frames
            DrawLabels = true, // Draw detected object labels
            FPS = 30, // Target FPS for the display
            Width = 1280, // Resize the webcam feed width
            Height = 720, // Resize the webcam feed height (maintaining proportions if -2)
            Quality = 28, // (Unused for webcam; for completeness)
            DrawConfidence = true, // Show confidence scores in the output
            KeepAudio = false, // Not applicable for webcam
            KeepFrames = false, // Do not save individual processed frames
        };
        var results = yolo.RunObjectDetection(options, 0.25, 0.
@NickSwardh
Copy link
Owner

If you want to use a webcam, you can check the newly added webcamdemo in the repo -> https://github.com/NickSwardh/YoloDotNet/tree/master/WebcamDemo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants