|
@@ -9,7 +9,6 @@
|
|
|
|
|
|
#include "ConvolutionFeature.h"
|
|
|
#include "vislearning/cbaselib/FeaturePool.h"
|
|
|
-#include "vislearning/baselib/cc.h"
|
|
|
|
|
|
using namespace OBJREC;
|
|
|
|
|
@@ -109,8 +108,9 @@ NICE::Vector ConvolutionFeature::getFeatureVector( const Example *example ) cons
|
|
|
NICE::Vector vec(betaLength, 1.0);
|
|
|
|
|
|
NICE::MultiChannelImageT<int> * img = NULL;
|
|
|
+ NICE::MultiChannelImageT<double> * imgD = NULL;
|
|
|
if (isColor)
|
|
|
- img = & example->ce->getIChannel( CachedExample::I_COLOR );
|
|
|
+ imgD = & example->ce->getDChannel( CachedExample::D_EOH );
|
|
|
else
|
|
|
img = & example->ce->getIChannel( CachedExample::I_GRAYVALUES );
|
|
|
|
|
@@ -142,19 +142,13 @@ NICE::Vector ConvolutionFeature::getFeatureVector( const Example *example ) cons
|
|
|
if (isColor)
|
|
|
{
|
|
|
// using HSV color space
|
|
|
- double h,s,v;
|
|
|
- double r = img->get(x+uu,y+vv,0);
|
|
|
- double g = img->get(x+uu,y+vv,1);
|
|
|
- double b = img->get(x+uu,y+vv,2);
|
|
|
-
|
|
|
- ColorConversion::ccRGBtoHSV(r, g, b, &h, &s, &v);
|
|
|
- vec[k] = h;
|
|
|
- vec[k+step] = s;
|
|
|
- vec[k+step+step] = v;
|
|
|
+ vec[k] = imgD->get(x+uu,y+vv,0);
|
|
|
+ vec[k+step] = imgD->get(x+uu,y+vv,1);
|
|
|
+ vec[k+step+step] = imgD->get(x+uu,y+vv,2);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- vec[k] = img->get(x+uu,y+vv);
|
|
|
+ vec[k] = (double)img->get(x+uu,y+vv);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -203,8 +197,9 @@ double ConvolutionFeature::val ( const Example *example ) const
|
|
|
}
|
|
|
|
|
|
NICE::MultiChannelImageT<int> * img = NULL;
|
|
|
+ NICE::MultiChannelImageT<double> * imgD = NULL;
|
|
|
if (isColor)
|
|
|
- img = & example->ce->getIChannel( CachedExample::I_COLOR );
|
|
|
+ imgD = & example->ce->getDChannel( CachedExample::D_EOH );
|
|
|
else
|
|
|
img = & example->ce->getIChannel( CachedExample::I_GRAYVALUES );
|
|
|
|
|
@@ -235,12 +230,10 @@ double ConvolutionFeature::val ( const Example *example ) const
|
|
|
if (isColor)
|
|
|
{
|
|
|
// using HSV color space
|
|
|
- double h,s,v;
|
|
|
- double r = img->get(x+uu,y+vv,0);
|
|
|
- double g = img->get(x+uu,y+vv,1);
|
|
|
- double b = img->get(x+uu,y+vv,2);
|
|
|
+ double h = imgD->get(x+uu,y+vv,0);
|
|
|
+ double s = imgD->get(x+uu,y+vv,1);
|
|
|
+ double v = imgD->get(x+uu,y+vv,2);
|
|
|
|
|
|
- ColorConversion::ccRGBtoHSV(r, g, b, &h, &s, &v);
|
|
|
val1 += h * beta->operator [](k);
|
|
|
val1 += s * beta->operator [](k+step);
|
|
|
val1 += v * beta->operator [](k+step+step);
|