modifié : MakefileNoOTB

modifié :         include/Attributes/MoIAttributes.tpp
	modifié :         include/Attributes/SDAttributes.tpp
	modifié :         src/Appli/Option.cpp
	modifié :         src/testMain.cpp
This commit is contained in:
Git Merciol 2018-02-21 10:08:24 +01:00
parent d5590bc10a
commit 4a994e093f
5 changed files with 16 additions and 17 deletions

View File

@ -48,7 +48,7 @@ $(TST_OUT): $(TST_SRC) $(LIB_DIR)/libtriskele.a
testMain: $(TST_OUT) testMain: $(TST_OUT)
# $(TST_OUT) data/nairobi-byte.tif data/result.tif -b 0 -w 4000 -h 4000 --min-tree -A data/areaThresholds.txt # --debug # $(TST_OUT) data/nairobi-byte.tif data/result.tif -b 0 -w 4000 -h 4000 --min-tree -A data/areaThresholds.txt # --debug
# $(TST_OUT) data/10m.tif data/result.tif -b 0 --min-tree --max-tree --tos-tree -A data/areaThresholds.txt -S data/sdThresholds.txt -M data/moiThresholds.txt # --debug # $(TST_OUT) data/10m.tif data/result.tif -b 0 --min-tree --max-tree --tos-tree -A data/areaThresholds.txt -S data/sdThresholds.txt -M data/moiThresholds.txt # --debug
$(TST_OUT) data/10m.tif data/result.tif -b 0 --min-tree --max-tree --tos-tree -A data/areaThresholds.txt -S data/sdThresholds.txt -M data/moiThresholds.txt # --debug $(TST_OUT) data/10m.tif data/result.tif --min-tree --max-tree --tos-tree -A data/areaThresholds.txt -S data/sdThresholds.txt -M data/moiThresholds.txt # --debug
## DEPENDS ############################# ## DEPENDS #############################

View File

