From 0a44ed03241f7d9a414b114cddaa6a0eb53def7b Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Thu, 4 Oct 2012 14:13:52 +0200 Subject: . --- mariokart01.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/mariokart01.cpp b/mariokart01.cpp index 5f6bcf2..1f7ddde 100644 --- a/mariokart01.cpp +++ b/mariokart01.cpp @@ -405,6 +405,9 @@ int main(int argc, char* argv[]) Mat img_eroded(img_thres.rows, img_thres.cols, img_thres.type()); Mat img_thres2(img_thres.rows, img_thres.cols, img_thres.type()); + Mat img_stddev(img_thres.rows, img_thres.cols, img_thres.type()); + img_stddev=Mat::zeros(img_thres.rows, img_thres.cols, img_thres.type()); + erode(img_thres, img_eroded, Mat::ones(3, 3, CV_8U)); dilate(img_eroded, img_thres2, Mat::ones(3, 3, CV_8U)); @@ -455,21 +458,21 @@ int main(int argc, char* argv[]) stddev_line=sqrt(variance_line); if (mean_value_line>1 && mean_value_line < img.cols-2) { - img_thres2.ptr(row)[mean_value_line-1]=128; - img_thres2.ptr(row)[mean_value_line]=128; - img_thres2.ptr(row)[mean_value_line+1]=128; + img_stddev.ptr(row)[mean_value_line-1]=255; + img_stddev.ptr(row)[mean_value_line]=255; + img_stddev.ptr(row)[mean_value_line+1]=255; } if ((mean_value_line+stddev_line)>1 && (mean_value_line+stddev_line) < img.cols-2) { - img_thres2.ptr(row)[mean_value_line-1+stddev_line]=128; - img_thres2.ptr(row)[mean_value_line+stddev_line]=128; - img_thres2.ptr(row)[mean_value_line+1+stddev_line]=128; + img_stddev.ptr(row)[mean_value_line-1+stddev_line]=255; + img_stddev.ptr(row)[mean_value_line+stddev_line]=255; + img_stddev.ptr(row)[mean_value_line+1+stddev_line]=255; } if ((mean_value_line-stddev_line)>1 && (mean_value_line-stddev_line) < img.cols-2) { - img_thres2.ptr(row)[mean_value_line-1-stddev_line]=128; - img_thres2.ptr(row)[mean_value_line-stddev_line]=128; - img_thres2.ptr(row)[mean_value_line+1-stddev_line]=128; + img_stddev.ptr(row)[mean_value_line-1-stddev_line]=255; + img_stddev.ptr(row)[mean_value_line-stddev_line]=255; + img_stddev.ptr(row)[mean_value_line+1-stddev_line]=255; } } } @@ -501,6 +504,7 @@ int main(int argc, char* argv[]) imshow("diff", img_diff); imshow("hist", img_hist); imshow("thres", img_thres2); + imshow("stddev", img_stddev); waitKey(1000/50); //waitKey(); -- cgit v1.2.3