Giter Club home page Giter Club logo

kcfcpp's People

Contributors

joaofaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kcfcpp's Issues

KCF's robustness with regard to ground-truth box size

I test the code on some videos captured by myself , then I found that the tracking results varies greatly when I just initialize the algorithm with a slightly larger or smaller target box.
I wonder how can this happen since the code always extract a larger roi and get the feature, and I thought it will not so sensitive to the size of the box

set HOG true,but errors occurs that cvFilter2D

I use the KCV to track the moving object.When I set HOG false,it behaves very well,and peak_value set originally is 2.When set HOG false,the compiler returns the following errors.

OpenCV Error: Assertion failed (src.size() == dst.size() && src.channels() == dst.channels()) in cvFilter2D, file /opencv-2.4.13/opencv/modules/imgproc/src/filter.cpp, line 3359
terminate called after throwing an instance of 'cv::Exception'
what(): /opencv-2.4.13/opencv/modules/imgproc/src/filter.cpp:3359: error: (-215) src.size() == dst.size() && src.channels() == dst.channels() in function cvFilter2D.

I check the cvFilter2D,and image I use to init the KCFTracker and used to update the Rect are all gray images, and the size are also right.I am curious.
Do some friends know the reasons?
Thank you in advance!

memory error at tracker.init()

Hello,

I always have this problem when building the project in debug mode.
It looks like a memory error comes from the real part of the fft().

cv::Mat real(cv::Mat img)
{
    std::vector<cv::Mat> planes;
    cv::split(img, planes);                     // Error occurs here.
    return planes[0];
}

This problem disappear in release mode. The compiler is VS2013.

Some questions about the circshift in the code(the Matlab version)?

Thanks a lot for your open source, you are really a kind man. Recently, I have read your two papers, "Exploiting the Circulant Structure of Tracking-by-detection with Kernels" and "High-Speed Tracking with Kernelized Correlation Filters", and I download your codes (Matlab version) from the hyperlink given by the "Visual Tracker Benchmark", it's really very useful for me, a novice, to get further understanding about the KCF algorithm. Unfortunately, there are still some questions for me to understanding the algorithm and the codes, that I don't understand the dense sampling and the usefulness of the command 'circshift' in your "Code Version 1", the "dense_gauss_kernel.m" more specifically,
xy = real(circshift(ifft2(xyf), floor(size(x)/2))); %to spatial domain
http://www.robots.ox.ac.uk/~joao/circulant/index.html(I get your code from this url, Matlab code — version 1)

So I wish to get some instructions from you to help me understand this problem better.I would appreciate it very much if i can obtain any support from you.

about the hog size?

when i set a target size, the roipadding is the _tmp's size, because of the hog size is more less than the source image, the hog size should be (roipadding)/cell_size, but in this project i find that the hog size is more less that the size i think when i set the target a large size(for example: the target size is 112115,padding=2.5 the hog size is just 2224?? ), what is the problem?

without VOT toolkit I cannot have the result shown

