mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 11:46:53 +08:00
Removed comment
This commit is contained in:
@@ -117,124 +117,10 @@ void PlateLines::processImage(Mat inputImage, CharacterRegion* charRegion, float
|
||||
getTime(&endTime);
|
||||
cout << "Plate Lines Time: " << diffclock(startTime, endTime) << "ms." << endl;
|
||||
}
|
||||
//smoothed.release();
|
||||
|
||||
//////////////// METHOD2!!!!!!!////////////////////
|
||||
|
||||
/*
|
||||
Mat imgBlur;
|
||||
Mat imgCanny;
|
||||
GaussianBlur(inputImage, imgBlur, Size(9, 9), 1, 1);
|
||||
|
||||
Canny(imgBlur, imgCanny, 10, 30, 3);
|
||||
|
||||
//int morph_elem = 2;
|
||||
//int morph_size = 1;
|
||||
//Mat element = getStructuringElement( morph_elem, Size( 2*morph_size + 1, 2*morph_size+1 ), Point( morph_size, morph_size ) );
|
||||
morphologyEx( imgCanny, imgCanny, MORPH_CLOSE, element );
|
||||
|
||||
Mat imgShaped;
|
||||
imgCanny.copyTo(imgShaped);
|
||||
//Find contours of possibles characters
|
||||
vector< vector< Point> > biggestShapes;
|
||||
findContours(imgShaped,
|
||||
biggestShapes, // a vector of contours
|
||||
CV_RETR_EXTERNAL, // retrieve the external contours
|
||||
CV_CHAIN_APPROX_SIMPLE ); // all pixels of each contours
|
||||
|
||||
// Draw blue contours on a white image
|
||||
//cvtColor(imgShaped, imgShaped, CV_GRAY2RGB);
|
||||
cv::drawContours(imgShaped,biggestShapes,
|
||||
-1, // draw all contours
|
||||
cv::Scalar(255,255,255), // in blue
|
||||
1); // with a thickness of 1
|
||||
|
||||
displayImage(config, "Blurred", imgCanny);
|
||||
displayImage(config, "Blurred Contours", imgShaped);
|
||||
|
||||
vector<Rect> shapeRects( biggestShapes.size() );
|
||||
|
||||
vector<vector<Point> >hull( biggestShapes.size() );
|
||||
for( int i = 0; i < biggestShapes.size(); i++ )
|
||||
{
|
||||
//approxPolyDP( Mat(biggestShapes[i]), shapeRects[i], 3, true );
|
||||
convexHull( biggestShapes[i], hull[i], false );
|
||||
//approxPolyDP( biggestShapes[i], hull[i], 10, true );
|
||||
|
||||
//minEnclosingCircle( (Mat)contours_poly[i], center[i], radius[i] );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
vector<LineSegment> PlateLines::getLines(Mat edges, bool vertical)
|
||||
{
|
||||
vector<LineSegment> filteredLines;
|
||||
|
||||
int sensitivity;
|
||||
|
||||
LSWMS lswms(Size(edges.cols, edges.rows), 3, 155, false);
|
||||
|
||||
vector<LSEG> lsegs;
|
||||
vector<double> errors;
|
||||
lswms.run(edges, lsegs, errors);
|
||||
|
||||
for( size_t i = 0; i < lsegs.size(); i++ )
|
||||
{
|
||||
if (vertical)
|
||||
{
|
||||
LineSegment candidate;
|
||||
if (lsegs[i][0].y <= lsegs[i][1].y)
|
||||
candidate = LineSegment(lsegs[i][0].x, lsegs[i][0].y, lsegs[i][1].x, lsegs[i][1].y);
|
||||
else
|
||||
candidate = LineSegment(lsegs[i][1].x, lsegs[i][1].y, lsegs[i][0].x, lsegs[i][0].y);
|
||||
|
||||
cout << "VERT Angle: " << candidate.angle << endl;
|
||||
//if ((candidate.angle > 70 && candidate.angle < 110) || (candidate.angle > 250 && candidate.angle < 290))
|
||||
//{
|
||||
// good vertical
|
||||
filteredLines.push_back(candidate);
|
||||
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
LineSegment candidate;
|
||||
if (lsegs[i][0].x <= lsegs[i][1].x)
|
||||
candidate = LineSegment(lsegs[i][0].x, lsegs[i][0].y, lsegs[i][1].x, lsegs[i][1].y);
|
||||
else
|
||||
candidate = LineSegment(lsegs[i][1].x, lsegs[i][1].y, lsegs[i][0].x, lsegs[i][0].y);
|
||||
cout << "HORIZAngle: " << candidate.angle << endl;
|
||||
|
||||
//if ( (candidate.angle > -20 && candidate.angle < 20) || (candidate.angle > 160 && candidate.angle < 200))
|
||||
//{
|
||||
// good horizontal
|
||||
filteredLines.push_back(candidate);
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
// if debug is enabled, draw the image
|
||||
if (this->debug)
|
||||
{
|
||||
Mat debugImg(edges.size(), edges.type());
|
||||
edges.copyTo(debugImg);
|
||||
cvtColor(debugImg,debugImg,CV_GRAY2BGR);
|
||||
|
||||
for( size_t i = 0; i < filteredLines.size(); i++ )
|
||||
{
|
||||
line( debugImg, filteredLines[i].p1, filteredLines[i].p2, Scalar(0,0,255), 1, CV_AA);
|
||||
}
|
||||
if (vertical)
|
||||
displayImage(config, "Lines Vertical", debugImg);
|
||||
else
|
||||
displayImage(config, "Lines Horizontal", debugImg);
|
||||
}
|
||||
|
||||
return filteredLines;
|
||||
}
|
||||
*/
|
||||
|
||||
void PlateLines::cleanupColors(Mat inputImage, Mat outputImage)
|
||||
{
|
||||
|
Reference in New Issue
Block a user