|
@@ -9,6 +9,7 @@
|
|
|
#include "objrec/segmentation/RSMeanShift.h"
|
|
|
#include "objrec/segmentation/RSGraphBased.h"
|
|
|
#include "core/basics/numerictools.h"
|
|
|
+#include "vislearning/baselib/ICETools.h"
|
|
|
|
|
|
#include "core/basics/Timer.h"
|
|
|
#include "core/basics/vectorio.h"
|
|
@@ -2070,11 +2071,11 @@ void SemSegContextTree::semanticseg ( CachedExample *ce, NICE::Image & segresult
|
|
|
if ( pixelWiseLabeling )
|
|
|
{
|
|
|
//finales labeln:
|
|
|
- long int offset = 0;
|
|
|
+ //long int offset = 0;
|
|
|
|
|
|
for ( int x = 0; x < xsize; x++ )
|
|
|
{
|
|
|
- for ( int y = 0; y < ysize; y++, offset++ )
|
|
|
+ for ( int y = 0; y < ysize; y++ )
|
|
|
{
|
|
|
double maxvalue = - numeric_limits<double>::max(); //TODO: das kann auch nur pro knoten gemacht werden, nicht pro pixel
|
|
|
int maxindex = 0;
|
|
@@ -2085,11 +2086,11 @@ void SemSegContextTree::semanticseg ( CachedExample *ce, NICE::Image & segresult
|
|
|
int currentclass = labelmapback[i];
|
|
|
if(useclass[currentclass])
|
|
|
{
|
|
|
- probabilities.data[currentclass][offset] = getMeanProb ( x, y, i, currentfeats );
|
|
|
+ probabilities(x,y,currentclass) = getMeanProb ( x, y, i, currentfeats );
|
|
|
|
|
|
- if ( probabilities.data[currentclass][offset] > maxvalue )
|
|
|
+ if ( probabilities(x,y,currentclass) > maxvalue )
|
|
|
{
|
|
|
- maxvalue = probabilities.data[currentclass][offset];
|
|
|
+ maxvalue = probabilities(x,y,currentclass);
|
|
|
maxindex = currentclass;
|
|
|
}
|
|
|
}
|
|
@@ -2099,6 +2100,45 @@ void SemSegContextTree::semanticseg ( CachedExample *ce, NICE::Image & segresult
|
|
|
cout << "maxvalue: " << maxvalue << endl;
|
|
|
}
|
|
|
}
|
|
|
+#undef VISUALIZE
|
|
|
+#ifdef VISUALIZE
|
|
|
+ for ( int j = 0 ; j < ( int ) probabilities.numChannels; j++ )
|
|
|
+ {
|
|
|
+ //cout << "class: " << j << endl;//" " << cn.text ( j ) << endl;
|
|
|
+
|
|
|
+ NICE::Matrix tmp ( probabilities.height(), probabilities.width() );
|
|
|
+ double maxval = -numeric_limits<double>::max();
|
|
|
+ double minval = numeric_limits<double>::max();
|
|
|
+
|
|
|
+
|
|
|
+ for ( int y = 0; y < probabilities.height(); y++ )
|
|
|
+ for ( int x = 0; x < probabilities.width(); x++ )
|
|
|
+ {
|
|
|
+ double val = probabilities( x, y, j );
|
|
|
+ tmp ( y, x ) = val;
|
|
|
+ maxval = std::max ( val, maxval );
|
|
|
+ minval = std::min ( val, minval );
|
|
|
+ }
|
|
|
+ tmp(0,0) = 1.0;
|
|
|
+ tmp(0,1) = 0.0;
|
|
|
+
|
|
|
+ NICE::ColorImage imgrgb ( probabilities.width(), probabilities.height() );
|
|
|
+ ICETools::convertToRGB ( tmp, imgrgb );
|
|
|
+
|
|
|
+ cout << "maxval = " << maxval << " minval: " << minval << " for class " << j << endl; //cn.text ( j ) << endl;
|
|
|
+
|
|
|
+ std::string s;
|
|
|
+ std::stringstream out;
|
|
|
+ out << "tmpprebmap" << j << ".ppm";
|
|
|
+ s = out.str();
|
|
|
+ imgrgb.write( s );
|
|
|
+ //showImage(imgrgb, "Ergebnis");
|
|
|
+ //getchar();
|
|
|
+ }
|
|
|
+ cout << "fertsch" << endl;
|
|
|
+ getchar();
|
|
|
+ cout << "weiter gehtsch" << endl;
|
|
|
+#endif
|
|
|
}
|
|
|
else
|
|
|
{
|