Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

opencv Tracker is too slow in high revolution!

System information (version)

OpenCV => 3.4.2:

Operating System / Platform => Android:

Compiler => cmake

Detailed description

Hi, Is there any way to improve the Tracking frame rate? When I use high resolution, the efficiency is very slow. example: I set the resolution of my phone to 1280 * 720. the fps is 20 or less. in TrackerKCF algorithm. when set resolution to 640 * 480 .the fps will arrive at More than 20 close to 30. But my needs here are at 1280 * 720, reaching a frame rate close to 30 or 30+.

Please help me,thanks!

detail code:

i invoke startTracking by JNI in Camera's onPreviewCallback.

 void startTracking(uint8_t* src_frame, int w, int h){  

  if(!isRectInit) return;  

image = Mat(h,w,CV_8UC1,src_frame);
if(!isInit){
tracker = TrackerKCF::create();
isInit = tracker->init(image, bbox);
}
//cv::rectangle(image, bbox, Scalar( 255, 0, 0 ), 2, 1 );
//updates the tracker
if(isInit){
// Start timer
double timer = (double)getTickCount();     
// Update the tracking result  
bool isOk = tracker->update(image, bbox);
// Calculate Frames per second (FPS)
LOGD("startTracking  5 -- isOk = %d -- after update :%f--%f--%f--%f",isOk,bbox.x,bbox.y
,(bbox.x+bbox.width),(bbox.height+bbox.y));
float fps = getTickFrequency() / ((double)getTickCount() - timer);
LOGD("startTracking  6 -- %f ",fps);
}