Commit d895f90b authored by Thiago Santini's avatar Thiago Santini

Reintroduces scaling to ElSe

parent ae119f1c
......@@ -1103,11 +1103,17 @@ RotatedRect ElSe::run(const Mat& frame)
RotatedRect ellipse;
Point pos(0, 0);
if (frame.rows > IMG_SIZE || frame.cols > IMG_SIZE)
float rz_fakk = float(frame.cols) / 384.0;
minArea /= rz_fakk;
maxArea /= rz_fakk;
cv::Mat pic = cv::Mat::zeros(frame.rows / rz_fakk, frame.cols / rz_fakk, CV_8UC1);
cv::resize(frame, pic, pic.size());
if (pic.rows > IMG_SIZE || pic.cols > IMG_SIZE)
return ellipse;
Mat pic;
normalize(frame, pic, 0, 255, NORM_MINMAX, CV_8U);
normalize(pic, pic, 0, 255, NORM_MINMAX, CV_8U);
double border = 0.0; // ER takes care of setting an ROI
double mean_dist = 3;
......@@ -1140,12 +1146,16 @@ RotatedRect ElSe::run(const Mat& frame)
ellipse = find_best_edge(&pic, &detected_edges, &magni, start_x, end_x, start_y, end_y, mean_dist, inner_color_range);
if ((ellipse.center.x <= 0 && ellipse.center.y <= 0) || (ellipse.center.x >= pic.cols || ellipse.center.y >= pic.rows)) {
ellipse = blob_finder(&pic);
ellipse.angle = 0;
ellipse.size = Size(0, 0);
}
ellipse.size.height = ellipse.size.height * rz_fakk;
ellipse.size.width = ellipse.size.width * rz_fakk;
ellipse.center.x = ellipse.center.x * rz_fakk;
ellipse.center.y = ellipse.center.y * rz_fakk;
return ellipse;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment