From 0039fb3bd4159af5557092b23c7225b2e8c21f15 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 18 Jul 2014 20:34:24 -0400 Subject: [PATCH] Fixed errors in classifychars --- src/misc_utilities/classifychars.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/misc_utilities/classifychars.cpp b/src/misc_utilities/classifychars.cpp index ff49541..24409df 100644 --- a/src/misc_utilities/classifychars.cpp +++ b/src/misc_utilities/classifychars.cpp @@ -125,6 +125,8 @@ int main( int argc, const char** argv ) imshow ("Original", frame); PipelineData pipeline_data(frame, Rect(0, 0, frame.cols, frame.rows), &config); + cvtColor(frame, frame, CV_BGR2GRAY); + pipeline_data.crop_gray = Mat(frame, Rect(0, 0, frame.cols, frame.rows)); char statecode[3]; statecode[0] = files[i][0]; statecode[1] = files[i][1]; @@ -198,9 +200,16 @@ int main( int argc, const char** argv ) } else if (waitkey == ENTER_KEY) { - vector tempdata = showCharSelection(pipeline_data.thresholds[curDashboardSelection], pipeline_data.charRegions, statecodestr); - for (int c = 0; c < pipeline_data.charRegions.size(); c++) - humanInputs[c] = tempdata[c]; + if (pipeline_data.charRegions.size() > 0) + { + vector tempdata = showCharSelection(pipeline_data.thresholds[curDashboardSelection], pipeline_data.charRegions, statecodestr); + for (int c = 0; c < pipeline_data.charRegions.size(); c++) + humanInputs[c] = tempdata[c]; + } + else + { + cout << "No character regions available in this image" << endl; + } } else if (waitkey == SPACE_KEY) {