Qengineering / YoloV4-Darknet-Jetson-Nano

YoloV4 with Darknet for Jetson Nano
https://qengineering.eu/install-darknet-on-jetson-nano.html
BSD 3-Clause "New" or "Revised" License
7 stars 1 forks source link

how to use on Jetson nano with real webcam #2

Open thanhtruongphan opened 1 week ago

thanhtruongphan commented 1 week ago

Hi @Qengineering , I did the instructions at Hands-on and run software in code:Block okay.

But I don't know how to use on my Jetson nano with real camera, idea is perform it on a python code. Help me, pls!

Qengineering commented 1 week ago

That is a very general question. Moreover, we use C++ instead of Python. You have two parts here: 1) Camera interface. 2) Darknet Both are well documented on the net. The best, (and stupid) suggestion is to use Perplexity AI to help you. Here the code for your camera generated by Perplexity AI: Question: I have a Jetson Nano and a webcam. Can you write me a simple Python program using OpenCV to show the camera on my screen? Answer:

import cv2

def show_webcam():
    cap = cv2.VideoCapture(0)

    while True:
        ret, frame = cap.read()
        if not ret:
            break

        cv2.imshow('Webcam', frame)

        if cv2.waitKey(1) == 27:  # Press ESC to quit
            break

    cap.release()
    cv2.destroyAllWindows()

if __name__ == '__main__':
    show_webcam()

Now expand your program step by step integrating darknet. Hint: You could ask to port our program from C++ to Python.

thanhtruongphan commented 1 week ago

ah, I understand.

just make a dir, then clone all repository, then remove README.md, LICENSE, MASTER.zip. then modify main.cpp file for use.

main.cpp or main.py in my case, right? Thank you so much, I don't know without you :smiling_face_with_tear:

thanhtruongphan commented 1 week ago

I'm new with these, :smile_cat:

Qengineering commented 1 week ago

You're are at the beginning of a steep learning curve. The are major differences between python and C++, as the are different languages. You can't modify a C++ file to python. You have to re-write the line (mostly line by line). Sometimes C++ operations are not possible in python or visa versa. Google (and Perplexity) are you're best frineds.

thanhtruongphan commented 1 week ago

yah, and Claude Ai, too :+1: