Ask Your Question
0

TLD causes nvcompiler.dll access violation

asked 2015-10-20 17:45:01 -0500

Jaheen gravatar image

updated 2015-10-21 08:27:26 -0500

I am trying to run the TLD tracking algorithm with the following code, giving the following input: TLD path 1 I edited the code to use the computer cam (i.e: the input "path" is irrelevant).

The code gives the following message:

Unhandled exception at 0x00000001804B2084 (nvcompiler.dll) in TestOpenCV.exe: 0xC0000005: Access violation reading location 0x00000000FB191450.

The TLD algorithm is the only one to cause this to happen. This happens when the update function is called. Here is the code:

#include <opencv2/core/utility.hpp>
#include <opencv2/tracking.hpp>
#include <opencv2/tracking/tracker.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <cstring>

using namespace std;
using namespace cv;

static Mat image;
static Rect2d boundingBox;
static bool paused;
static bool selectObject = false;
static bool startSelection = false;

static const char* keys =
{ "{@tracker_algorithm | | Tracker algorithm }"
    "{@video_name      | | video name        }"
    "{@start_frame     |0| Start frame       }" 
    "{@bounding_frame  |0,0,0,0| Initial bounding frame}"};

static void onMouse( int event, int x, int y, int, void* )
{
  if( !selectObject )
  {
    switch ( event )
    {
      case EVENT_LBUTTONDOWN:
        //set origin of the bounding box
        startSelection = true;
        boundingBox.x = x;
        boundingBox.y = y;
        break;
      case EVENT_LBUTTONUP:
        //sei with and height of the bounding box
        boundingBox.width = std::abs( x - boundingBox.x );
        boundingBox.height = std::abs( y - boundingBox.y );
        paused = false;
        selectObject = true;
        break;
      case EVENT_MOUSEMOVE:

        if( startSelection && !selectObject )
        {
          //draw the bounding box
          Mat currentFrame;
          image.copyTo( currentFrame );
          rectangle( currentFrame, Point((int) boundingBox.x, (int)boundingBox.y ), Point( x, y ), Scalar( 255, 0, 0 ), 2, 1 );
          imshow( "Tracking API", currentFrame );
        }
        break;
    }
  }
}

static void help()
{
  cout << "\nThis example shows the functionality of \"Long-term optical tracking API\""
       "-- pause video [p] and draw a bounding box around the target to start the tracker\n"
       "Example of <video_name> is in opencv_extra/testdata/cv/tracking/\n"
       "Call:\n"
       "./tracker <tracker_algorithm> <video_name> <start_frame> [<bounding_frame>]\n"
       << endl;

  cout << "\n\nHot keys: \n"
       "\tq - quit the program\n"
       "\tp - pause video\n";
}

int main( int argc, char** argv ){
  CommandLineParser parser( argc, argv, keys );

  String tracker_algorithm = parser.get<String>( 0 );
  String video_name = parser.get<String>( 1 );
  int start_frame = parser.get<int>( 2 );

  if( tracker_algorithm.empty() || video_name.empty() )
  {
    help();
    return -1;
  }

  int coords[4]={0,0,0,0};
  bool initBoxWasGivenInCommandLine=false;
  if (initBoxWasGivenInCommandLine)
  {
      String initBoundingBox=parser.get<String>(3);
      for(size_t npos=0,pos=0,ctr=0;ctr<4;ctr++){
        npos=initBoundingBox.find_first_of(',',pos);
        if(npos==string::npos && ctr<3){
           printf("bounding box should be given in format \"x1,y1,x2,y2\",where x's and y's are integer cordinates of opposed corners of bdd box\n");
           printf("got: %s\n",initBoundingBox.substr(pos,string::npos).c_str());
           printf("manual selection of bounding box will be employed\n");
           break;
        }
        int num=atoi(initBoundingBox.substr(pos,(ctr==3)?(string::npos):(npos-pos)).c_str());
        if(num<=0){
           printf("bounding box should be given in format \"x1,y1,x2,y2\",where x's and y's are integer cordinates of opposed corners of bdd box\n");
           printf("got: %s\n",initBoundingBox.substr(pos,npos-pos).c_str());
           printf("manual selection of bounding box will be employed\n ...
(more)
edit retag flag offensive close merge delete

Comments

did you try other algorithms, like "MIL", "BOOSTING" ? maybe we can narrow it down a bit.

also, did you compile with CUDA ? some more information on your setup might be more important than the sample code

berak gravatar imageberak ( 2015-10-21 01:54:47 -0500 )edit
1

Actually all other algorithms are working perfectly, this problem only arises with TLD.

Jaheen gravatar imageJaheen ( 2015-10-21 05:03:29 -0500 )edit

I did not use CUDA, I only followed those instructions. I kept the sources in a distinct folder though (opencv/sources instead of opencv), while building in opencv/build. I also did not build opencv_world. Should I?

Jaheen gravatar imageJaheen ( 2015-10-21 05:05:38 -0500 )edit

sounds all ok.

"I also did not build opencv_world. Should I?" - no, leave it as is

i'm just wondering, why there's a cvcompiler.dll (sounds like cuda, no?) involved at all

can you do a cerr << cv::getBuildInformation() << endl; and append the output to your question ?

berak gravatar imageberak ( 2015-10-21 05:41:50 -0500 )edit

I appended the output of getBuildInformation() to my question

Jaheen gravatar imageJaheen ( 2015-10-21 08:26:54 -0500 )edit

thanks !. so it's either opencl or ipp related.

i think, you should progress to the github issueswith this. also: https://github.com/itseez/opencv/wiki...

berak gravatar imageberak ( 2015-10-21 08:38:27 -0500 )edit

int the meantime, you could try to disable things at runtime,

http://docs.opencv.org/ref/master/dc/...

http://docs.opencv.org/ref/master/db/...

berak gravatar imageberak ( 2015-10-21 08:41:38 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-10-21 15:20:00 -0500

Jaheen gravatar image

updated 2015-10-21 15:21:20 -0500

I managed to make the algorithm work by completely disabling the NVIDIA GeForce. I am still trying to find out the reason why it's not working even though I disable things at runtime. Thanks you very much for the help. I will post updates if I manage to make it work.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-10-20 16:22:46 -0500

Seen: 164 times

Last updated: Oct 21 '15