|
@@ -17,6 +17,7 @@
|
|
|
|
|
|
#include "core/image/MultiChannelImage3DT.h"
|
|
#include "core/image/MultiChannelImage3DT.h"
|
|
#include "semseg/semseg/SemSegContextTree3D.h"
|
|
#include "semseg/semseg/SemSegContextTree3D.h"
|
|
|
|
+#include "semseg/semseg/SemSegTools.h"
|
|
|
|
|
|
#include "core/basics/ResourceStatistics.h"
|
|
#include "core/basics/ResourceStatistics.h"
|
|
#include "core/image/Morph.h"
|
|
#include "core/image/Morph.h"
|
|
@@ -32,52 +33,6 @@ using namespace NICE;
|
|
|
|
|
|
using namespace std;
|
|
using namespace std;
|
|
|
|
|
|
-void segmentToOverlay ( const NICE::Image *orig, const NICE::ColorImage & segment,
|
|
|
|
- NICE::ColorImage & result )
|
|
|
|
-{
|
|
|
|
- int xsize = orig->width();
|
|
|
|
- int ysize = orig->height();
|
|
|
|
-
|
|
|
|
- result.resize( xsize, ysize );
|
|
|
|
- vector< NICE::MatrixT<double> > channelMat;
|
|
|
|
-
|
|
|
|
- double alpha = .5;
|
|
|
|
-
|
|
|
|
- for (int c = 0; c < 3; c++)
|
|
|
|
- {
|
|
|
|
- NICE::MatrixT<double> chan ( xsize, ysize );
|
|
|
|
- channelMat.push_back( chan );
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- for (int y = 0; y < ysize; y++)
|
|
|
|
- {
|
|
|
|
- for (int x = 0; x < xsize; x++)
|
|
|
|
- {
|
|
|
|
- uchar val = orig->getPixelQuick(x,y);
|
|
|
|
- for (int c = 0; c < 3; c++)
|
|
|
|
- channelMat[c](x,y) = (double)val + alpha*(double)segment.getPixel( x, y, c );
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- for (int c = 0; c < 3; c++)
|
|
|
|
- {
|
|
|
|
- channelMat[c] /= channelMat[c].Max();
|
|
|
|
- channelMat[c] *= 255;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- for (int y = 0; y < ysize; y++)
|
|
|
|
- {
|
|
|
|
- for (int x = 0; x < xsize; x++)
|
|
|
|
- {
|
|
|
|
- for (int c = 0; c < 3; c++)
|
|
|
|
- {
|
|
|
|
- int val = channelMat[c](x,y);
|
|
|
|
- result.setPixel( x, y, c, (uchar)val);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void updateMatrix ( const NICE::ImageT<int> & img,
|
|
void updateMatrix ( const NICE::ImageT<int> & img,
|
|
const NICE::ImageT<int> & gt,
|
|
const NICE::ImageT<int> & gt,
|
|
NICE::Matrix & M,
|
|
NICE::Matrix & M,
|
|
@@ -230,8 +185,8 @@ void startClassification (SemanticSegmentation *semseg,
|
|
|
|
|
|
if ( write_results )
|
|
if ( write_results )
|
|
{
|
|
{
|
|
- segmentToOverlay ( orig.getChannel(1), rgb, ov_rgb );
|
|
|
|
- segmentToOverlay ( orig.getChannel(1), rgb_gt, ov_rgb_gt );
|
|
|
|
|
|
+ SemSegTools::segmentToOverlay ( orig.getChannel(1), rgb, ov_rgb );
|
|
|
|
+ SemSegTools::segmentToOverlay ( orig.getChannel(1), rgb_gt, ov_rgb_gt );
|
|
|
|
|
|
std::stringstream out;
|
|
std::stringstream out;
|
|
if ( output_postfix.size() > 0 )
|
|
if ( output_postfix.size() > 0 )
|