Skip to content

Commit 9f08218

Browse files
committed
Merge pull request #1381 from Nuzhny007:master
2 parents 666ec5b + 7d1143e commit 9f08218

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

modules/tracking/src/tldTracker.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,14 @@ bool TrackerTLDImpl::initImpl(const Mat& image, const Rect2d& boundingBox)
119119
bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
120120
{
121121
Mat image_gray, image_blurred, imageForDetector;
122-
cvtColor( image, image_gray, COLOR_BGR2GRAY );
122+
if(image.channels() > 1)
123+
{
124+
cvtColor( image, image_gray, COLOR_BGR2GRAY );
125+
}
126+
else
127+
{
128+
image_gray = image.clone();
129+
}
123130
double scale = data->getScale();
124131
if( scale > 1.0 )
125132
resize(image_gray, imageForDetector, Size(cvRound(image.cols*scale), cvRound(image.rows*scale)), 0, 0, DOWNSCALE_MODE);

0 commit comments

Comments
 (0)