Commit c3e88a71 authored by Vladimir's avatar Vladimir

Fixed segmentation fault error in TRACK_vot::getNextFrame()

parent 46603023
...@@ -82,8 +82,8 @@ int main(int argc, char *argv[]) ...@@ -82,8 +82,8 @@ int main(int argc, char *argv[])
for (int i = 0; i < dataset->getDatasetLength(datasetID); i++) for (int i = 0; i < dataset->getDatasetLength(datasetID); i++)
{ {
Mat frame; Mat frame;
dataset->getNextFrame(frame); if (!dataset->getNextFrame(frame))
break;
//Draw Ground Truth BB //Draw Ground Truth BB
vector <Point2d> gtPoints = dataset->getGT(); vector <Point2d> gtPoints = dataset->getGT();
for (int j = 0; j < (int)(gtPoints.size()-1); j++) for (int j = 0; j < (int)(gtPoints.size()-1); j++)
......
...@@ -210,7 +210,10 @@ namespace cv ...@@ -210,7 +210,10 @@ namespace cv
bool TRACK_votImpl::getNextFrame(Mat &frame) bool TRACK_votImpl::getNextFrame(Mat &frame)
{ {
frame = imread(data[activeDatasetID - 1][frameCounter]->imagePath); if (frameCounter >= (int)data[activeDatasetID - 1].size())
return false;
string imgPath = data[activeDatasetID - 1][frameCounter]->imagePath;
frame = imread(imgPath);
frameCounter++; frameCounter++;
return !frame.empty(); return !frame.empty();
} }
......
...@@ -50,7 +50,7 @@ using namespace std; ...@@ -50,7 +50,7 @@ using namespace std;
using namespace cv; using namespace cv;
using namespace cv::datasets; using namespace cv::datasets;
#define NUM_TEST_FRAMES 100 #define NUM_TEST_FRAMES 1000
static Mat image; static Mat image;
static bool paused; static bool paused;
...@@ -170,10 +170,8 @@ int main(int argc, char *argv[]) ...@@ -170,10 +170,8 @@ int main(int argc, char *argv[])
//Time measurment //Time measurment
int64 e1 = getTickCount(); int64 e1 = getTickCount();
if (initialized){ if (initialized){
dataset->getNextFrame(frame); if (!dataset->getNextFrame(frame))
if (frame.empty()){
break; break;
}
frame.copyTo(image); frame.copyTo(image);
} }
......
...@@ -169,10 +169,8 @@ int main(int argc, char *argv[]) ...@@ -169,10 +169,8 @@ int main(int argc, char *argv[])
//Time measurment //Time measurment
int64 e1 = getTickCount(); int64 e1 = getTickCount();
if (initialized){ if (initialized){
dataset->getNextFrame(frame); if (!dataset->getNextFrame(frame))
if (frame.empty()){
break; break;
}
frame.copyTo(image); frame.copyTo(image);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment