summaryrefslogtreecommitdiff
path: root/horizon_steerer.cpp
diff options
context:
space:
mode:
authorFlorian Jung <florian.a.jung@web.de>2012-12-04 00:52:52 +0100
committerFlorian Jung <florian.a.jung@web.de>2012-12-04 00:52:52 +0100
commit7abab26e3fcdfd6b0f61e3f413d0a4a05c20771c (patch)
tree383df313f95fae62688775864592e06893936b4f /horizon_steerer.cpp
parent2a6085d02541bed487d2a3c3a6418f48ff70ffc7 (diff)
lizenzkram und horizon-steerer-frickel
Diffstat (limited to 'horizon_steerer.cpp')
-rw-r--r--horizon_steerer.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/horizon_steerer.cpp b/horizon_steerer.cpp
index a553410..ea1e79d 100644
--- a/horizon_steerer.cpp
+++ b/horizon_steerer.cpp
@@ -1,9 +1,30 @@
+/*
+ * horizon_steerer.cpp
+ *
+ * Copyright 2012 Florian Jung <florian.a.jung@web.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 3
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <opencv2/opencv.hpp>
#include "horizon_steerer.h"
+#include "util.h"
using namespace std;
using namespace cv;
@@ -17,8 +38,38 @@ HorizonSteerer::HorizonSteerer(int xlen_, int ylen_)
contour_map=new int*[xlen];
for (int i=0;i<xlen;i++)
contour_map[i]=new int[ylen];
+
+ erode_kernel = circle_mat(10);
+
+ contour_map=new int*[xlen];
+ for (int i=0;i<xlen;i++)
+ contour_map[i]=new int[ylen];
+}
+
+
+void HorizonSteerer::process_image(const Mat& img_)
+{
+ Mat img;
+ img_.copyTo(img);
+
+ int area_abs;
+ double area_ratio = only_retain_largest_region(img, &area_abs);
+
+ Mat tmp;
+ dilate(img, tmp, erode_kernel);
+ erode(tmp, img, erode_kernel);
+
+
+ Mat drawing;
+ double confidence;
+ find_steering_point(img, Point(img.cols/2, img.rows-2*img.rows/5), contour_map, drawing, &confidence);
+
}
+double HorizonSteerer::get_steer_data() { return 0.0; }
+double HorizonSteerer::get_confidence() { return 1.0; }
+
+
static void set_pixel(Mat m, Point p, Scalar color)
{