OpenCV Mobile snapshot via RTSP

  • Yurii wrote: 2024-02-24 13:21 Thank you! Everything works . But VScod still has debug problem.
    Can you tell me which IDE you are using?
    I need to debug the program.
    With sample opencv I сan to run GDB+server.
    But I have problems with other examples. I'm new to cross compilation so I need some help. which IDE to use and how to configure correctly.

    Can someone explain what the problem is when debugging?
    Знімок екрана з 2024-02-25 14-10-08.png

    I also use VS Code as my IDE, but unfortunately, I lack experience in debugging with breakpoints in VS Code. I attempted to add debugging flags to the CMakeLists.txt .

    Code: Select all

    set(CMAKE_C_FLAGS   "-g")
    set(CMAKE_CXX_FLAGS "-g")
    
    In luckfox-pico

    Code: Select all

     gdbserver 172.32.0.100:7878 luckfox_rtsp_opencv 
    
    In wsl terminal

    Code: Select all

     
     arm-rockchip830-linux-uclibcgnueabihf-gdb luckfox_rtsp_opencv
     target remote 172.32.0.93:7878
     -
     
    Entering the debugging interface
    gdb_pc.jpg
  • Thank you!
    Attachments
    Знімок екрана з 2024-02-26 20-30-50.png
    Знімок екрана з 2024-02-26 20-31-28.png
    Знімок екрана з 2024-02-26 20-33-08.png
    Last edited by Yurii on 2024-03-03 21:40, edited 1 time in total.
  • Yurii wrote: 2024-02-26 19:09 I see that you have debugging working?
    did i add it right?
    Знімок екрана з 2024-02-26 20-33-08.png
    started the server
    Знімок екрана з 2024-02-26 20-31-28.png
    got an error
    Знімок екрана з 2024-02-26 20-30-50.png
    what could this be related to? what am i doing wrong please help.

    Hi, my debug prints show the message "no debugging symbols found" just like yours, but I can still debug normally. I'm not sure what's causing this situation. I guess it might be because the -g option only takes effect when linking the *.o files to the executable. Therefore, I'm able to debug into the rtsp_opencv.cc source code, but for the linked library rkmpi, the official doesn't provide the source code nor symbols, so those symbols cannot be found.
    gdb not found symbol.jpg
    You can try setting breakpoints in the program with "b main", then run with the continue command to debug starting from main. You can also enter the graphical debugging interface using "-".

    I hope this is helpful for you. If you find the real cause, I look forward to hearing about it.
  • I don't understand why the server closes when debugging is started.
    what could be the problem?
    maybe I need to install something in buildroot? my version of gdb --version
    GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1.
    Can anyone tell me what the problem is ,how to fix it ?
    gdb.jpg
    This problem occurs if i use the .o library.
    I don't understand why it doesn't ignore it like in your example.
  • Yurii wrote: 2024-02-27 21:29 I don't understand why the server closes when debugging is started.
    what could be the problem?
    maybe I need to install something in buildroot? my version of gdb --version
    GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1.
    Can anyone tell me what the problem is ,how to fix it ?

    gdb.jpg

    This problem occurs if i use the .o library.
    I don't understand why it doesn't ignore it like in your example.
    Hi, this is the debugging process I followed, and I didn't encounter the issue you faced.
    gdb debug b main.jpg
    The debugging process is independent of the version of GDB; it mainly involves using the arm-rockchip830-linux-uclibcgnueabihf-gdb from the SDK for debugging.
    gdb version.jpg
    If you want to resolve dynamic library linking issues, you can use the set solib-search-path command in the GDB interface to set the path for linking libraries during compilation.
    gdb load shared.jpg
    I hope this helps resolve your problem.
  • THANK YOU VERY MUCH !
    It worked.
    When I run

    Code: Select all

    gdbserver 192.168.0.6:2000 luckfox_rtsp_opencv 
    from a separate terminal, I can debug.
    When I start gdbserver with visual code as a task, I have problems when starting debugging, the server closes.
    It is surprising that opencv-mobile is well configured.

    Code: Select all

    {
        "version": "2.0.0",
        "tasks": [
            {
                "label": "StartGdbServer",
                "type": "shell",
                "command": "sshpass",
                "args": [
                    "-p",
                    "luckfox",
                    "ssh",
                    "-p",
                    "22",
                    "root@192.168.0.6",
                    "cd /root/build && gdbserver 192.168.0.6:2000 luckfox_rtsp_opencv"
                ],
            
                "group": {
                    "kind": "build",
                    "isDefault": true
                },
                "problemMatcher": [],
                "presentation": {
                    "reveal": "always",
                    "echo": true
                }
            }
        ]
    }
    Does anyone have a good settings for copying the app to the device, running gdbserver and debugging. For visual code?
    to work in one click
  • Is it possible to implement the tracker in mobile opencv?
    I see a few but they are tied to the models.
    TrackerGOTURN:
    TrackerDaSiamRPN:
    TrackerNano:
    TrackerVit:
  • Yurii wrote: 2024-03-07 23:25 Is it possible to implement the tracker in mobile opencv?
    I see a few but they are tied to the models.
    TrackerGOTURN:
    TrackerDaSiamRPN:
    TrackerNano:
    TrackerVit:

    Hello, I tested TackerMIL using luckfox-pico pro and it can run, but it will occupy a large amount of CPU resources, resulting in a low frame rate for real-time detection.

    Code: Select all

    // Include
    #include <opencv2/video/tracking.hpp>
    
    // Init
    cv::Ptr<cv::Tracker> tracker = cv::TrackerMIL::create();
    cv::Rect rect(start_x ,start_y, width, height);
    tracker-<init(img, rect);
    
    // update in while
    tracker->update(img, rect);
    cv::rectangle(img, rect, cv::Scalar(0, 255, 0), 2);
    
    
    Note: Currently, it can only be compiled and run, and the accuracy and resource usage need to be tested by yourself.
  • Thanks for the answer.
    This tracker works, but as you said very slowly.
    trekerTest.png
    Is it possible to implement a tracker that achieves approximately 20 frames per second (fps) for an image size of 1200 pixels width and 700 pixels height?
    Thanks