opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.39k stars 5.75k forks source link

Mosse tracker crashes with Bus Error on init, only on ARM platform #2930

Open rokopi-byte opened 3 years ago

rokopi-byte commented 3 years ago
System information (version)
Detailed description

MOSSE Tracker gives now "Bus Error" with the following sample code. This can be related to this issue I opened last year, even tough the error message is different. MOSSE is the only tracker that cause this issue in the example provided. The same code works on my x86_64 platform with Ubuntu 16.04. OpenCV has been cross-compiled using this steps, skipping all the parts related to Intel Inference engine.

Steps to reproduce

main.cpp

#include <iostream>
#include "person.h"
#include <opencv2/core/core.hpp>
#include <opencv2/imgcodecs.hpp>

using namespace std;

int main()
{
    person p;
    p.createTracker("mosse");
    cv::Rect2d r;
    r.x=20.0;
    r.y=20.0;
    r.width=10.0;
    r.height=10.0;
    cv::Mat image;
    image = cv::imread("download.jpeg");
    p.tracker->init(image,r);
    return 0;
}

person.h

#ifndef PERSON_H
#define PERSON_H

#include <opencv2/core/core.hpp>
#include <opencv2/tracking/tracking.hpp>
#include <opencv2/tracking/tracking_legacy.hpp>

class person
{
public:
    person();
    cv::Ptr<cv::Tracker> tracker;

    void createTracker(std::string type);

};

#endif // PERSON_H

person.cpp

#include "person.h"

person::person()
{
}

void person::createTracker(std::string type)
{

    if(type== "mosse") {
        tracker = cv::legacy::upgradeTrackingAPI(cv::legacy::TrackerMOSSE::create());
    } else if(type == "csrt")
        tracker = cv::TrackerCSRT::create();
    else if(type == "kcf")
        tracker = cv::TrackerKCF::create();
    else if(type == "tld")
        tracker = cv::legacy::upgradeTrackingAPI(cv::legacy::TrackerTLD::create());
    else {
        std::cout << "Tracking type not specified! This should not happen.";
    }
}

Attached there is the valgrind out. Please help. Thank you

Issue submission checklist
Doch88 commented 3 years ago

It seems like a memory alignment issue on ARM, maybe a problem with makePtr?