From 2b023e3bb1176e24d722ec0943b14864f5a70205 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sun, 2 Dec 2012 00:26:20 +0100 Subject: parameter optimiert --- detect_road_borders.cpp | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'detect_road_borders.cpp') diff --git a/detect_road_borders.cpp b/detect_road_borders.cpp index af35651..6ca7153 100644 --- a/detect_road_borders.cpp +++ b/detect_road_borders.cpp @@ -352,7 +352,7 @@ double* calc_angle_deriv(double* angles, int first_nonbottom_idx, int size, int int find_bestquality_index(const vector& contour, double* angle_derivative, int xlen, int ylen, int high_y, int first_nonbottom_idx, Mat& drawing, - int* bestquality_j_out, int* bestquality_width_out, int* bestquality_out) + int* bestquality_j_out, int* bestquality_width_out, int* bestquality_out, int* bestquality_max_out) { assert(bestquality_out!=NULL); assert(bestquality_j_out!=NULL); @@ -378,7 +378,7 @@ int find_bestquality_index(const vector& contour, double* angle_derivativ angle_derivative[j+1] < MAX_HYST*lastmax && angle_derivative[j+2] < MAX_HYST*lastmax) { - if (lastmax > 5) // threshold the maximum. + if (lastmax > 7) // threshold the maximum. { // search backward for the begin of that maximum region int j0; @@ -398,7 +398,7 @@ int find_bestquality_index(const vector& contour, double* angle_derivativ // 3) the corresponding point's x-coordinates are near the middle of the image, if in doubt int middle_x = xlen/2; int distance_from_middle_x = abs(xlen/2 - contour[j].x); - double quality = median_of_max_region + double quality = lastmax * linear( contour[j].y, high_y, 1.0, high_y+ (ylen-high_y)/10, 0.0, true) // excessively punish points far away from the top border * linear( distance_from_middle_x, 0.8*middle_x, 1.0, middle_x, 0.6, true); // moderately punish point far away from the x-middle. @@ -424,6 +424,7 @@ int find_bestquality_index(const vector& contour, double* angle_derivativ // now bestquality_j holds the index of the point with the best quality. *bestquality_out = bestquality; + *bestquality_max_out = bestquality_max; *bestquality_j_out = bestquality_j; *bestquality_width_out = bestquality_width; } @@ -543,12 +544,15 @@ void draw_it_all(Mat drawing, vector< vector >& contours, const vector1.0) *confidence=1.0; return steering_point; } @@ -648,7 +656,8 @@ int main(int argc, char* argv[]) Mat drawing; - find_steering_point(thres, Point(thres.cols/2, thres.rows-thres.rows/5), contour_map, drawing); + double confidence; + find_steering_point(thres, Point(thres.cols/2, thres.rows-2*thres.rows/5), contour_map, drawing, &confidence); @@ -658,8 +667,9 @@ int main(int argc, char* argv[]) area_history_ptr=(area_history_ptr+1)%AREA_HISTORY; int prev_area=area_history_sum/AREA_HISTORY; - cout << "\r\e[2A area = "<