1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #include <vislearning/nice.h>
- #include <iostream>
- #include "vislearning/features/localfeatures/sift.h"
- #include "vislearning/features/localfeatures/LocalFeatureOpponnentSift.h"
- using namespace OBJREC;
- using namespace std;
- using namespace NICE;
- LocalFeatureOpponnentSift::LocalFeatureOpponnentSift( const Config *conf ):LocalFeatureRGBSift(conf)
- {
- }
- LocalFeatureOpponnentSift::~LocalFeatureOpponnentSift()
- {
- }
- int LocalFeatureOpponnentSift::getDescriptors ( const NICE::ColorImage & cimg,
- VVector & positions,
- VVector & descriptors ) const
- {
- NICE::ColorImage opimg(cimg.width(), cimg.height());
-
- for(int y = 0; y < (int)cimg.height(); y++)
- {
- for(int x = 0; x < (int)cimg.width(); x++)
- {
- // Farbkanaele auslesen
- int r = cimg.getPixel(x,y,0);
- int g = cimg.getPixel(x,y,1);
- int b = cimg.getPixel(x,y,2);
-
- // Transformation in den Opponent Farbraum nach Van de Sande
- int o1 = (int)(((double)(r-g)+255.0)/2.0);
- int o2 = (int)(((double)(r+g-b)+510.0)/4.0);
- int o3 = (int)((double)(r+g+b)/3.0);
- opimg.setPixel(x,y,o1,o2,o3);
- }
- }
-
- return LocalFeatureRGBSift::getDescriptors(opimg, positions, descriptors);
- }
|