Update PlateDetection.cpp
This commit is contained in:
@@ -1,41 +1,20 @@
|
|||||||
//
|
|
||||||
// Created by 庾金科 on 20/09/2017.
|
|
||||||
//
|
|
||||||
#include "../include/PlateDetection.h"
|
#include "../include/PlateDetection.h"
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
namespace pr{
|
namespace pr{
|
||||||
|
|
||||||
|
|
||||||
PlateDetection::PlateDetection(std::string filename_cascade){
|
PlateDetection::PlateDetection(std::string filename_cascade){
|
||||||
cascade.load(filename_cascade);
|
cascade.load(filename_cascade);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void PlateDetection::plateDetectionRough(cv::Mat InputImage,std::vector<pr::PlateInfo> &plateInfos,int min_w,int max_w){
|
void PlateDetection::plateDetectionRough(cv::Mat InputImage,std::vector<pr::PlateInfo> &plateInfos,int min_w,int max_w){
|
||||||
|
|
||||||
cv::Mat processImage;
|
cv::Mat processImage;
|
||||||
|
|
||||||
cv::cvtColor(InputImage,processImage,cv::COLOR_BGR2GRAY);
|
cv::cvtColor(InputImage,processImage,cv::COLOR_BGR2GRAY);
|
||||||
|
|
||||||
|
|
||||||
std::vector<cv::Rect> platesRegions;
|
std::vector<cv::Rect> platesRegions;
|
||||||
// std::vector<PlateInfo> plates;
|
|
||||||
cv::Size minSize(min_w,min_w/4);
|
cv::Size minSize(min_w,min_w/4);
|
||||||
cv::Size maxSize(max_w,max_w/4);
|
cv::Size maxSize(max_w,max_w/4);
|
||||||
// cv::imshow("input",InputImage);
|
|
||||||
// cv::waitKey(0);
|
|
||||||
cascade.detectMultiScale( processImage, platesRegions,
|
cascade.detectMultiScale( processImage, platesRegions,
|
||||||
1.1, 3, cv::CASCADE_SCALE_IMAGE,minSize,maxSize);
|
1.1, 3, cv::CASCADE_SCALE_IMAGE,minSize,maxSize);
|
||||||
for(auto plate:platesRegions)
|
for(auto plate:platesRegions)
|
||||||
{
|
{
|
||||||
// extend rects
|
|
||||||
// x -= w * 0.14
|
|
||||||
// w += w * 0.28
|
|
||||||
// y -= h * 0.6
|
|
||||||
// h += h * 1.1;
|
|
||||||
int zeroadd_w = static_cast<int>(plate.width*0.30);
|
int zeroadd_w = static_cast<int>(plate.width*0.30);
|
||||||
int zeroadd_h = static_cast<int>(plate.height*2);
|
int zeroadd_h = static_cast<int>(plate.height*2);
|
||||||
int zeroadd_x = static_cast<int>(plate.width*0.15);
|
int zeroadd_x = static_cast<int>(plate.width*0.15);
|
||||||
@@ -50,12 +29,4 @@ namespace pr{
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// std::vector<pr::PlateInfo> PlateDetection::plateDetectionRough(cv::Mat InputImage,cv::Rect roi,int min_w,int max_w){
|
|
||||||
// cv::Mat roi_region = util::cropFromImage(InputImage,roi);
|
|
||||||
// return plateDetectionRough(roi_region,min_w,max_w);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}//namespace pr
|
}//namespace pr
|
||||||
|
|||||||
Reference in New Issue
Block a user