ShowEndpoints.cpp
Go to the documentation of this file.
00001 #include <face_contour_detector/filters/ShowEndpoints.h>
00002 #include <face_contour_detector/ImageForest.h>
00003 #include <string>
00004 #include <face_contour_detector/Bgr8.h>
00005 
00006 namespace face_contour_detector {
00007         namespace filters {
00008 
00009                 ShowEndpoints::ShowEndpoints() {
00010                         ResetParameters();
00011                 }
00012 
00013                 std::vector<Parameter> ShowEndpoints::GetParameters() {
00014                         std::vector<Parameter> re;
00015                         return re;
00016                 }
00017 
00018                 void ShowEndpoints::Apply(const cv::Mat& input, cv::Mat& result) {
00019                         ImageForest forest = ImageForest(input, 200);
00020                         std::map<int, ImageForest::Graph> graphs = forest.GetGraphs();
00021                         result = cv::Mat(input.rows, input.cols, CV_8UC3);
00022                         for (int y = 0; y < input.rows; y++) {
00023                                 for (int x = 0; x < input.cols; x++) {
00024                                         result.at<Bgr8>(y,x).b = input.at<unsigned char>(y,x);
00025                                         result.at<Bgr8>(y,x).g = input.at<unsigned char>(y,x);
00026                                         result.at<Bgr8>(y,x).r = input.at<unsigned char>(y,x);
00027                                 }
00028                         }
00029                         for (int i = 0; i < forest.NumGraphs(); i++) {
00030                                 std::vector<ImageForest::Point>::iterator it;
00031                                 for  (it = graphs[i].endPoints.begin(); it != graphs[i].endPoints.end(); it++) {
00032                                         result.at<Bgr8>(it->y, it->x).b = 0;
00033                                         result.at<Bgr8>(it->y, it->x).g = 255;
00034                                         result.at<Bgr8>(it->y, it->x).r = 0;
00035                                 }
00036                         }
00037                 }
00038 
00039                 void ShowEndpoints::ResetParameters() {
00040 
00041                 }
00042 
00043                 const std::string& ShowEndpoints::GetFilterName() {
00044                         return m_filterName;
00045                 }
00046 
00047                 //static
00048                 std::string ShowEndpoints::m_filterName = std::string("ShowEndpoints");
00049         } //namespace filters
00050 } //namespace face_contour_detector
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends


face_contour_detector
Author(s): Fabian Wenzelmann and Julian Schmid
autogenerated on Wed Dec 26 2012 16:18:17