gh_outlets.cpp
Go to the documentation of this file.
00001 /*
00002  *  gh_outlets.cpp
00003  *  outlet_detection
00004  *
00005  *  Created by Victor  Eruhimov on 2/10/10.
00006  *  Copyright 2010 Argus Corp. All rights reserved.
00007  *
00008  */
00009 
00010 #include <highgui.h>
00011 #include "outlet_pose_estimation/detail/gh_outlets.h"
00012 #include "outlet_pose_estimation/detail/outlet_model.h"
00013 #include "outlet_pose_estimation/detail/features.h"
00014 #include "outlet_pose_estimation/detail/one_way_outlets.h"
00015 
00016 using namespace std;
00017 
00018 void detect_outlets_gh(IplImage* img, const outlet_template_t& outlet_template, vector<outlet_t>& outlets, IplImage* color_image, 
00019     const char* output_path, const char* output_filename)
00020 {
00021     vector<feature_t> test_points;
00022     GetHoleFeatures(img, test_points);
00023     
00024 #if defined(_VERBOSE)
00025     IplImage* temp = cvCloneImage(color_image);
00026     DrawFeatures(temp, test_points);
00027     
00028 #if 0
00029     cvNamedWindow("1", 1);
00030     cvShowImage("1", temp);
00031     cvWaitKey(0);
00032 #endif
00033     
00034 #if defined(_SAVE_VERBOSE)
00035     cvSaveImage("features.jpg", temp);
00036 #endif //_SAVE_VERBOSE
00037     cvReleaseImage(&temp);
00038 #endif //_VERBOSE
00039     
00040     vector<feature_t> template_points = outlet_template.get_one_way_descriptor_base()->_GetLabeledFeatures();
00041     // reset class_id labels for both template and test points
00042     for(size_t i = 0; i < test_points.size(); i++) test_points[i].class_id = 0;
00043     matchOutlets(test_points, outlet_template, template_points, outlets);
00044     
00045 #if defined(_SAVE_VERBOSE)
00046     IplImage* img1 = cvCloneImage(color_image);
00047     draw_outlets(img1, outlets);
00048     char test_image_filename[1024];
00049     sprintf(test_image_filename, "%s/outlets/%s", output_path, output_filename);
00050     cvSaveImage(test_image_filename, img1);
00051 #endif //_SAVE_VERBOSE
00052     
00053 }


outlet_pose_estimation
Author(s): Patrick Mihelich
autogenerated on Thu Aug 27 2015 14:29:52