From b6469f5326453c6cadb5983c059d51bc2d6e6645 Mon Sep 17 00:00:00 2001 From: Roberto Carvajal Date: Thu, 30 Apr 2015 16:17:31 -0300 Subject: [PATCH] fixed assertion in gpu detector --- src/openalpr/detection/detectorcuda.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/openalpr/detection/detectorcuda.cpp b/src/openalpr/detection/detectorcuda.cpp index 39dbfc7..83d4628 100644 --- a/src/openalpr/detection/detectorcuda.cpp +++ b/src/openalpr/detection/detectorcuda.cpp @@ -53,7 +53,15 @@ namespace alpr { Mat frame_gray; - cvtColor( frame, frame_gray, CV_BGR2GRAY ); + + if (frame.channels() > 2) + { + cvtColor( frame, frame_gray, CV_BGR2GRAY ); + } + else + { + frame.copyTo(frame_gray); + } vector detectedRegions; for (int i = 0; i < regionsOfInterest.size(); i++)