Commit ae119f1c authored by Thiago Santini's avatar Thiago Santini

Preinitialize blur matrix

parent 9fdfb9ac
......@@ -136,7 +136,6 @@ Mat PuRe::canny(const Mat& in, const bool blurImage, const bool useL2, const int
* Smoothing and directional derivatives
* TODO: adapt sizes to image size
*/
Mat blurred;
if (blurImage) {
Size blurSize(5, 5);
GaussianBlur(in, blurred, blurSize, 1.5, 1.5, BORDER_REPLICATE);
......@@ -715,6 +714,7 @@ Pupil PuRe::implDetect(const cv::Mat& frame, cv::Rect roi, const float& userMinP
workingSize.height = input.rows;
// Preallocate stuff for edge detection
blurred = Mat::zeros(workingSize, CV_8U);
dx = Mat::zeros(workingSize, CV_32F);
dy = Mat::zeros(workingSize, CV_32F);
magnitude = Mat::zeros(workingSize, CV_32F);
......
......@@ -208,7 +208,7 @@ protected:
void detect(Pupil& pupil);
// Canny
cv::Mat dx, dy, magnitude;
cv::Mat blurred, dx, dy, magnitude;
cv::Mat edgeType, edge;
cv::Mat canny(const cv::Mat& in, const bool blur = true, const bool useL2 = true, const int bins = 64, const float nonEdgePixelsRatio = 0.7f, const float lowHighThresholdRatio = 0.4f);
......
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