From d57d6020d12e9332af96e08ed8e061ffb57300e7 Mon Sep 17 00:00:00 2001 From: Micooz Date: Wed, 22 Apr 2015 16:29:31 +0800 Subject: [PATCH] Fixed: compile error "non-const lvalue reference to type 'cv::Mat' cannot bind to a temporary of type 'cv::Mat'". --- CMakeLists.txt | 2 +- src/core/plate_locate.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a4253f..ea0f96a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8) project (EasyPR) -list(APPEND CMAKE_CXX_FLAGS "-std=c++0x") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") find_package(OpenCV REQUIRED) diff --git a/src/core/plate_locate.cpp b/src/core/plate_locate.cpp index ddd8602..3bf12be 100644 --- a/src/core/plate_locate.cpp +++ b/src/core/plate_locate.cpp @@ -1583,8 +1583,9 @@ int CPlateLocate::plateLocate(Mat src, vector& resultVec, int index) //large the rect for more if (!verifySizes(mr)) { - cv::Mat& roi = dst_blue(safeBoundRect); + cv::Mat roi = dst_blue(safeBoundRect); roi.setTo(0); + cv::swap(roi, dst_blue); } else { @@ -1637,8 +1638,9 @@ int CPlateLocate::plateLocate(Mat src, vector& resultVec, int index) //large the rect for more if (!verifySizes(mr)) { - cv::Mat& roi = dst_yellow(safeBoundRect); + cv::Mat roi = dst_yellow(safeBoundRect); roi.setTo(0); + cv::swap(roi, dst_yellow); } else {