* fix run 1-1 wrong, the reason is the multi thread condition.

v1.6alpha
liuruoze 9 years ago
parent fffb964322
commit a1045d1633

@ -56,7 +56,7 @@ class CPlateLocate {
int colorSearch(const Mat& src, const Color r, Mat& out,
std::vector<RotatedRect>& outRects, int index = 0);
std::vector<RotatedRect>& outRects);
int mserSearch(const Mat &src, vector<Mat>& out,
vector<vector<CPlate>>& out_plateVec, bool usePlateMser, vector<vector<RotatedRect>>& out_plateRRect,

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

@ -108,7 +108,7 @@ int CPlateLocate::mserSearch(const Mat &src, vector<Mat> &out,
int CPlateLocate::colorSearch(const Mat &src, const Color r, Mat &out,
vector<RotatedRect> &outRects, int index) {
vector<RotatedRect> &outRects) {
Mat match_grey;
// width is important to the final results;
@ -118,9 +118,9 @@ int CPlateLocate::colorSearch(const Mat &src, const Color r, Mat &out,
colorMatch(src, match_grey, r, false);
if (m_debug) {
utils::imwrite("resources/image/tmp/match_grey.jpg", match_grey);
}
//if (m_debug) {
// utils::imwrite("resources/image/tmp/match_grey.jpg", match_grey);
//}
Mat src_threshold;
threshold(match_grey, src_threshold, 0, 255,
@ -130,9 +130,9 @@ int CPlateLocate::colorSearch(const Mat &src, const Color r, Mat &out,
MORPH_RECT, Size(color_morph_width, color_morph_height));
morphologyEx(src_threshold, src_threshold, MORPH_CLOSE, element);
if (m_debug) {
utils::imwrite("resources/image/tmp/color.jpg", src_threshold);
}
//if (m_debug) {
// utils::imwrite("resources/image/tmp/color.jpg", src_threshold);
//}
src_threshold.copyTo(out);
@ -722,19 +722,21 @@ int CPlateLocate::plateColorLocate(Mat src, vector<CPlate> &candPlates,
vector<CPlate> plates_yellow;
plates_yellow.reserve(64);
Mat src_clone = src.clone();
Mat src_b_blue;
Mat src_b_yellow;
#pragma omp parallel sections
{
#pragma omp section
{
Mat src_b_blue;
colorSearch(src, BLUE, src_b_blue, rects_color_blue, index);
colorSearch(src, BLUE, src_b_blue, rects_color_blue);
deskew(src, src_b_blue, rects_color_blue, plates_blue, true, BLUE);
}
#pragma omp section
{
Mat src_b_yellow;
colorSearch(src, YELLOW, src_b_yellow, rects_color_yellow, index);
deskew(src, src_b_yellow, rects_color_yellow, plates_yellow, true, YELLOW);
colorSearch(src_clone, YELLOW, src_b_yellow, rects_color_yellow);
deskew(src_clone, src_b_yellow, rects_color_yellow, plates_yellow, true, YELLOW);
}
}

@ -17,8 +17,8 @@ int test_plate_locate() {
vector<cv::Mat> resultVec;
CPlateLocate plate;
plate.setDebug(1);
plate.setLifemode(true);
//plate.setDebug(0);
//plate.setLifemode(true);
int result = plate.plateLocate(src, resultVec);
if (result == 0) {

Loading…
Cancel
Save