@ -16,6 +16,8 @@ inline void
MoIAttributes::cut (vector<vector<PixelT> > &allBands, const AttributeProfiles<PixelT> &attributeProfiles, MoIAttributes::cut (vector<vector<PixelT> > &allBands, const AttributeProfiles<PixelT> &attributeProfiles,
const vector<double> &thresholds) const { const vector<double> &thresholds) const {
DEF_LOG ("MoIAttributes::cut", "thresholds:" << thresholds.size ()); DEF_LOG ("MoIAttributes::cut", "thresholds:" << thresholds.size ());
if (!thresholds.size ())
return;
double maxValue = CompAttribute<double>::getMaxValue (); double maxValue = CompAttribute<double>::getMaxValue ();
cerr << "moi max value:" << maxValue << endl; cerr << "moi max value:" << maxValue << endl;
CompAttributeC<double>::cut (allBands, attributeProfiles, 0, CompAttributeC<double>::cut (allBands, attributeProfiles, 0,

View File

@ -16,6 +16,8 @@ inline void
SDAttributes::cut (vector<vector<PixelT> > &allBands, const AttributeProfiles<PixelT> &attributeProfiles, SDAttributes::cut (vector<vector<PixelT> > &allBands, const AttributeProfiles<PixelT> &attributeProfiles,
const vector<double> &thresholds) const { const vector<double> &thresholds) const {
DEF_LOG ("SDAttributes::cut", "thresholds:" << thresholds.size ()); DEF_LOG ("SDAttributes::cut", "thresholds:" << thresholds.size ());
if (!thresholds.size ())
return;
double maxValue = CompAttribute<double>::getMaxValue (); double maxValue = CompAttribute<double>::getMaxValue ();
cerr << "sd max value:" << maxValue << endl; cerr << "sd max value:" << maxValue << endl;
CompAttributeC<double>::cut (allBands, attributeProfiles, 0, CompAttributeC<double>::cut (allBands, attributeProfiles, 0,

View File

@ -191,8 +191,11 @@ Option::parse (int argc, char** argv) {
GDALDataType inputType = inputImage.getDataType (); GDALDataType inputType = inputImage.getDataType ();
int bandInputCount = inputImage.getBandCount (); int bandInputCount = inputImage.getBandCount ();
if (selectedBand.empty ())
selectedBand = Selected (0, bandInputCount-1);
selectedBand.setLimits (0, bandInputCount-1); selectedBand.setLimits (0, bandInputCount-1);
selectedBand.toSet (); selectedBand.toSet ();
cerr << "coucou:" << selectedBand << endl;
Size orgSize = inputImage.getSize (); Size orgSize = inputImage.getSize ();
if (width < 0 || width > orgSize.width) if (width < 0 || width > orgSize.width)

View File

@ -51,7 +51,7 @@ void apGenerator (Option &option) {
DimChanel maxThresholds = max (max (option.areaThresholds.size (), option.sdThresholds.size ()), option.moiThresholds.size ()); DimChanel maxThresholds = max (max (option.areaThresholds.size (), option.sdThresholds.size ()), option.moiThresholds.size ());
vector <vector <PixelT> > allBands (maxThresholds, vector<PixelT> (leafCount, 0)); vector <vector <PixelT> > allBands (maxThresholds, vector<PixelT> (leafCount, 0));
DimChanel outputBandsCard = 1+treeTypesCard*(option.areaThresholds.size ()+option.sdThresholds.size ()+option.moiThresholds.size ()); // XXX * bands DimChanel outputBandsCard = option.selectedBand.getSet ().size ()*(1+treeTypesCard*(option.areaThresholds.size ()+option.sdThresholds.size ()+option.moiThresholds.size ()));
option.outputImage.createImage (option.size, option.inputImage.getDataType (), outputBandsCard); option.outputImage.createImage (option.size, option.inputImage.getDataType (), outputBandsCard);
Raster<PixelT> raster; Raster<PixelT> raster;
@ -69,17 +69,18 @@ void apGenerator (Option &option) {
atb.setAttributProfiles (attributeProfiles); atb.setAttributProfiles (attributeProfiles);
AreaAttributes areaAttributes (tree); AreaAttributes areaAttributes (tree);
areaAttributes.cut (allBands, attributeProfiles, option.areaThresholds); if (option.areaThresholds.size ()) {
for (DimChanel c = 0; c < option.areaThresholds.size (); ++c, ++chanel) areaAttributes.cut (allBands, attributeProfiles, option.areaThresholds);
option.outputImage.writeBand (&allBands[c][0], chanel); for (DimChanel c = 0; c < option.areaThresholds.size (); ++c, ++chanel)
option.outputImage.writeBand (&allBands[c][0], chanel);
{ // free SDAttributes after use }
if (option.sdThresholds.size ()) {
SDAttributes sdAttributes (tree, areaAttributes); SDAttributes sdAttributes (tree, areaAttributes);
sdAttributes.cut (allBands, attributeProfiles, option.sdThresholds); sdAttributes.cut (allBands, attributeProfiles, option.sdThresholds);
for (DimChanel c = 0; c < option.sdThresholds.size (); ++c, ++chanel) for (DimChanel c = 0; c < option.sdThresholds.size (); ++c, ++chanel)
option.outputImage.writeBand (&allBands[c][0], chanel); option.outputImage.writeBand (&allBands[c][0], chanel);
} }
{ // free MoIAttributes after use if (option.moiThresholds.size ()) {
XYAttributes xyAttributes (tree, areaAttributes); XYAttributes xyAttributes (tree, areaAttributes);
MoIAttributes moiAttributes (tree, areaAttributes, xyAttributes); MoIAttributes moiAttributes (tree, areaAttributes, xyAttributes);
moiAttributes.cut (allBands, attributeProfiles, option.moiThresholds); moiAttributes.cut (allBands, attributeProfiles, option.moiThresholds);
@ -88,15 +89,6 @@ void apGenerator (Option &option) {
} }
} }
} }
//weightAttributes.printValues ("weight");
//tree.printTree ();
//attributeProfiles.printValues ();
//areaAttributes.printValues ("area");
// AverageAttributes averageAttributes (tree, raster, areaAttributes);
// averageAttributes.printValues ("average");
// sdAttributes.printValues ("sd");
// //xyAttributes.printValues ("XY"); // pb print de complexe
// moiAttributes.printValues ("moi");
cerr << endl << "*** apGenerator done!" << endl; cerr << endl << "*** apGenerator done!" << endl;
} }