Additional note: you may find 2 examples of tracking here:
OpenCv KCF tracker (in C++, but should be straight forward to convert into python. However with recent L4T releases, replace nvcamerasrc with nvarguscamerasrc and its output format from I420 to NV12):
This example works fine on my TX2. I use the KCF tracker with the onboard camera video :
#include <opencv2/core/utility.hpp>
#include <opencv2/tracking.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <cstring>
using namespace std;
using namespace cv;
int main( int argc, char** argv ){
// Gstreamer pipeline for accessing on board camera, rotate image 180° writing to CPU mem and convert to BGR for opencv input
const char* gst = "nvcameras…
Or this one from mp4 file with Kalman or dlib in python:
Update:
I took some time to test your code and adapt to opencv (main.py below).
I’ve used opencv4.2 (pre 4.3.0). You would need an opencv build with gstreamer support installed and available from python (uncomment #cv2.getBuildInformation() to be sure).
As input, it uses a gstreamer pipeline in order to read the AVI file TownCentreXVID.avi and provide frames in BGR format, with decodebin that should use nvv4l2decoder for HW(NVDEC) H264 decoding and nvvidconv for NV12 to BGRx HW(ISP) conversio…
1 Like