** linux, without VOT toolkit , I comment out some lines of code in runtracker.cpp as following,**
`#include
#include
#include
#include

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

#include "kcftracker.hpp"

#include <dirent.h>

using namespace std;
using namespace cv;

int main(int argc, char* argv[]){

if (argc > 5) return -1;

bool HOG = true;
bool FIXEDWINDOW = false;
bool MULTISCALE = true;
bool SILENT = true;
bool LAB = false;

for(int i = 0; i < argc; i++){
	if ( strcmp (argv[i], "hog") == 0 )
		HOG = true;
	if ( strcmp (argv[i], "fixed_window") == 0 )
		FIXEDWINDOW = true;
	if ( strcmp (argv[i], "singlescale") == 0 )
		MULTISCALE = false;
	if ( strcmp (argv[i], "show") == 0 )
		SILENT = false;
	if ( strcmp (argv[i], "lab") == 0 ){
		LAB = true;
		HOG = true;
	}
	if ( strcmp (argv[i], "gray") == 0 )
		HOG = false;
}

// Create KCFTracker object
KCFTracker tracker(HOG, FIXEDWINDOW, MULTISCALE, LAB);

// Frame readed
Mat frame;

// Tracker results
Rect result;

/* // Path to list.txt
ifstream listFile;
string fileName = "images.txt";
listFile.open(fileName);

// Read groundtruth for the 1st frame
ifstream groundtruthFile;
string groundtruth = "region.txt";
groundtruthFile.open(groundtruth);
string firstLine;
getline(groundtruthFile, firstLine);
groundtruthFile.close();

istringstream ss(firstLine);

*/

// Read groundtruth like a dumb
float x1, y1, x2, y2, x3, y3, x4, y4;
char ch;
/*ss >> x1;
ss >> ch;
ss >> y1;
ss >> ch;
ss >> x2;
ss >> ch;
ss >> y2;
ss >> ch;
ss >> x3;
ss >> ch;
ss >> y3;
ss >> ch;
ss >> x4;
ss >> ch;
ss >> y4;      */

// Using min and max of X and Y for groundtruth rectangle
float xMin =  min(x1, min(x2, min(x3, x4)));
float yMin =  min(y1, min(y2, min(y3, y4)));
float width = max(x1, max(x2, max(x3, x4))) - xMin;
float height = max(y1, max(y2, max(y3, y4))) - yMin;


// Read Images
ifstream listFramesFile;
/*string listFrames = "images.txt";
listFramesFile.open(listFrames);    */
string frameName;


// Write Results
ofstream resultsFile;
string resultsPath = "output.txt";
resultsFile.open(resultsPath);

// Frame counter
int nFrames = 0;


while ( getline(listFramesFile, frameName) ){
	frameName = frameName;

	// Read each frame from the list
	frame = imread(frameName, CV_LOAD_IMAGE_COLOR);

	// First frame, give the groundtruth to the tracker
	if (nFrames == 0) {
		tracker.init( Rect(xMin, yMin, width, height), frame );
		rectangle( frame, Point( xMin, yMin ), Point( xMin+width, yMin+height), Scalar( 0, 255, 255 ), 1, 8 );
		resultsFile << xMin << "," << yMin << "," << width << "," << height << endl;
	}
	// Update
	else{
		result = tracker.update(frame);
		rectangle( frame, Point( result.x, result.y ), Point( result.x+result.width, result.y+result.height), Scalar( 0, 255, 255 ), 1, 8 );
		resultsFile << result.x << "," << result.y << "," << result.width << "," << result.height << endl;
	}

	nFrames++;

	if (!SILENT){
		imshow("Image", frame);
		waitKey(1);
	}
}
resultsFile.close();

// listFile.close();

}
**# What should I do to show the result correctly? thank u.**

what if object disappears?

What the function update returns if object disappears, say occluded for a while? Is there any way to return confidence?

what is #include <dirent.h>

1>f:\zhweizh\image processing\vs prj\kcf\kcf\src\runtracker.cpp(11): fatal error C1083: 无法打开包括文件:“dirent.h”: No such file or directory. in vs2010+opencv244 enviroment compiling
look like there is no dirent.h file.

Multiscale will not change the size when bigger_scale_peak > smaller_scale_peak > normal_scale_peak

Looking at this part (update method), it seems the _roi.width, _roi.height, and _scale will not change to bigger scale when bigger_scale_peak > smaller_scale_peak > normal_scale_peak. (I removed the scale_weight multiplication in this explanation to keep it simple)

Because the variables are first divided by scale_step here then multiplied with the same scale_step here. In the end, the variables return to normal scale in this case, while it should be bigger scale.

CMIIW. Thank you~

iplImage

My opencv is opencv4.2, and I get this problem:
IplImage z_ipl = z;
conversion from ‘cv::Mat’ to non-scalar type ‘IplImage {aka _IplImage}’ requested

How can I solve this problem. Thanks a lot.

run in the windows

Hello@joaofaro:
can you tell me whether this code can be used in the windows,Thank you!

error LNK2019 unresolved reference symbol

Hi,

When I create a KCFTracker object like this
`KCFTracker tracker(HOG, FIXEDWINDOW, MULTISCALE, LAB), I'm getting the following error when building the project. I'm using VS2012. Could anyone please help ? Thanks in advance.

error LNK2001: unresolved external symbol "public: __thiscall KCFTracker::KCFTracker(bool,bool,bool,bool)" (??0KCFTracker@@QAE@_N000@Z)

Getting peak_value > 1

When I checked detect method's both double pv and float peak_value variables after peak_value = (float) pv; line, sometimes I got value more than 1.0 (mostly still less than 1.1 but can be higher). Have any idea what would be the problem?

Edit:
it happens when HOG is set False

how can I use "linear kernel" ?

I find only Gaussian kernels. According to "High-Speed Tracking with Kernelized Correlation Filters" , linear kernel(DCF) is much faster than KCF (292FPS vs 172FPS).

seems wrong in complexDivision in ffttools.hpp

to do a complex division, say
(a+bi)/(c+di) = (a+bi)(c-di)/(cc+dd)
= [(ac+bd)+(bc-ad)i]/(cc+dd)
so in the code

    pres.push_back((pa[0].mul(pb[0]) + pa[1].mul(pb[1])).mul(divisor));
    pres.push_back((pa[1].mul(pb[0]) + pa[0].mul(pb[1])).mul(divisor));

second '+' should be '-'

But why does the code still work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.