gnebehay / OpenTLD

A C++ implementation of OpenTLD
http://gnebehay.github.com/OpenTLD/
GNU General Public License v3.0
460 stars 196 forks source link

Access Violations in VarianceFilter.cpp:67 #54

Closed thegrb93 closed 9 years ago

thegrb93 commented 9 years ago

integralImg and integralImg_squared are getting initialized with a size of 337920, but the off[3], off[2], off[1], and off[0] are trying to index this data with values of 340059, 283035, 340032, 283008.

My code is simple. Am I doing something wrong?

int main(int argc, char* argv[])
{
    tld::TLD tracker;
    cv::VideoCapture video("14117949_a.mpg");

    if(!video.grab())
    {
        std::cout << "Error loading the video..." << std::endl;
        return 0;
    }
    cv::Mat img, gray;
    video >> img;
    cv::cvtColor(img, gray, CV_BGR2GRAY);

    tracker.detectorCascade->imgWidth = img.cols;
    tracker.detectorCascade->imgHeight = img.rows;
    tracker.detectorCascade->imgWidthStep = img.step;

    cv::Rect InitialRect(40,40,120,120);
    tracker.selectObject(gray, &InitialRect); //Access Violation
}
thegrb93 commented 9 years ago

Found it, should have used tracker.detectorCascade->imgWidthStep = gray.step;