features.h
Go to the documentation of this file.
00001 /*
00002  *  features.h
00003  *  online_patch
00004  *
00005  *  Created by Victor  Eruhimov on 4/23/09.
00006  *  Copyright 2009 Argus Corp. All rights reserved.
00007  *
00008  */
00009 
00010 #ifndef _OUTLET_DETECTION_FEATURES_H
00011 #define _OUTLET_DETECTION_FEATURES_H
00012 
00013 #include <vector>
00014 #include <cv.h>
00015 
00016 #include "one_way_descriptor_base.h"
00017 
00018 inline CvPoint operator -(CvPoint p1, CvPoint p2)
00019 {
00020     return cvPoint(p1.x - p2.x, p1.y - p2.y);
00021 };
00022 
00023 inline float length(CvPoint p)
00024 {
00025     return sqrt(float(p.x*p.x) + p.y*p.y);
00026 };
00027 
00028 inline cv::Point2f operator -(cv::Point2f p1, cv::Point2f p2)
00029 {
00030     return cv::Point2f(p1.x - p2.x, p1.y - p2.y);
00031 };
00032 
00033 inline cv::Point2f operator -(cv::Point2f p1, CvPoint p2)
00034 {
00035     return cv::Point2f(p1.x - p2.x, p1.y - p2.y);
00036 };
00037 
00038 inline cv::Point2f operator -(CvPoint p1, cv::Point2f p2)
00039 {
00040     return cv::Point2f(p1.x - p2.x, p1.y - p2.y);
00041 };
00042 
00043 inline float length(cv::Point2f p)
00044 {
00045     return sqrt(float(p.x*p.x) + p.y*p.y);
00046 };
00047 
00048 
00049 #if 0
00050 struct feature_t
00051 {
00052     CvPoint center;
00053     float scale;
00054     int part_id;
00055 
00056     ~feature_t() {};
00057     feature_t(CvPoint _center = cvPoint(-1, -1), float _scale = 1, int _part_id = -1)
00058     {
00059         center = _center;
00060         scale = _scale;
00061         part_id = _part_id;
00062     };
00063 };
00064 #else
00065 
00066 /*void operator =(const Point2f& src, CvPoint& dst)
00067 {
00068     dst = cvPoint((int)src.x, (int)src.y);
00069 };*/
00070 #endif
00071 
00072 void GetSURFFeatures(IplImage* src, std::vector<feature_t>& features);
00073 void GetStarFeatures(IplImage* src, std::vector<feature_t>& features);
00074 void GetHarrisFeatures(IplImage* src, std::vector<feature_t>& features);
00075 void GetHoleFeatures(IplImage* src, std::vector<feature_t>& features, float hole_contrast = 1.1f);
00076 //void GetHoleFeatures(IplImage* src, std::vector<feature_t>& features, float hole_contrast = 1.1f);
00077 
00078 void DrawFeatures(IplImage* img, const std::vector<feature_t>& features);
00079 void FilterFeatures(std::vector<feature_t>& features, float min_scale, float max_scale);
00080 
00081 void SelectNeighborFeatures(std::vector<feature_t>& features, const std::vector<feature_t>& voc);
00082 
00083 //namespace cv
00084 //{
00085 //template<> inline void Ptr<IplImage>::delete_obj()
00086 //{ cvReleaseImage(&obj); }
00087 //}
00088 
00089 int LoadFeatures(const char* filename, std::vector<std::vector<feature_t> >& features, std::vector<IplImage*>& images);
00090 void LoadTrainingFeatures(CvOneWayDescriptorObject& descriptors, const char* train_image_filename_object,
00091     const char* train_image_filename_background);
00092 
00093 IplImage* loadImageRed(const char* filename);
00094 
00095 // helper function for running hough transform over several scales
00096 void ScaleFeatures(const std::vector<feature_t>& src, std::vector<feature_t>& dst, float scale);
00097 
00098 void ApplyGamma(IplImage* img, float gamma = 4.0f);
00099 
00100 void FilterFeaturesOnEdges(const IplImage* img, const std::vector<feature_t>& src_features, std::vector<feature_t>& dst_features, int max_edge_dist = 5, int min_contour_size = 15);
00101 
00102 
00103 #endif // _FEATURES_H


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