generalized_hough.h
Go to the documentation of this file.
00001 //Created by Alexey Latyshev
00002 // Set of functions for Generic Hough Transform (GHT) for outlets detection
00003 #ifndef _G_HOUGH_H
00004 #define _G_HOUGH_H
00005 
00006 #include <cv.h>
00007 #include <highgui.h>
00008 #include <vector>
00009 #include "outlet_pose_estimation/detail/features.h"
00010 #include "outlet_pose_estimation/detail/affine_transform.h"
00011 #include "outlet_pose_estimation/detail/outlet_model.h"
00012 
00013 // Builds 6-dimension histogram [center x, center y, rotation angle1, x scale, y scale, rotation angle 2]
00014 CvSparseMat* buildHoughHist(std::vector<feature_t>& input, const std::vector<feature_t>& train_features, int* hist_size, float** ranges);
00015 
00018 //float** getMaxHistValues(const CvSparseMat* hist, int* hist_size);
00020 void getMaxHistValues(const CvSparseMat* hist, int* hist_size, float** ranges, float**& maxs, int& count, int MIN_VOTES);
00022 // Return value: max votes
00023 int getMaxHistValues(const CvSparseMat* hist, int* hist_size, float** ranges, float**& maxs, int& count);
00024 
00025 // Calculates maximums of histogram.
00026 
00027 
00028 // Calculates outlet features from given train outlet and affine transform
00029 // Affine transform is array [center x, center y, rotation angle1, x scale, y scale, rotation angle 2]
00030 void calcOutletPosition(const std::vector<feature_t>& train_features, float* affine_transform, std::vector<feature_t>& features);
00031 
00032 //Calculates more accurate outlet position by following algorithm: for each outlet point we select the closest feature point (with distance less than accuracy parameter otherwise we say that there is no the closest feature)
00033 // Then we calculates affine transform between train features and selected features and apply found transform to the train outlet
00034 // If we cannot do this then we clear outlet that means there is no outlet on the image
00035 // INPUT: features - all found features on the image
00036 //                train_features - train outlet
00037 //                src_outlet - test outlet for which we try to calculate exact location
00038 //                accuracy - max distance for feature selecting
00039 //                useSecondAttraction - try to set correspondence between image features and outlet after mapping
00040 // OUTPUT: dst_outlet
00041 //                 reprojectionError - reprojection error for affine transform
00042 void calcExactLocation(std::vector<feature_t>& features,const std::vector<feature_t>& train_features, std::vector<feature_t>& src_outlet, std::vector<feature_t>& dst_outlet, float& reprojectionError, int accuracy = 10, bool useSecondAttraction = true);
00043 
00044 // Main function for GeneralizedHough transform
00045 // Output: holes
00046 float generalizedHoughTransform(std::vector<feature_t>& hole_candidates, const std::vector<feature_t>& train_features, int* hist_size, float** ranges, std::vector<outlet_t>& holes, IplImage* ghtImage = NULL, IplImage* resImage = NULL, char* output_path = 0, char* base_filename = 0);
00047 
00048 void convertFeaturesToOutlet(const std::vector<feature_t>& res_features, std::vector<outlet_t>& holes, IplImage* resImage=0);
00049 void convertFeaturesToOutlet(const std::vector<feature_t>& res_features, const std::vector<bool>& is_detected, std::vector<outlet_t>& holes);
00050 
00051 #endif


outlet_pose_estimation
Author(s): Patrick Mihelich
autogenerated on Thu Nov 28 2013 11:46:23