00001 #ifndef Impala_Core_Feature_Surf_h
00002 #define Impala_Core_Feature_Surf_h
00003
00004 #include "Core/Feature/PointDescriptorTable.h"
00005 #include "Core/Feature/GetColorChannels.h"
00006 #include "Core/Feature/DSurf.h"
00007 #include "Core/Matrix/MatConcatenate.h"
00008
00009 namespace Impala
00010 {
00011 namespace Core
00012 {
00013 namespace Feature
00014 {
00015
00018 void
00019 CalculateSurfDescriptors(Array::Array2dVec3UInt8* inputNoBorder,
00020 PointDescriptorTable* pointData,
00021 String descriptor, int haarSize,
00022 int components, int spatiality)
00023 {
00024 using namespace Matrix;
00025
00026 descriptor = StringReplace(descriptor, "surf", "");
00027 std::vector<Array::Array2dScalarReal64*> channels =
00028 GetColorChannels(inputNoBorder, descriptor);
00029
00030 std::vector<Matrix::Mat*> channelDescriptors;
00031 for(int i=0 ; i<channels.size() ; ++i)
00032 {
00033 Mat* descriptors = DSurf(channels[i], pointData, haarSize,
00034 components, spatiality);
00035 channelDescriptors.push_back(descriptors);
00036 delete channels[i];
00037 }
00038
00039 if(channelDescriptors.size() == 1)
00040 {
00041
00042 pointData->ReplaceAllDescriptors(channelDescriptors[0]);
00043 }
00044 else
00045 {
00046
00047 Matrix::Mat* descriptors =
00048 Matrix::MatConcatenateHorizontal(channelDescriptors);
00049
00050
00051 pointData->ReplaceAllDescriptors(descriptors);
00052
00053 for(int i=0 ; i<channelDescriptors.size() ; i++)
00054 delete channelDescriptors[i];
00055 }
00056 }
00057
00058 }
00059 }
00060 }
00061
00062 #endif