|
@@ -114,13 +114,12 @@ SemSegContextTree::SemSegContextTree ( const Config *conf, const MultiDataset *m
|
|
|
|
|
|
// geometric features of hoiem
|
|
|
useHoiemFeatures = conf->gB( featsec, "use_hoiem_features", false );
|
|
|
- if ( useHoiemFeatures ) {
|
|
|
+ if ( useHoiemFeatures )
|
|
|
+ {
|
|
|
hoiemDirectory = conf->gS( featsec, "hoiem_directory" );
|
|
|
- // FIXME: do we have to change colorchannels
|
|
|
- // or change channelType??
|
|
|
}
|
|
|
|
|
|
- opOverview = vector<int> ( NBOPERATIONS, 0 );
|
|
|
+ opOverview = vector<int> ( NBOPERATIONS, 0 );
|
|
|
contextOverview = vector<vector<double> > ( maxDepth, vector<double> ( 2, 0.0 ) );
|
|
|
|
|
|
calcVal.push_back ( new MCImageAccess() );
|
|
@@ -1189,7 +1188,7 @@ void SemSegContextTree::extractBasicFeatures ( NICE::MultiChannelImageT<double>
|
|
|
// we could also give the following set as a config option
|
|
|
string hoiemClasses_s = "sky 000 090-045 090-090 090-135 090 090-por 090-sol";
|
|
|
vector<string> hoiemClasses;
|
|
|
- StringTools.split ( hoiemClasses, ' ', hoiemClasses );
|
|
|
+ StringTools::split ( hoiemClasses_s, ' ', hoiemClasses );
|
|
|
|
|
|
// Now we have to do some fancy regular expressions :)
|
|
|
// Original image filename: basel_000083.jpg
|
|
@@ -1201,7 +1200,7 @@ void SemSegContextTree::extractBasicFeatures ( NICE::MultiChannelImageT<double>
|
|
|
FileName fnBase = fn.extractFileName();
|
|
|
|
|
|
// counter for the channel index, starts with the current size of the destination multi-channel image
|
|
|
- int currentChannel = feats.size();
|
|
|
+ int currentChannel = feats.channels();
|
|
|
|
|
|
// add a channel for each feature in advance
|
|
|
feats.addChannel ( hoiemClasses.size() );
|
|
@@ -1210,22 +1209,23 @@ void SemSegContextTree::extractBasicFeatures ( NICE::MultiChannelImageT<double>
|
|
|
for ( vector<string>::const_iterator i = hoiemClasses.begin(); i != hoiemClasses.end(); i++, currentChannel++ )
|
|
|
{
|
|
|
string hoiemClass = *i;
|
|
|
- FileName fnConfidenceImage ( hoiemDirectory + fnBase() + "_c_" + hoiemClass + ".png" );
|
|
|
+ FileName fnConfidenceImage ( hoiemDirectory + fnBase.str() + "_c_" + hoiemClass + ".png" );
|
|
|
if ( ! fnConfidenceImage.fileExists() )
|
|
|
{
|
|
|
- fthrow(Exception, "Unable to read the Hoiem geometric confidence image: " << fnConfidenceImage() << " (original image is " << currentFile << ")" );
|
|
|
+ fthrow(Exception, "Unable to read the Hoiem geometric confidence image: " << fnConfidenceImage.str() << " (original image is " << currentFile << ")" );
|
|
|
} else {
|
|
|
- Image confidenceImage ( fnConfidenceImage() );
|
|
|
+ Image confidenceImage ( fnConfidenceImage.str() );
|
|
|
// check whether the image size is consistent
|
|
|
if ( confidenceImage.width() != feats.width() || confidenceImage.height() != feats.height() )
|
|
|
{
|
|
|
- fthrow(Exception, "The size of the geometric confidence image does not match with the original image size: " << fnConfidenceImage());
|
|
|
+ fthrow(Exception, "The size of the geometric confidence image does not match with the original image size: " << fnConfidenceImage.str());
|
|
|
}
|
|
|
ImageT<double> dst = feats[currentChannel];
|
|
|
+
|
|
|
// copy standard image to double image
|
|
|
for ( uint y = 0 ; y < confidenceImage.height(); y++ )
|
|
|
for ( uint x = 0 ; x < confidenceImage.width(); x++ )
|
|
|
- dst.setPixel ( x, y, (double)confidenceImage.getPixel(x,y) );
|
|
|
+ feats(x, y, currentChannel) = (double)confidenceImage(x,y);
|
|
|
}
|
|
|
}
|
|
|
}
|