VLTIF
CS426FinalProject
SiftType Class Reference

#include <SiftType.h>

Inheritance diagram for SiftType:
DetectorType

List of all members.

Public Member Functions

 SiftType ()
 SiftType (const bool &lc, SIFT::CommonParams const &cp, SIFT::DetectorParams const &detp, SIFT::DescriptorParams const &desp)
 SiftType (const SiftType &orig)
virtual ~SiftType ()
virtual string isType () const
virtual void compute_frame (const Mat &img, vector< KeyPoint > &keypoints, vector< Lane >const &lanes) const
virtual void reset_detector ()

Private Attributes

SIFT sift
bool crop_lanes
SIFT::CommonParams commonParams
SIFT::DescriptorParams descriptorParams
SIFT::DetectorParams detectorParams

Detailed Description

Definition at line 26 of file SiftType.h.


Constructor & Destructor Documentation

SiftType::SiftType ( )

Definition at line 10 of file SiftType.cpp.

References commonParams, descriptorParams, detectorParams, and sift.

                   {
    
    commonParams = sift.getCommonParams();
    detectorParams = sift.getDetectorParams();
    descriptorParams = sift.getDescriptorParams();
    
}
SiftType::SiftType ( const bool &  lc,
SIFT::CommonParams const &  cp,
SIFT::DetectorParams const &  detp,
SIFT::DescriptorParams const &  desp 
)

Definition at line 18 of file SiftType.cpp.

                                    : crop_lanes(lc), detectorParams(detp), descriptorParams(desp){
    
}
SiftType::SiftType ( const SiftType orig)

Definition at line 25 of file SiftType.cpp.

                                       {
}
SiftType::~SiftType ( ) [virtual]

Definition at line 28 of file SiftType.cpp.

                    {
}

Member Function Documentation

void SiftType::compute_frame ( const Mat &  img,
vector< KeyPoint > &  keypoints,
vector< Lane >const &  lanes 
) const [virtual]

Run sift on the current frame and output the keypoints and their descriptors

Parameters:
[in]imgImage to be evaluated
[out]keypointsKeypoints to be shown

Implements DetectorType.

Definition at line 35 of file SiftType.cpp.

References crop_lanes, cropSubImage(), expandRect(), insideLane(), pointsEqual(), and sift.

                                                                                                        {
        
    keypoints.clear();
    vector<KeyPoint> points, tpoints;
    
    //crop lane image
    if( crop_lanes == true ){
        
        Rect bbox;
        Mat subImg;
        
        //iterate over each crop, computing the sub-image, then sift
        for( size_t i=0; i<lanes.size(); i++){
            tpoints.clear();
            
            bbox = expandRect(lanes[i].bbox(), 50, Size(img.cols, img.rows));
            subImg = cropSubImage(img, bbox);
            
            
            sift(subImg, Mat(), tpoints);
            
            //append points to list
            for(size_t k=0; k<tpoints.size(); k++){
                Point2f tp = Point2f(tpoints[k].pt.x+bbox.x, tpoints[k].pt.y+bbox.y);
                tpoints[k].pt = tp;
                points.push_back(tpoints[k]);
            }
        }
        
        //remove unique points
        unique(points.begin(), points.end(), pointsEqual);
        
    }
    else{
    
        sift(img, Mat(), points);
        
    }
    
    for( size_t i=0; i<points.size(); i++)
        if( insideLane(points[i].pt, lanes) == true ){
            keypoints.push_back(points[i]);
        }
}
string SiftType::isType ( ) const [virtual]

Reimplemented from DetectorType.

Definition at line 31 of file SiftType.cpp.

                             {
    return "SiftType";
}
void SiftType::reset_detector ( ) [virtual]

Implements DetectorType.

Definition at line 80 of file SiftType.cpp.

References commonParams, descriptorParams, detectorParams, and sift.


Member Data Documentation

SIFT::CommonParams SiftType::commonParams [private]

Definition at line 52 of file SiftType.h.

Referenced by reset_detector(), and SiftType().

bool SiftType::crop_lanes [private]

Definition at line 51 of file SiftType.h.

Referenced by compute_frame().

SIFT::DescriptorParams SiftType::descriptorParams [private]

Definition at line 53 of file SiftType.h.

Referenced by reset_detector(), and SiftType().

SIFT::DetectorParams SiftType::detectorParams [private]

Definition at line 54 of file SiftType.h.

Referenced by reset_detector(), and SiftType().

SIFT SiftType::sift [private]

Definition at line 49 of file SiftType.h.

Referenced by compute_frame(), reset_detector(), and SiftType().


The documentation for this class was generated from the following files: